Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Use importlib.metadata for versioning #195

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

nvictus
Copy link
Member

@nvictus nvictus commented Apr 5, 2024

Version determination

This PR changes the way __version__ is set.

Old way:

  • build time: dynamic build-time determination of version by reading the __variable__ from a source file
  • run time: __version__ is specified in the source code

New way:

  • build time: we now specify the package version statically in pyproject.toml
  • run time: use the import system importlib.metadata.version to retrieve the appropriate version number from installed package metadata

This method is preferred because it ensures that the version information is centralized in one place (in the package distribution metadata) and reduces the risk of inconsistencies between the code and the package metadata.

Other changes

  • Make all __all__ exports fully explicit.
  • Update ruff invocation syntax and configuration.
  • Add a hatch test env matrix for multiple Python versions.

@nvictus nvictus merged commit b17f3b1 into open2c:main Apr 5, 2024
6 checks passed
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.

1 participant