You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, dynamic versioning is performed by reading the provided file as a raw text file, even if it is a python file (e.g., __about__.py). This means hatch cannot parse the version if it parsed from elsewhere at build-time.
For example, suppose I have a separate YAML file with additional metadata about the project, I may want to parse the version (among other metadata) from that file at build-time. (I recognize this is a very strange case that can be worked around in different ways, but this is nonetheless a functional example to show how the documentation introduces confusion)
This causes confusion in the current versioning documentation (https://hatch.pypa.io/1.13/version/), which suggests referencing python files (e.g., __about__.py or __init__.py) to pull the dynamic version. This makes it somewhat unclear that these files are parsed literally as strings, and not evaluated at build-time. I'd suggest either changing these examples to not be python files, include non-python examples for comparison/clarification, and/or state more explicitly that the file at version.path is parsed as raw text.
The text was updated successfully, but these errors were encountered:
nyoma-diamond
changed the title
Improve dynamic versioning documentation (clarity regarding regex vs. python evaluation))
Improve dynamic versioning documentation (clarify regarding regex vs. python evaluation))
Feb 13, 2025
Currently, dynamic versioning is performed by reading the provided file as a raw text file, even if it is a python file (e.g.,
__about__.py
). This means hatch cannot parse the version if it parsed from elsewhere at build-time.For example, suppose I have a separate YAML file with additional metadata about the project, I may want to parse the version (among other metadata) from that file at build-time. (I recognize this is a very strange case that can be worked around in different ways, but this is nonetheless a functional example to show how the documentation introduces confusion)
This causes confusion in the current versioning documentation (https://hatch.pypa.io/1.13/version/), which suggests referencing python files (e.g.,
__about__.py
or__init__.py
) to pull the dynamic version. This makes it somewhat unclear that these files are parsed literally as strings, and not evaluated at build-time. I'd suggest either changing these examples to not be python files, include non-python examples for comparison/clarification, and/or state more explicitly that the file atversion.path
is parsed as raw text.The text was updated successfully, but these errors were encountered: