The following versioning scheme has been developed to make it easier to release new versions of Scuba, while allowing users to always have an accurate idea of the version they are running.
Versions are driven by a "base version", which is kept in scuba/version.py
and is manually updated before each release. This base version follows
Semantic Versioning, and is augmented with additional
information, depending on the environment and they way the software has been
obtained.
There are two different places the Scuba version is maintained; the goal is to ensure these are always in-sync:
-
The
scuba.version.__version__
attribute. This is what is displayed whenscuba --version
is run. -
The metadata, as seen by Pip and on PyPI.
Scuba can be acquired in various ways, each with its own impact on the
versioning scheme. Consider a base version of 1.2.3
:
-
PyPI - Scuba is only deployed to the main PyPI site when a new version is tagged. Thus, the version on PyPI will always be nothing more than the base version.
-
Test PyPI - Scuba is automatically deployed (via Travis-CI) to the PyPI Testing Site upon each push to the
main
branch. PyPI requires non-local PEP 440 -compliant versions. Because of this, the Travis CI build number is appended to the base version, excluding any Git information, e.g.1.2.3.456
where456
is the build number. This ensures that the latest build onmain
will always be deployed to PyPI testing as the newest version. -
Git clone - Scuba can be run from a local Git repository. In this case, the version presented by Scuba will come from the output of
git describe
, and will look like this:1.2.3-45-gabcdef
, where-45
is the number of commits since version1.2.3
, andabcdef
is the hash of the current commit. The version may also include-dirty
if there are any uncommitted modifications to the code. -
Git archive - Scuba can be run from an archive of the Git repository, either from
git archive
or by downloading a source tarball from GitHub. In this case, the version presented by Scuba will come from substituions made by Git during archive creation, controlled by theexport-subst
attribute. The version will look like this:1.2.3-gabcdef
, whereabcdef
is the hash of the current commit. -
Source distribution - Scuba can be run from a source distribution, created via
python setup.py sdist
. In this case, the version comes from the egg info generated by setuptools.
In any case, when Scuba is installed, the version comes from
importlib.metadata
.