--- id: read-version version: "0.3.2" license: MIT license_treatment: permissive maintenance: abandoned --- # read-version — Extract your project's __version__ variable License: permissive · Maintenance: abandoned · Downloads: 185.0K/mo ## What it is and what it does read_version is a small utility that parses Python source files to extract the value of a variable (typically __version__) for use during package setup. It was designed to eliminate the repetitive boilerplate code that developers write in setup.py to read version strings from their package's __init__.py or other source files. The package offers two approaches: a functional API (import and call read_version() in setup.py) and a declarative approach (configure metadata extraction via pyproject.toml). However, the package is abandoned and explicitly marked obsolete—setuptools has supported the attr: directive natively since version 46.4.0, which provides the same functionality without an external dependency. New projects should use setuptools' built-in mechanism instead. Use it for: - Migrating older projects that use read_version to avoid rewriting setup.py when upgrading setuptools. - Extracting multiple metadata fields (author, license, keywords) from source variables via pyproject.toml configuration. - Reading version from non-standard variable names or file locations using the variable and path parameters. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Extracts a version string or other variable from Python source code for use in setup.py, eliminating boilerplate version-parsing code during package builds. No. The package is abandoned (last release July 2021, repository archived) and explicitly superseded by setuptools' native attr: directive. New projects should use setuptools 46.4.0+ instead. Only consider read_version if maintaining legacy code that already depends on it and you cannot upgrade setuptools. ## Install pip install read-version uv add read-version poetry add read-version ## Installing read-version Before you install: Installation is straightforward with low friction—a pure Python wheel with only setuptools as a runtime dependency. However, the package is abandoned as of 2021 and explicitly superseded by setuptools' native attr: directive (available since setuptools 46.4.0), making it obsolete for new projects. License in practice: Licensed under MIT (permissive), so there are no licensing restrictions on use or redistribution. Quickstart: # In setup.py: from read_version import read_version setup( version=read_version('packagename', '__init__.py'), ... ) # Or declaratively in pyproject.toml: # [tool.read_version] # version = "packagename:__version__" Requires Python 3.6 or higher. The declarative approach also requires setuptools 42.0.0 or later. The package is no longer maintained; modern projects should use setuptools' native attr: directive instead. Verify before relying: - Whether the package's static analysis correctly handles all edge cases in real-world __version__ assignments (e.g., complex expressions, conditional assignments). - Performance characteristics when parsing large or complex source files. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 185.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags extract version from python source, setup.py version parsing, read __version__ variable, setuptools version automation, package version from source file, build-tool, deprecated, setuptools-plugin [View on SkillFed](https://skillfed.io/packages/read-version) · [View on PyPI](https://pypi.org/project/read-version/)