Skip to content

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Jan 12, 2024

Fixes #897

I think importlib.metadata import version; __version__ = version('<package_name>') is now the recommended way to get the version of an installed package. Except that I guess it makes things a bit slower and I don't know how stable that is. So I chose to still rely on trying first to get the version from _version.py (automatically created by hatch-vcs/setuptools-scm) and only then, if it fails like in #897, to try to get it using importlib.

@maximlt maximlt changed the title more robust version number collection Fix building with setuptools-scm<7 Jan 12, 2024
@maximlt maximlt merged commit dc13dc2 into main Jan 15, 2024
@maximlt maximlt deleted the compat_old_setuptools_scm branch January 15, 2024 09:26
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.

'import param' fails: ImportError: cannot import name '__version__' from 'param._version' (/usr/local/lib/python3.9/site-packages/param/_version.py)
1 participant