Repository navigation
Derive package version from installed metadata - #188
Merged
Merged
Conversation
Removes the hardcoded `__version__` in `behave_django/__init__.py`, which duplicated the setuptools-scm version derived from Git tags and had already drifted out of sync at the 2.0.0 release. The version now comes solely from the installed package metadata, read via `importlib.metadata` at its single point of use in the Sphinx configuration, leaving no second place to keep in step with a release. Since resolving the version requires the distribution to be installed, the documentation builds now install the package under both Tox and Read the Docs, and `docs/contribute.rst` documents serving the generated HTML with `python -m http.server` to inspect it.
There was a problem hiding this comment.
Pull request overview
This PR removes the duplicated hardcoded package version and instead derives the documentation version from installed distribution metadata via importlib.metadata, updating local/hosted docs build configuration accordingly.
Changes:
- Drop
behave_django.__version__and switch Sphinx to read the version from installed package metadata. - Ensure docs builds install the package in Tox and on Read the Docs.
- Update contributor docs to serve built HTML locally via
python -m http.server.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tox.ini |
Docs env now installs the package (no longer skip_install = true) to provide installed metadata. |
docs/contribute.rst |
Update local docs viewing instructions to use an HTTP server. |
docs/conf.py |
Use importlib.metadata.version('behave-django') for Sphinx version/release. |
behave_django/__init__.py |
Remove the hardcoded __version__ attribute. |
.readthedocs.yaml |
Update RTD build image/Python version and install the project so metadata is available. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bittner
force-pushed
the
version-from-metadata
branch
from
July 7, 2026 13:47
4790962 to
120a24b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the hardcoded
__version__inbehave_django/__init__.py, which duplicated the setuptools-scm version derived from Git tags and had already drifted out of sync at the 2.0.0 release. The version now comes solely from the installed package metadata, read viaimportlib.metadataat its single point of use in the Sphinx configuration, leaving no second place to keep in step with a release.Since resolving the version requires the distribution to be installed, the documentation builds now install the package under both Tox and Read the Docs, and
docs/contribute.rstdocuments serving the generated HTML withpython -m http.serverto inspect it.