How do I actually create a release/distro of a python package that uses a git repo tag for the versioning, using setuptools
and pbr
?
There is plenty of information on the basic setup and configuration required:
setuptools
and pbr
But where is the simple info on how to actually create the distro?
i.e. I'm looking for whatever command finds the git tag with the version info and pulls it into the configuration info, so the source with that new version info can be distributed, and the version info is discoverable from the scripts, using a method like described in this answer.
I'm working on a project that will be distributed to other developers only through a git repo, not through PyPi. The project will be released to users as an executable using pyinstaller
, so this package distribution will only serve a few key purposes:
pbr
to generate versions from the Git repo tags, so those tags can be our source of truth for versioningpbr
for other auto generation of mundane items from Git, such as authors, manifest.in file, release notes, etc.Since setuptools
docs focus on setting up a fully distributable and reusable package with PyPi and pip
, and pbr
docs only really tell you how to modify setuptools
configuration to use pbr
, I can't find the info on how to just run the distribution/release process.
I'm sure it exists somewhere in the documentation, but after several false starts I'm asking here. It is implied everywhere I look that everyone either knows how to do this or it just magically happens as a part of the process.
Am I just missing the obvious?
Update:
Based on sinoroc's answer, it appears I need to look into development mode installs. i.e. Anyone developing the project will clone from git, and then install via using setuptools
development install mode.
This wasn't directly a part of the original question, but implied, and I believe will be of interest to people in the same situation (info I couldn't easily find).
More info is available in his answer on updating some of the metadata, and via this setuptools
documentation link to working in "Development Mode"
In short:
python3 setup.py sdist
python3 setup.py bdist_wheel
How do I actually create a release/distro of a python package that uses a git repo tag for the versioning, using setuptools and pbr?
The usual commands to create (source and wheel) distributions of your Python package with setuptools are: python3 setup.py sdist
and python3 setup.py bdist_wheel
. The distributions can then be found in the dist
directory by default.
Since setuptools docs focus on setting up a fully distributable and reusable package with PyPi and pip, and pbr docs only really tell you how to modify setuptools configuration to use pbr, I can't find the info on how to just run the distribution/release process.
It is true that setuptools does not document this. It only documents the differences to distutils
, and it is confusing indeed. See below for actual documentation...
But where is the simple info on how to actually create the distro?
Update
Since you don't plan on publishing distributions of your project on an index such as PyPI, and you plan on using pyinstaller instead, then you can indeed most likely disregard the setuptools commands such as sdist
and bdist_wheel
.
Still you might want to know these commands for the development phase:
python3 setup.py --version
, python3 setup.py --fullname
to figure out if setuptools (and in your case pbr) is catching the right info.python3 setup.py develop
(or pip install --editable .
) to place a pseudo link (egg-link
) in your site-packages that points at your work in progress. This way your changes are always installed and importable. Important: don't use python3 setup.py install
, this would copy the current version to site-packages and newer changes would not be importable.Now I don't know how all this will work once you move on to pyinstaller. Especially since you mentioned that you want the meta info (such as the version number) to be discoverable from within your scripts. The technique with setuptools pkg_resources
may or may not work in the pyinstaller context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With