Python Packaging - Version / Release

> Procedural Languages > Python > Python - (Shipping|Packaging)

1 - About

Code - Version and Code Versioning - Release in Python

This naming convention of compiled files allows compiled modules from different releases of Python to coexist.

Advertising

3 - Properties

All below properties of a build. ie:

All properties may be specified in the alias command. The alias command has default value that can be specified:

  • sitewide
  • or per-user

Projects may overwrite them.

Example with an alias called daily a daily job would run in each project directory

setup.py daily

3.1 - Scheme

Any scheme can be chosen if it follows this comparison. See doc

>>> from pkg_resources import parse_version
>>> parse_version('1.9.a.dev') == parse_version('1.9a0dev')
True
>>> parse_version('2.1-rc2') < parse_version('2.1')
True
>>> parse_version('0.6a9dev-r41475') < parse_version('0.6a9')
True

This comparison is used by setuptools to tell which version is newer than the other.

Advertising

3.2 - Tag

setuptools allows you to “tag”:

with:

  • pre-release tag such as “build” or “dev”
  • post-release tag, such as:
    • a build or revision number (–tag-build=STRING, -bSTRING)
    • build date (–tag-date, -d) - 8-character

You can add these tags by adding egg_info and the desired options to the command line ahead of the sdist or bdist commands that you want to generate a daily build or snapshot for.

See

Default tags may be specified in setup.cfg:

Advertising

3.3 - Rotate

the rotate command lets you automatically delete all but the N most-recently-modified distributions matching a glob pattern.

Example: To build an egg whose version info includes ‘DEV-rNNNN’ (where NNNN is the most recent Subversion revision that affected the source tree), and then delete any egg files from the distribution directory except for the three that were built most recently.

setup.py
setup.py egg_info -rbDEV bdist_egg rotate -m.egg -k3

4 - Official

5 - Management

5.1 - Update

https://pyup.io/ - Keep Python dependencies secure, up-to-date & compliant

6 - Documentation / Reference