livery.workshop._influence¶
livery.workshop._influence ¶
Which files a step or CI job reads, and which of them a change touched.
A step or CI job declares its inputs on its record
(livery.workshop._steps.StepRecord inputs, or
livery.workshop._points.Job inputs): every entry of reads or
widens names one set of files through category, channel, or
one of the base's four named sets (NAMED_SETS), optionally narrowed by
suffixes and, on a category read, ignore rule codes.
Two widenings hold for every workspace step. A run that knows nothing of what changed (the whole gate) judges everything. A step whose own code changed judges everything, since its rule moved, not the files: the member package that ships it changed under its sources, or, for a step installed from an index, the lock moved.
Classes:
| Name | Description |
|---|---|
Changes |
What changed since the tree a gate measures from. |
InputEntry |
One set of files a step or CI job reads or widens on. |
Inputs |
The files a step or CI job reads and widens on, named by sets. |
Selection |
What one step judges in a run. |
Functions:
| Name | Description |
|---|---|
sets_of |
The named sets of |
reads |
Whether inputs read path. |
provider_of |
The member package whose sources ship extension, by its path; empty if none. |
select |
What a step with inputs judges for changes. |
Attributes:
| Name | Type | Description |
|---|---|---|
LOCK |
|
|
NAMED_SETS |
|
|
WHOLE |
|
|
SKIP |
|
NAMED_SETS
module-attribute
¶
NAMED_SETS = frozenset({'graph', 'extension-sources', 'declarations', 'tasks'})
Changes
dataclass
¶
What changed since the tree a gate measures from.
Attributes:
| Name | Type | Description |
|---|---|---|
root |
Path
|
The workspace root. |
paths |
tuple[str, ...]
|
The changed paths, root-relative posix, deleted ones included. |
before |
str
|
The commit or tree the paths were taken from; empty when the caller named the paths itself. |
Methods:
| Name | Description |
|---|---|
removed |
The changed paths the working tree no longer holds: deleted or moved. |
text_before |
path where the change is measured from; empty if unknown. |
InputEntry
dataclass
¶
InputEntry(category: str = '', channel: str = '', set: str = '', suffixes: tuple[str, ...] = (), ignore: tuple[str, ...] = ())
One set of files a step or CI job reads or widens on.
Exactly one of category, channel or set is non-empty.
Attributes:
| Name | Type | Description |
|---|---|---|
category |
str
|
A category name ( |
channel |
str
|
A channel name ( |
set |
str
|
One of |
suffixes |
tuple[str, ...]
|
Optional file suffixes (each starting with |
ignore |
tuple[str, ...]
|
Rule codes the step withholds in this category (written into a tool's per-file ignores); valid on category reads only. |
Methods:
| Name | Description |
|---|---|
matches_suffix |
Whether path carries one of suffixes, or suffixes is empty. |
matches_suffix ¶
Whether path carries one of suffixes, or suffixes is empty.
Inputs
dataclass
¶
Inputs(reads: tuple[InputEntry, ...], per_file: bool = True, widens: tuple[InputEntry, ...] = (), on_removal: bool = False, widen: Callable[[Changes], bool] | None = None)
The files a step or CI job reads and widens on, named by sets.
Attributes:
| Name | Type | Description |
|---|---|---|
reads |
tuple[InputEntry, ...]
|
The file sets the step judges. |
per_file |
bool
|
Whether a workspace step judges each changed file it reads on its own; otherwise a change to any of them runs it whole. |
widens |
tuple[InputEntry, ...]
|
File sets the step does not judge whose change runs it over everything it reads. |
on_removal |
bool
|
Whether a deleted or moved file anywhere runs it whole: a link checker's, since a link in an unchanged page may point at what went away. |
widen |
Callable[[Changes], bool] | None
|
The step's own further reason to run whole, given the changes: a link checker's removed heading. |
Selection
dataclass
¶
sets_of ¶
sets_of(root: Path, path: str, *, packages: Sequence[Package] | None = None, package_dirs: frozenset[str] | None = None, providers: Sequence[str] | None = None) -> frozenset[str]
The named sets of NAMED_SETS that contain path inside root.
Source code in packages/workshop/src/livery/workshop/_influence.py
reads ¶
provider_of ¶
The member package whose sources ship extension, by its path; empty if none.
An extension installed from an index has no member: its code moves with the lock instead.
Source code in packages/workshop/src/livery/workshop/_influence.py
select ¶
select(inputs: Inputs, changes: Changes | None, *, provider: str = '', packages: Sequence[Package] | None = None) -> Selection
What a step with inputs judges for changes.
Everything when nothing is known of what changed, when the step's
own code changed (provider, the member that ships it, changed
under src/; for a step with no member, the lock moved), or
when a widening input changed; else the changed files it reads,
each on its own, or everything when it does not judge per file;
nothing when no file it reads changed.