How to publish a new release of NNMT¶

  1. Checkout the develop branch

    git checkout develop
    git pull
    
  2. Check that the code is working

    Make sure the new feature you implemented does what it is supposed to do.

  3. Check that code is tested

    The point above should be done by writing tests that ensure this.

  4. Check that code is well documented

    Follow the guidelines in the docs for this.

  5. Check the release notes

    All changes need to be documented in the release notes.

  6. Check that all tests run

    cd tests/
    pytest
    cd ../
    
  7. Create a release branch

    git checkout -b release-<release_number>
    
  8. Fix anything left

  9. Update version numbers to pre-format

    In nnmt/__init__.py, docs/source/conf.py, and setup.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.

  10. Create new conda environment and check local installation

    conda create -n temp0
    conda activate temp0
    conda install setuptools
    pip install .
    cd tests/
    pytest
    cd ../
    
  11. Create sdist and wheel

    Remove any old wheels

    rm -r dist/
    

    Then check that setup.py contains all necessary data by running

    python 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.

  12. Upload to test.pypi

    Then install twine and upload to testpypi

    WARNING: 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/*
    
  13. 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 ../
    
  14. If this fails, fix problems, change version numbers to 1.0.0b and repeat.

  15. Update version numbers to final format

    In nnmt/__init__.py, docs/source/conf.py, and setup.py,

    and commit

    git add nnmt/__init__.py docs/source/conf.py setup.py
    git commit -m 'Final update of version numbers'
    
  16. Merge into master and develop and delete release branch

    git 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>
    
  17. Create sdist and wheel

    conda activate temp0
    rm -r dist/
    python setup.py check
    python setup.py sdist bdist_wheel
    
  18. Upload to test.pypi

    twine upload --repository-url https://test.pypi.org/legacy/ dist/*
    
  19. 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 ../
    
  20. 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/*
    
  21. Test pip install

  22. 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
    
  23. 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.

  24. Upload compressed compy of the repository to Zenodo

  25. Check readthedocs