-
Notifications
You must be signed in to change notification settings - Fork 0
Development Workflows
Here we have a collection of gazelib development conventions and workflows. If the convention changes, please update to avoid conflicts.
To develop, clone the repository from GitHub:
$ git clone https://github.com/infant-cognition-tampere/gazelib
Make changes to files, add them to commit, and do commit:
(edit README.rst)
$ git add README.rst
$ git commit -m "Improved documentation"
List files that are not added or not committed:
$ git status
Push local commits to GitHub:
$ git push
Ignore some files by editing .gitignore
:
$ nano .gitignore
Why? First, for compability testing i.e. to ensure that gazelib requires only the packages that are installed in the environment. Second, to conveniently prevent global installation of gazelib's requirements.
Create new conda environment
$ conda create --name gazepy27 python=2 numpy scipy nose-cov
Activate environment
$ source activate gazepy27
(do testing, compile docs, etc)
Deactivate environment
$ source deactivate
We test for both python 2 and python 3. Run:
$ make testpy2
$ make testpy3
The commands create a conda
environment, install everything and run tests. The See Makefile
for all available unit testing options, including faster but not so complete options.
Validate README.rst at rst.ninjs.org/.
- Create a release branch from
develop
:$ git checkout -b release-1.2.3
. - Change version string in
gazelib/package.py
. This is automatically used insetup.py
. - Change version string in
docs/source/conf.py
. - Run tests. See Testing.
- Update documentation. See Compile documentation.
- Git commit:
$ git commit --all -m "v1.2.3 release"
- Merge to master:
$ git checkout master
and$ git merge --no-ff release-1.2.3 -m 'Merge release'
- Create a signed tag:
$ git tag -a 1.2.3 -m "v1.2.3"
- Push commits and tags:
$ git push && git push --tags
- Publish to PyPI. See Publishing to PyPI.
- Switch back to develop to avoid accidentally committing to master:
$ git checkout develop
- Merge to develop:
$ git merge --no-ff release-1.2.3 -m 'Merge release'
- Remove the obsolete release branch:
$ git branch -d release-1.2.3
See also a successful Git branching model.
Follow python packaging instructions:
-
Clean your build to avoid obsolete files:
rm -rf build/ dist/
-
Create an unpacked sdist:
$ python setup.py sdist
-
Create a universal wheel:
$ python setup.py bdist_wheel --universal
- If you see
invalid command 'bdist_wheel'
, run$ pip install wheel
and try again.
- If you see
-
If this is the first release, go to PyPI and register the project by filling the package form by uploading
gazelib.egg-info/PKG_INFO
file. -
Upload the package with twine:
- Sign the dist:
$ gpg --detach-sign -a dist/gazelib-1.2.3.tar.gz
and$ gpg --detach-sign -a dist/gazelib-1.2.3-py2.py3-none-any.whl
- Upload:
twine upload dist/gazelib-1.2.3*
(will ask your PyPI password)
- Sign the dist:
-
Package published!
Updating the package takes same steps except the registration and uploading PKG_INFO
.
ReadTheDocs.org builds the documentation automatically after push to GitHub. Manage ReadTheDocs build at readthedocs.org/projects/gazelib. However, automatic API documentation that we are using is not run automatically and therefore we have to update the documentation by hand. See update documentation below.
ReadTheDocs requires documents to be compatible with Sphinx. With the following you should be able to install it and setup all stuff needed.
$ pip install sphinx
$ mkdir docs
$ cd docs
$ sphinx-quickstart
$ cd ..
$ sphinx-apidoc -o docs/source gazelib
$ cd docs
$ nano index.rst
$ pip freeze > requirements.txt
$ make html
Update documentation:
$ sphinx-apidoc --force -o docs/source gazelib
At ReadTheDocs, go to Advanced Settings and turn on virtualenv. Requirements file is available at docs/requirements.txt
.
The command sphinx-quickstart
asked your name. If your name contains non-ASCII letters e.g. Akseli Palén
, edit docs/conf.py
and turn all instances to unicode strings: 'Akseli Palén'
to u'Akseli Palén'
. There is instances even near the end of the long file.