Python/Managing Packages

From Dev Wiki
< Python
Revision as of 03:13, 17 February 2023 by Brodriguez (talk | contribs) (Create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
ToDo: Document initially setting up a third-party package.


Pushing a New Version

1) Install/update required dependencies for uploading to pypi:

pip install --upgrade build
pip install --upgrade twine


2) Update all internal project references, regarding current project version. At minimum, this will probably be the files:

  • docs/source/conf.py
  • pyproject.toml
  • setup.cfg

May be additional files to update, depending on the actual project setup and internal documentation.

Ex: If previous version was 1.0.0 and you're uploading a bug fix release, then you might update all references to say 1.0.1.


3) As an optional step, first merge changes into the main/master branch, and push to GitHub/BitBucket/GitLab/etc. Then verify ReadTheDocs pulled and built new docs successfully.


4) As another optional step, give a meaningful version name as a git tag. See Programming/Git#Tag_Commands.


5) Build project files to finally push to pypi:

python -m build

After running this command, there should be a dist folder at project root. Double check that the version listed in the file names seems correct, compared to what was done in step #2 above.


6) Finally push the new project version files to pypi:

python -m twine upload dist/*


At this point, the project should be updated on Pypi. Verify everything has successfully uploaded, and the new version can now be pulled down.