Skip to content

Add __version__ attribute to boltons package#397

Open
bysiber wants to merge 1 commit intomahmoud:masterfrom
bysiber:add-version-attr
Open

Add __version__ attribute to boltons package#397
bysiber wants to merge 1 commit intomahmoud:masterfrom
bysiber:add-version-attr

Conversation

@bysiber
Copy link
Copy Markdown
Contributor

@bysiber bysiber commented Feb 21, 2026

Adds a __version__ attribute to the boltons package so users can check the installed version at runtime:

import boltons
print(boltons.__version__)

Uses importlib.metadata.version() to read the version from package metadata (set in pyproject.toml), with a fallback to "unknown" for source checkouts where the package isn't installed.

Closes #290

Uses importlib.metadata to read the version from the installed package
metadata, falling back to "unknown" when running from a source checkout
without installing.

This allows users to do:
    import boltons
    print(boltons.__version__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__version__ field

1 participant