single-source
Access to the project version in Python code for PEP 621-style projects
Decision gist · record as of 2026-08-14
Yes, if you are starting a new project or migrating to pyproject.toml and want to avoid version duplication. The package is lightweight, has no dependencies, and solves a real problem. However, maintenance is dormant, so consider whether you are comfortable with a stable-but-not-actively-maintained tool. For established projects already managing version duplication successfully, the benefit may not justify adding a dependency.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; your project must have a pyproject.toml or similar config file containing a version string.
- Low friction installation with no runtime dependencies.
- Maintenance is dormant—last release was in June 2024 and the repository remains active as of January 2025, but no recent development activity.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.
last release 2024-06-11 (794 days) · last repo commit 2025-01-13 · 53 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 401,720 downloads/mo, #6,924 on PyPI
Alternatives
Verify before relying
pip install single-source
# root_package/__init__.py
from pathlib import Path
from single_source import get_version
__version__ = get_version(__name__, Path(__file__).parent.parent)- Whether dormant maintenance status poses a risk for future Python compatibility or bug fixes.
- Real-world success rate of the default regex pattern across diverse project structures and version formats.
- Whether the package will receive updates for Python versions beyond 3.12.
What it is and what it does
single-source solves the version duplication problem in modern Python projects. When you define your package version in pyproject.toml (or setup.py), you often need that same version string accessible in your Python code at runtime—typically in an `__version__` variable. Rather than manually copying the version into your source files and maintaining two copies, single-source reads the version from your config file on import, keeping a single source of truth.
The package exports a `get_version()` function that takes your package name and the path to your project root, then searches for a version string in pyproject.toml or other config files using a built-in regex pattern. You can customize the search with your own regex, set a default fallback value, or raise an exception if the version is not found. It supports Python 3.8 through 3.12 and has no runtime dependencies.
Use it for
- Keep version in pyproject.toml only and read it into `__version__` at runtime without manual duplication.
- Migrate to PEP 621 pyproject.toml while still exposing version in your package code.
- Extract version from custom config files using a regex pattern when the default parser does not match your format.
- Raise an exception at import time if version metadata is missing, catching configuration errors early.
- Support Poetry-managed projects that use version commands without needing to edit Python source files.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are starting a new project or migrating to pyproject.toml and want to avoid version duplication.
The package is lightweight, has no dependencies, and solves a real problem. However, maintenance is dormant, so consider whether you are comfortable with a stable-but-not-actively-maintained tool. For established projects already managing version duplication successfully, the benefit may not justify adding a dependency.
Install
single-source on PyPI
Before you install
Low friction installation with no runtime dependencies. Maintenance is dormant—last release was in June 2024 and the repository remains active as of January 2025, but no recent development activity.
Requires Python 3.8 or later; your project must have a pyproject.toml or similar config file containing a version string.
License in practice
MIT license is permissive; you may use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.
Quickstart
pip install single-source
# root_package/__init__.py
from pathlib import Path
from single_source import get_version
__version__ = get_version(__name__, Path(__file__).parent.parent)
Verify before relying
- Whether dormant maintenance status poses a risk for future Python compatibility or bug fixes.
- Real-world success rate of the default regex pattern across diverse project structures and version formats.
- Whether the package will receive updates for Python versions beyond 3.12.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 794 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 401,720 / month, #6,924 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: single_source-0.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “single source of truth version”
- single-sourceExtracts your package version from pyproject.toml or other config…
- hatch-nodejs-versionProvides Hatch plugins to read and write Python package version and…
- model-indexMaintains a structured index of machine learning model metadata…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also read-version · pyproject-dependencies · pyproject-toml · pyproject-parser · pyproject-api · pyproject2conda · sphinx-pyproject · versions · Flake8-pyproject · etelemetry