Tag, Release, and Publish
Change current working directory to your project repository…
cd ~/git/hub/development-tutorials/python-first-library
Add and commit changes…
git add .
git commit -m 'Adds source files for Python library'
Tag last commit for release and push to GitHub…
git tag --annotate v0.0.1 -m ':bookmark: Initial RFC'
git push hub master
git push hub v0.0.1
Make a new release on GitHub (optional as of Python version 3 or greater)…
-
Example:
https://github.com/development-tutorials/python-first-library/releases/new
-
Syntax:
https://github.com/<Account>/<Repository>/releases/new
Publish to PyPi servers
python3 setup.py sdist bdist_wheel
twine upload --repository testpypi dist/python-first-library-0.0.1*
# twine upload dist/python-first-library-0.0.1*
Note, there will be new directories and files generated by the build process…
build/lib
directory, contains directories and files that will be packaged into an archive
dist/
directory, contains archives that will be uploaded to PyPi servers.
python_first_library.egg-info/
directory, contains various metadata about the library… these directories do not need to be tracked by Git, so it’s generally okay to add patterns to the
.gitignore
file to ignore tracking them by default.
Warning if at any point files are removed from the library (eg. via git rm path
), then file(s) will also need to be removed from the build/lib
directory structure.