scriptharness.version module¶
Deal with the scriptharness version in semver format.
However, since writing this I’ve discovered that setuptools and sphinx don’t accept all semver formatted versions. It’s not clear if this will go away.
When called as a script, this will update ../version.json with the appropriate version info.
-
scriptharness.version.
__version__
¶ tuple
semver version - three integers and an optional string.
-
scriptharness.version.
__version_string__
¶ str
semver version in string format.
-
scriptharness.version.
get_version_string
(version)¶ Translate a version tuple into a string.
Specify the __version__ as a tuple for more precise comparisons, and translate it to __version_string__ for when that’s needed.
This function exists primarily for easier unit testing.
Parameters: version (tuple) – three ints and an optional string. Returns: version_string – the tuple translated into a string per semver.org Return type: str
-
scriptharness.version.
write_version
(name=None, path=None)¶ Write the version info to ../version.json, for setup.py
Parameters: - name (Optional[str]) – this is for the
write_version(name=__name__)
below. That’s one way to both follow theif __name__ == '__main__':
convention but also allow for full coverage without ignoring parts of the file. - path (Optional[str]) – the path to write the version json to. Defaults to ../version.json
- name (Optional[str]) – this is for the