{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/12"}],"enrichment":{"capability":"Extracts your package version from pyproject.toml or other config files and makes it available in Python code, eliminating the need to duplicate version strings.","skillfed_tags":["version-management","pyproject-toml","build-tooling"],"use_cases":["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."],"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\u2014typically 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.\n\nThe 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.","worth_installing":"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."},"id":"single-source","links":{"html":"https://skillfed.io/packages/single-source","md":"https://skillfed.io/packages/single-source.md","pypi":"https://pypi.org/project/single-source/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2024-06-11","license_spdx":null,"license_treatment":"permissive","name":"single-source","python_support":"supports_current","summary":"Access to the project version in Python code for PEP 621-style projects"},"popularity":{"monthly_downloads":401720,"position":6924,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.4.0"}
