Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

New version process #14

Merged
merged 5 commits into from
Feb 12, 2020
Merged

New version process #14

merged 5 commits into from
Feb 12, 2020

Conversation

daxpryce
Copy link
Contributor

Providing a version on build to a python library is remarkably complex. By python convention, your module should contain a version in the root module (e.g. topologic.__version__).

Separate from that, setuptools setup.py requests a version number as well - and you definitely want these to match. To make it more difficult, if one were to clone the repository and run setuptools themselves without installing the requirements, they won't even be able to import topologic to get it that way.

What we ended up going with is a submodule for the version.py file to live in. This version.py looks in version.txt for a version number - and on pre-release and release, this file will contain the actual version as part of the Github workflow action. If this file is empty, however, it will generate a version number based on the manually-adjusted semver in version.py, the dev prerelease indicator, and the current timestamp.

Thus, local builds via setuptools or pip (which is using setuptools in the background) will get a fixed version number on build.

Lastly, if the repository is to be cloned and the package not installed, but a python interpreter opened in the root directory, it will generate a version number based on the manually-adjusted semver in version.py, the dev prerelease indicator, and the current timestamp at the time of importing topologic to the interpreter.

Dwayne Pryce added 2 commits February 12, 2020 11:45
Providing a version on build to a python library is remarkably complex. By python convention, your module should contain a __version__ in the root module (e.g. `topologic.__version__`).

Separate from that, setuptools setup.py requests a version number as well - and you definitely want these to match. To make it more difficult, if one were to clone the repository and run
setuptools themselves without installing the requirements, they won't even be able to import topologic to get it that way.

What we ended up going with is a submodule for the version.py file to live in. This version.py looks in version.txt for a version number - and on pre-release and release, this file will contain
the actual version as part of the Github workflow action. If this file is empty, however, it will generate a version number based on the manually-adjusted semver in `version.py`, the `dev`
prerelease indicator, and the current timestamp.

Thus, local builds via setuptools or pip (which is using setuptools in the background) will get a fixed version number on build.

Lastly, if the repository is to be cloned and the package not installed, but a python interpreter opened in the root directory, it will generate a version number based on the manually-adjusted
semver in `version.py`, the `dev` prerelease indicator, and the current timestamp _at the time of importing topologic to the interpreter_.
… to make a bit more sense (test_push could mean a few things, instead of 'test on push')
@daxpryce daxpryce linked an issue Feb 12, 2020 that may be closed by this pull request
setup.py Outdated Show resolved Hide resolved
Dwayne Pryce added 2 commits February 12, 2020 12:10
…ontrol, and it's easy to accidentally add fixed version numbers to that file and commit them. Also refer to version by relative path import not a pseudo-circular import within topologic's __init__.py file
@daxpryce daxpryce merged commit 2ea5e2a into dev Feb 12, 2020
@daxpryce daxpryce deleted the version-branch-release branch February 12, 2020 20:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework version
2 participants