NASA-PDS / pds-github-util

[ARCHIVED] Github utility functions to enforce the PDS engineering node software life cycle.
https://nasa-pds.github.io/pds-github-util
Other
0 stars 2 forks source link

As a release engineer, I want version numbers to be retrieved from Python packages #11

Closed nutjob4life closed 3 years ago

nutjob4life commented 3 years ago

The pds-github-util attempts to parse setup.py files with a simple regexp that looks for version= somewhere in the text. This won't work with the recently recommended approach for declarative package metadata that puts all the information into setup.cfg, and which we should move to.

But it won't work today with Versioneer, which we're now using with current and new Python repositories, including the template repository. This is because the version is a computed function, namely:

setup(
    …
    version=versioneer.get_version(),
    …
)

which pds-github-util considers as version ersioneer.get_version(….

Instead, if possible, it should execute Python on setup.py with the version command and parse the output form the VCS dict. For example:

$ venv/bin/python setup.py version 2>/dev/null
running version
keywords are unexpanded, not using
got version from VCS {'version': '1.0.0.post0.dev18', 'full-revisionid': '3ce310983d7198b83ac0f05a5d2a3257ba52a206', 'dirty': True, 'error': None, 'date': '2021-06-08T13:33:18-0500'}
Version: 1.0.0.post0.dev18
 full-revisionid: 3ce310983d7198b83ac0f05a5d2a3257ba52a206
 dirty: True
 date: 2021-06-08T13:33:18-0500

Here, the VCS dict has a version key which indicates what the version is.

MJJoyce commented 3 years ago

I have no clue how or why I reopened this yesterday ... Must have been a missclick

nutjob4life commented 3 years ago

😅