Skip to content

deprecate __version__ attribute #2598

@davidism

Description

@davidism

The __version__ attribute is an old pattern from early in Python packaging. Setuptools eventually made it easier to use the pattern by allowing reading the value from the attribute at build time, and some other build backends have done the same.

However, there's no reason to expose this directly in code anymore. It's usually easier to use feature detection (hasattr, try/except) instead. importlib.metadata.version("click") can be used to get the version at runtime in a standard way, if it's really needed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions