repomatic.deps.requirements module¶
The requirement arrays of a pyproject.toml, and the package names in them.
Shared by the three modules that read what a project declares: the version
policy (repomatic.deps.policy), the shippability gate
(repomatic.deps.shippable) and the git-to-release swap
(repomatic.deps.sources). Each array is located by its TOML path, the one
spelling every report uses.
- repomatic.deps.requirements.LOWER_BOUND_OPERATORS = frozenset({'>', '>='})¶
PEP 440 operators that put a floor under a requirement.
The one spelling of “lower bound” every check tests specifiers against. A site that also treats an exact pin as a bound unions
PIN_OPERATORin explicitly, so the difference stays a decision rather than an accident.
- repomatic.deps.requirements.PIN_OPERATOR = frozenset({'=='})¶
The PEP 440 operator pinning a requirement to one version.
A pin demands its version the way a floor demands its minimum, so the checks asking “can PyPI serve what this declaration requires” test both; the checks looking for the managed git-branch floor idiom deliberately do not.
- repomatic.deps.requirements.PUBLISHED_TABLES = ('project', 'project.optional-dependencies')¶
Tables whose requirement arrays land in the published
Requires-Dist.[dependency-groups](PEP 735) is deliberately absent: it never reaches distribution metadata. Neither does[build-system].requires, which only the build front end reads.
- repomatic.deps.requirements.BUILD_TABLE = 'build-system'¶
The table whose
requiresarray lists the build dependencies.
- repomatic.deps.requirements.TOML_TABLE_HEADER = re.compile('\\s*\\[{1,2}\\s*(?P<path>[^]]+?)\\s*\\]{1,2}\\s*$')¶
A
[table]or[[array of tables]]header, capturing its dotted path.
- class repomatic.deps.requirements.RequirementArray(table, key, items)[source]¶
Bases:
objectOne requirement array of a
pyproject.toml.- table: str¶
The dotted path of the table holding the array (
project,project.optional-dependencies,dependency-groups,build-system).
- property published: bool¶
Whether the array reaches the published
Requires-Dist.What separates a finding an installer trips over from one only a contributor does: see
PUBLISHED_TABLES.
- repomatic.deps.requirements.read_project(pyproject_path)[source]¶
Parse pyproject_path read-only, through the shared TOML cache.
- repomatic.deps.requirements.requirement_arrays(doc)[source]¶
Yield every requirement array of a parsed
pyproject.toml.Covers
[project] dependencies, each[project.optional-dependencies]extra, each[dependency-groups]group, and[build-system] requires. Values that are not lists are skipped.- Parameters:
- Return type:
- repomatic.deps.requirements.parse_requirement(item)[source]¶
Parse a requirement array item, returning
Nonefor anything else.- Parameters:
item (
object) – One entry of a requirement array.- Return type:
- Returns:
The parsed requirement, or
Nonefor a non-string entry or an unparsable specifier.
- repomatic.deps.requirements.dev_floor(doc, name)[source]¶
The highest
.devlower bound declared for name, if any.Scans every requirement array for lower-bound clauses (
>=or>) whose version is a dev release. The highest one is the project’s declared “awaited release” threshold.
- repomatic.deps.requirements.iter_toml_lines(text)[source]¶
Yield each line of a TOML text, with its number and the table it sits in.
Enough TOML parsing to place a line: the parsed document holds values and comments, but no line numbers, and a reader needs one to find a declaration. A header line already belongs to the table it opens.