repomatic.pyproject module¶
Utilities for reading and interpreting pyproject.toml metadata.
Provides standalone functions for extracting project name and source paths
from pyproject.toml. These functions have no dependency on the
Metadata singleton and can be used independently.
- repomatic.pyproject.read_pyproject_toml(project_root=None)[source]¶
Parse
pyproject.tomlfrom project_root.Parses are cached per file identity (absolute path, mtime, size), since a single CLI invocation reads the same document many times over: treat the result as read-only.
- repomatic.pyproject.derive_source_paths(pyproject_data=None)[source]¶
Derive source code directory name from
[project.name].Converts the project name to its importable form by replacing hyphens with underscores, the universal Python convention that all build backends (setuptools, hatchling, flit, uv) follow by default. For example,
name = "extra-platforms"yields["extra_platforms"].
- repomatic.pyproject.resolve_source_paths(config, pyproject_data=None)[source]¶
Resolve workflow source paths from config or auto-derivation.
- Parameters:
- Return type:
- Returns:
List of source directory names, or
Nonewhen no source paths can be determined (paths should be stripped entirely).
- repomatic.pyproject.get_project_name(pyproject_data=None)[source]¶
Read the project name from
pyproject.toml.
- repomatic.pyproject.is_python_project(project_root=None, pyproject_data=None)[source]¶
Detect whether project_root hosts a Python project.
Returns
Truewhen thepyproject.tomlparses cleanly throughpyproject_metadata.StandardMetadata.from_pyproject: it must declare a PEP 621[project]table that respects the standard. Apyproject.tomlthat only carries third-party[tool.*]sections does not qualify, so repositories that merely lean on the file for tool configuration (linters, formatters,[tool.repomatic]itself) are correctly classified as non-Python.- Parameters:
- Return type:
- Returns:
Truewhen the[project]table satisfies PEP 621.
- repomatic.pyproject.is_python_package(project_root=None, pyproject_data=None)[source]¶
Detect whether project_root builds a distributable Python package.
Strictly narrower than
is_python_project(): every package is a Python project, but not every Python project is a package. A uv virtual project declares a PEP 621[project]table purely to carry dependencies, and opts out of being built or installed with[tool.uv] package = false. Blogs, docs sites and dotfiles repos that lean on uv for dependency management all look like this.The distinction matters because the two traits gate different things. A virtual project still has dependencies to lock, a
uv.lockto sync and tests to cover, so it wants everything scoped toPYTHON_ONLY. It has nothing to publish, tag or write release notes for, so it wants nothing scoped toPACKAGE_ONLY.Note
Only uv’s opt-out is recognized. Poetry’s
[tool.poetry] package-modeequivalent is deliberately ignored: repomatic dropped Poetry support in4.0.0and expects standardpyproject.tomlconventions.- Parameters:
- Return type:
- Returns:
Truefor a PEP 621 project that is not a uv virtual project.