Create version file in python pipeline
The Python pipeline needs to create a version file so that the application has access to its version at runtime.
The setuptools-scm package produces a file that looks like this:
# file generated by setuptools-scm
# don't change, don't track in version control
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object
version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
__version__ = version = '0.4.2.dev0+gdf0ff81.d20250723'
__version_tuple__ = version_tuple = (0, 4, 2, 'dev0', 'gdf0ff81.d20250723')
I think this might be a bit much, but we can do something like this to emulate:
__version__ = version = '0.0.0'
__version_tuple__ = version_tuple = (0, 4, 2)
The location where this file is written can be set with PYTHON_TAG_VERSION_FILE, or turned off by setting to an empty string. The default value is $PYTHON_PACKAGE/_version.py.
Edited by Brett Weir