skillfed

read-version

Extract your project's __version__ variable

read-version v0.3.2 185.0K downloads/30d#10,019 on PyPI7
Permissive license MIT Abandoned released

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 on this page — 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

read-version on PyPI

pip

pip install read-version

uv

uv add read-version

poetry

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 the current Python release (~=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — setuptools
Maintenance abandoned — 1,846 days since the last release
Last repo commit (repository archived)
First released
Downloads 185,030/month — #10,019 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: read_version-0.3.2-py3-none-any.whl

Keywords: packaging, setuptools, version

Development Status :: 7 - InactiveFramework :: Setuptools PluginIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Software Distribution

Tags

extract version from python sourcesetup.py version parsingread __version__ variablesetuptools version automationpackage version from source file
build-tooldeprecatedsetuptools-plugin

More Python Modules packages