read-version

raw JSON →
0.3.2 verified Fri May 01 auth: no python deprecated

Extract your project's __version__ variable by parsing Python source code without importing. Version 0.3.2, project is inactive and no longer supported.

pip install read-version
error ModuleNotFoundError: No module named 'read_version'
cause Library not installed or misspelled.
fix
Install with: pip install read-version
error AttributeError: module 'read_version' has no attribute 'read_version'
cause Wrong import pattern.
fix
Use 'from read_version import read_version' instead of 'import read_version'
deprecated Project is inactive and no longer supported. Use alternatives like importlib.metadata or pkg_resources.
fix Switch to importlib.metadata.version('your_package') or from importlib.metadata import version
gotcha Before v0.3.1, importing read_version could trigger a deprecation warning about distutils if setuptools was not imported first.
fix Upgrade to v0.3.1+ or explicitly import setuptools before read_version: import setuptools; from read_version import read_version

Read __version__ from a Python package without importing it.

from read_version import read_version
version = read_version('mypackage')
print(version)