API Reference¶
This page is auto-generated from Python docstrings.
pup_clean ¶
pup-clean package.
__main__ ¶
Run as a module.
base ¶
cli ¶
Command-line interface.
This module parses arguments and dispatches repository cleanup behavior.
Commands: uv run pup-clean uv run pup-clean --delete
Equivalent uvx usage after release: uvx pup-clean uvx pup-clean@latest uvx pup-clean --delete
build_parser ¶
Build the argument parser.
Source code in src/pup_clean/cli.py
main ¶
Run the command-line interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
Sequence[str] | None
|
Optional command-line arguments. If None, uses sys.argv. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Exit code from the clean command. |
Source code in src/pup_clean/cli.py
commands ¶
Command modules.
Each command module exposes a stable run(...) -> int entry point.
The CLI parser lives in pup_clean.cli. Behavior lives here.
clean ¶
Clean known disposable and source-generated repository artifacts.
run ¶
Preview or remove known disposable and generated repository artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
Repository root. If None, detect the current repository root. |
None
|
delete
|
bool
|
Whether to delete detected cleanup targets. False means dry-run only. |
False
|
paths
|
tuple[Path, ...]
|
Optional repository-relative cleanup targets. When provided, operate only on detected targets matching these paths. |
()
|
Returns:
| Type | Description |
|---|---|
int
|
Process exit code. |
Source code in src/pup_clean/commands/clean.py
delete ¶
Write package.
terminal ¶
Terminal reporting.
print_cleanup_plan ¶
print_cleanup_plan(
context: RepositoryContext,
targets: Sequence[CleanupTarget],
*,
delete: bool,
) -> None
Print the repository cleanup plan.
Source code in src/pup_clean/delete/terminal.py
inspect ¶
Inspect package.
generated ¶
Discover generated artifacts by inspecting Python source code.
This module statically inspects Python source files under src/ and finds
paths passed to known data-writing, database-creation, and image-writing
operations.
The purpose is to identify artifacts created by running a project so that pup-clean can remove instructor-generated outputs before a repository is published.
Only statically resolvable generated file paths are returned. Containing directories are not cleanup targets.
discover_generated_paths ¶
Discover generated data artifacts referenced by project source code.
Python files under src/ are parsed using the AST. Known data-writing
operations are inspected and statically resolvable output paths are
returned.
A path is returned only when it can be resolved from source code with sufficient confidence. Dynamic or ambiguous paths are ignored.
Image files are explicitly excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Repository root. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Path, ...]
|
Repository-relative paths for discovered generated artifacts. |