Skip to content

pyaccesskit.maintenance

pyaccesskit.maintenance

Maintenance helpers: cleaning up orphaned Access processes.

OwnedProcess dataclass

OwnedProcess(
    pid: int,
    creation_time: float,
    image: str,
    owner_pid: int,
    owner_creation_time: float,
    database: str | None,
    started_at: float,
    version: str,
)

One ledger entry.

file_name property

file_name: str

Ledger file name (unique per process identity).

ReapResult dataclass

ReapResult(
    entry: OwnedProcess,
    action: Literal[
        "terminated",
        "would-terminate",
        "already-exited",
        "owner-alive",
        "failed",
    ],
)

What :func:reap_orphans did with one ledger entry.

owned_processes

owned_processes() -> list[OwnedProcess]

Access processes currently recorded in PyAccessKit's ownership ledger (from any Python process).

reap_orphans

reap_orphans(*, dry_run: bool = False) -> list[ReapResult]

Terminate Access processes that PyAccessKit started but whose Python owner has died.

Only processes recorded in the ownership ledger are considered, and each one is terminated only if its owner is gone and its PID, creation time and image (MSACCESS.EXE) still match. Access instances started by the user or by other tools are never touched.

Parameters:

Name Type Description Default
dry_run bool

Report what would be terminated without terminating anything.

False