API Reference¶
This page is auto-generated from Python docstrings.
pup_core ¶
Inspect package.
base ¶
Base package.
errors ¶
Shared exception types.
GitInspectionError ¶
Bases: PupCoreError
Raised when required Git repository information cannot be inspected.
PupCoreError ¶
PyprojectError ¶
Bases: PupCoreError
Raised when pyproject.toml cannot be read or interpreted.
RepositoryDetectionError ¶
Bases: PupCoreError
Raised when the target repository cannot be determined.
SectionError ¶
Bases: PupCoreError
Raised when a managed file section is malformed or ambiguous.
UnsafePathError ¶
Bases: PupCoreError
Raised when a path would escape the target repository.
Source code in src/pup_core/base/errors.py
types ¶
Shared typed records.
GitInfo
dataclass
¶
Detected Git repository information.
Source code in src/pup_core/base/types.py
ManagedSection
dataclass
¶
A uniquely identified managed section in file text.
Source code in src/pup_core/base/types.py
PackageInfo
dataclass
¶
PyprojectInfo
dataclass
¶
Selected facts read from pyproject.toml.
Source code in src/pup_core/base/types.py
RepositoryContext
dataclass
¶
Detected information about a target repository.
Source code in src/pup_core/base/types.py
SectionPlan
dataclass
¶
Planned operation for one explicitly managed section.
Source code in src/pup_core/base/types.py
compare ¶
Shared read-only comparison primitives.
files ¶
Read-only file and history comparison primitives.
FileComparison
dataclass
¶
Facts about two corresponding files.
Source code in src/pup_core/compare/files.py
classify_file_relationship ¶
classify_file_relationship(
*,
left_exists: bool,
right_exists: bool,
left_text: str | None,
right_text: str | None,
left_changed: datetime | None = None,
right_changed: datetime | None = None,
) -> FileRelationship
Classify corresponding files using presence, content, and history.
Source code in src/pup_core/compare/files.py
compare_text_files ¶
compare_text_files(
*,
left_path: Path,
right_path: Path,
left_changed: datetime | None = None,
right_changed: datetime | None = None,
) -> FileComparison
Compare two UTF-8 text files without modifying either file.
Source code in src/pup_core/compare/files.py
data ¶
Packaged pup-core data.
inspect ¶
Inspect package.
actions ¶
GitHub Actions workflow inspection.
ActionReference
dataclass
¶
WorkflowInfo
dataclass
¶
inspect_workflow ¶
Inspect one GitHub Actions workflow without modifying it.
Source code in src/pup_core/inspect/actions.py
list_workflow_files ¶
Return GitHub Actions workflow files in a repository.
Source code in src/pup_core/inspect/actions.py
catalog ¶
Load the human-readable repository-inspection capability catalog.
load_repository_feature_catalog ¶
Return the packaged repository-feature catalog.
Source code in src/pup_core/inspect/catalog.py
detect ¶
Repository detection.
detect_repository ¶
Detect objective facts about a repository.
Source code in src/pup_core/inspect/detect.py
resolve_repository_root ¶
Resolve the target repository root.
Source code in src/pup_core/inspect/detect.py
snapshot_repository_files ¶
Return repository-relative file and directory markers.
Source code in src/pup_core/inspect/detect.py
files ¶
Repository file inspection.
find_files_by_suffix ¶
Return repository-relative files matching a suffix.
is_python_source_path ¶
list_repository_files ¶
list_repository_files(
root: Path,
*,
ignored_directories: frozenset[
str
] = _DEFAULT_IGNORED_DIRECTORIES,
) -> tuple[Path, ...]
Return authored repository files beneath a root.
Source code in src/pup_core/inspect/files.py
git ¶
Git repository inspection.
inspect_git ¶
Inspect Git facts without modifying the repository.
Source code in src/pup_core/inspect/git.py
git_history ¶
Read-only Git and GitHub file-history inspection.
local_last_changed ¶
Return when a repository path was last changed in committed Git history.
Source code in src/pup_core/inspect/git_history.py
remote_last_changed ¶
Return when a file was last changed in a GitHub repository.
Source code in src/pup_core/inspect/git_history.py
packages ¶
Python package inspection.
detect_packages ¶
Detect importable packages in a repository.
Source code in src/pup_core/inspect/packages.py
detect_primary_package ¶
module_exists ¶
Return whether a dotted Python module exists in the repository.
Source code in src/pup_core/inspect/packages.py
pyproject ¶
pyproject.toml inspection.
inspect_pyproject ¶
Return selected project and tooling facts from pyproject.toml.
Source code in src/pup_core/inspect/pyproject.py
load_pyproject ¶
Load pyproject.toml without modifying it.
Source code in src/pup_core/inspect/pyproject.py
python_source ¶
Python source-file inspection.
extract_module_docstring ¶
Return a Python module docstring from source text.
is_python_source_file ¶
list_python_source_files ¶
Return Python source files for a detected repository.
Source code in src/pup_core/inspect/python_source.py
read_module_docstring ¶
Return a Python module docstring from a source file.
Source code in src/pup_core/inspect/python_source.py
paths ¶
Paths package.
normalize ¶
Repository path normalization.
normalize_repo_path ¶
Return a repository path using normalized POSIX separators.
Source code in src/pup_core/paths/normalize.py
safe ¶
Safe repository-relative path handling.
safe_repo_path ¶
Resolve a repository-relative path without allowing escape.
Source code in src/pup_core/paths/safe.py
python ¶
Python package.
names ¶
versions ¶
Python version normalization.
minimum_python_version ¶
normalize_python_version ¶
Normalize a Python version to major.minor form.
python_version_to_ruff_target ¶
Convert a Python major.minor version to Ruff target form.
Source code in src/pup_core/python/versions.py
ruff_target_to_python_version ¶
Convert a Ruff target version to Python major.minor form.
Source code in src/pup_core/python/versions.py
sections ¶
Sections package.
apply ¶
Managed section application.
apply_section_plan ¶
Apply one previously planned managed-section operation.
Source code in src/pup_core/sections/apply.py
detect ¶
Managed section detection.
find_managed_section ¶
find_managed_section(
text: str,
*,
name: str,
start_marker: str,
end_marker: str,
) -> ManagedSection | None
Find one explicitly bounded managed section.
Source code in src/pup_core/sections/detect.py
plan ¶
Managed section planning.
plan_section_change ¶
plan_section_change(
text: str,
*,
name: str,
start_marker: str,
end_marker: str,
desired_content: str | None,
insert_before_marker: str | None = None,
) -> SectionPlan
Plan an add, replace, delete, or unchanged section operation.
Source code in src/pup_core/sections/plan.py
templates ¶
Shared canonical-template primitives.
baseline ¶
Template-layer discovery and effective-file selection.
infer_layers ¶
Infer additive template layers from repository structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_root
|
Path
|
Repository root. |
required |
repo_name
|
str
|
Repository name. |
required |
files
|
set[str]
|
Repository-relative file markers. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Ordered additive template layers. |
Source code in src/pup_core/templates/baseline.py
list_template_files ¶
list_template_files(
*,
snapshot: TemplateSnapshot,
layers: tuple[str, ...] | list[str],
) -> list[TemplateFile]
Return effective template files for selected additive layers.
Later layers override earlier layers for the same target path.
Source code in src/pup_core/templates/baseline.py
fetch ¶
Fetch canonical template snapshots without modifying target repositories.
fetch_template_snapshot ¶
Resolve a template source to one local immutable snapshot.
Source code in src/pup_core/templates/fetch.py
resolve_ref_to_commit ¶
Resolve a GitHub branch or tag to an immutable commit SHA.
Source code in src/pup_core/templates/fetch.py
render ¶
Render canonical template content for a target repository.
read_rendered_template ¶
read_rendered_template(
*,
snapshot: TemplateSnapshot,
template_file: TemplateFile,
repository: RepositoryContext,
) -> str
Read and render one canonical template file.
Source code in src/pup_core/templates/render.py
render_template ¶
Render repository-specific values into template text.
Source code in src/pup_core/templates/render.py
types ¶
zensical ¶
Zensical-specific template helpers.
merge_zensical_project_navigation ¶
merge_zensical_project_navigation(
*,
template_data: Mapping[str, Any],
repository_data: Mapping[str, Any],
) -> dict[str, Any]
Preserve repository-specific navigation in a canonical Zensical baseline.
The canonical template governs shared configuration. Repository-specific navigation remains local when present.