How to publish a new release of NNMT¶
Checkout the develop branch
git checkout develop git pull
Check that the code is working
Make sure the new feature you implemented does what it is supposed to do.
Check that code is tested
The point above should be done by writing tests that ensure this.
Check that code is well documented
Follow the guidelines in the docs for this.
Check the release notes
All changes need to be documented in the release notes.
Check that all tests run
cd tests/ pytest cd ../
Create a release branch
git checkout -b release-<release_number>
Fix anything left
Update version numbers to pre-format
In
nnmt/__init__.py
,docs/source/conf.py
, andsetup.py
.WARNING: You can upload each file only once to testpypi, even if you delete them on testpypi. Therefore use version names like
1.0.0a0
.Create new conda environment and check local installation
conda create -n temp0 conda activate temp0 conda install setuptools pip install . cd tests/ pytest cd ../
Create sdist and wheel
Remove any old wheels
rm -r dist/
Then check that
setup.py
contains all necessary data by runningpython setup.py check
If this works, you can create the sdist and wheel source distribution using
python setup.py sdist bdist_wheel
which creates a new directory
dist
.Upload to test.pypi
Then install
twine
and upload to testpypiWARNING: You can upload each file only once, even if you delete them on testpypi. Therefore use version names like
1.0.0a
.conda install twine twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Create new conda env and test install from test.pyi
conda create -n temp1 conda activate temp1 conda install pip pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple nnmt==<release_number> cd tests/ pytest cd ../
If this fails, fix problems, change version numbers to
1.0.0b
and repeat.Update version numbers to final format
In
nnmt/__init__.py
,docs/source/conf.py
, andsetup.py
,and commit
git add nnmt/__init__.py docs/source/conf.py setup.py git commit -m 'Final update of version numbers'
Merge into
master
anddevelop
and delete release branchgit checkout master git pull git merge --no-ff release-<release_number> git push git checkout develop git pull git merge --no-ff release-<release_number> git push git checkout master git branch -d release-<release_number>
Create sdist and wheel
conda activate temp0 rm -r dist/ python setup.py check python setup.py sdist bdist_wheel
Upload to test.pypi
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Create new conda env and test install from test.pypi
conda create -n temp2 conda activate temp2 conda install pip pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple nnmt==<release_number> cd tests/ pytest cd ../
Upload to pypi
Finally, you can upload your package to pypi.
WARNING: This cannot be reversed, and the code cannot be changed afterwards, so the package needs to be in a final state.
conda activate temp0 twine upload dist/*
Test pip install
Remove temporary conda environments
conda activate base conda env remove -n temp0 conda env remove -n temp1 conda env remove -n temp2 conda env remove -n temp3
Create Release on GitHub
Optional: Create tag from command line
git tag -a v<release_number> git push origin --tags
Note that releases are a GitHub feature and can only be done on GitHub itself.
Upload compressed compy of the repository to Zenodo
Check readthedocs