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
inspect ¶
Inspect package.
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
git ¶
Git repository inspection.
inspect_git ¶
Inspect Git facts without modifying the repository.
Source code in src/pup_core/inspect/git.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
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.