Skip to content

Derive package version from installed metadata - #188

Merged
bittner merged 1 commit into
mainfrom
version-from-metadata
Jul 7, 2026
Merged

bittner merged 1 commit into
mainfrom
version-from-metadata

Conversation

@bittner

@bittner bittner commented Jul 7, 2026

Copy link
Copy Markdown
Member

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .readthedocs.yaml Resolved
Comment thread tox.ini Resolved
Comment thread behave_django/__init__.py Resolved
@bittner
bittner force-pushed the version-from-metadata branch from 4790962 to 120a24b Compare July 7, 2026 13:47
@bittner
bittner merged commit 989cf4a into main Jul 7, 2026
29 checks passed
@bittner
bittner deleted the version-from-metadata branch July 7, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants