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

Add importlib.metadata as an approach in "Single-sourcing the package version" #616

Open
chrahunt opened this issue May 7, 2019 · 3 comments
Labels
component: guides type: enhancement A self-contained enhancement or new feature

Comments

@chrahunt
Copy link
Member

chrahunt commented May 7, 2019

The current version of "Single-sourcing the package version" has an example using pkg_resources. It would probably make sense to include an item using importlib.metadata since it will be standard in 3.8 with a backport as importlib_metadata and can serve the same purpose. That may look like

from importlib_metadata import version

__version__ = version(__package__)
@soxofaan
Copy link
Contributor

soxofaan commented Apr 1, 2022

I think this issue can be closed as it is already handled in 3c7c07f (and followup tweaks)

@bhrutledge
Copy link
Contributor

I think the documentation could be improved; looking at option 5 in https://packaging.python.org/en/latest/guides/single-sourcing-package-version/, I don't actually see a complete example of this technique.

@pradyunsg
Copy link
Member

I suggest that we close this out and file a separate issue for improving the option 5 to de-emphasize pkg_resources and prefer importlib.metadata on 3.8 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: guides type: enhancement A self-contained enhancement or new feature
Projects
None yet
Development

No branches or pull requests

5 participants
@soxofaan @bhrutledge @chrahunt @pradyunsg and others