Skip to main content

repocli for Python

Native organization inspection for Git repositories: discover Components, language and package-tool evidence, then locate the owner of a repository-relative path. Python 3.11+ on macOS/Linux and Git on PATH are required. Organization analysis runs in Python; Git provides version-control facts through batched commands.

Install from the repository checkout:

python -m pip install ./toolkit/python
from repocli import inspect, owner

report = inspect("/path/to/repo", timeout=5)
if not report.complete:
    raise RuntimeError(report.diagnostics)
component = owner(report, "server/main.py")
if component is not None:
    print(component.name, component.root, component.language)

inspect(..., staged=True) selects the index; inspect(..., head="HEAD") selects a resolved commit. The default observes the working tree, including non-ignored untracked paths. timeout is a whole-call budget in seconds; an optional threading.Event passed as cancel requests cancellation. Git processes are terminated and reaped on timeout, cancellation or output overflow. Filesystem reads and Python analysis check the budget between operations. Timeout raises TimeoutError, cancellation raises InterruptedError, invalid selections/configuration or limits raise ValueError, and filesystem/Git failures propagate OSError / subprocess.CalledProcessError.

Reports and their nested collections are immutable dataclasses and tuples. Shared Repository, Component, Product and Forge identities come from harness-common; ComponentBinding adds checkout layout and tool evidence. owner accepts a repository-relative path and returns the deepest binding or None, including for deleted paths. Python properties use snake_case; these objects are not a CLI JSON protocol adapter.

Inspection reads filenames and necessary metadata, not source contents or ASTs. It never runs project code or installs dependencies. complete concerns observed organization; concurrent metadata changes return an incomplete report with diagnostics. Consumers own acceptance, command selection and validation policy. Snapshot, diff and graph analysis remain available through the Go toolkit / CLI.

Development: uv sync --locked, then make fix, make lint, make test, make build. Tests consume the shared conformance/inspect cases and generated filename probes. See the inspection contract.

Repository toolkit

工具包提供仓库组织、内容身份与 Git 查询。Python 还提供 worktree、提交、推送、rebase 和 GitHub/GitLab 的 PR/MR 操作;调用方直接导入库,组织自己的开发流程。 分析接口保持只读,操作接口接收明确参数,不隐式执行验证或管理任务状态。

详见 操作契约。

Metadata

Release files for compforge-repocli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compforge-repocli 0.2.0
File Size Uploaded
compforge_repocli-0.2.0.tar.gz 63.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for compforge-repocli 0.2.0
File Interpreter ABI Platform
compforge_repocli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 102.5 kB

Release files / compforge_repocli-0.2.0.tar.gz

Download URL compforge_repocli-0.2.0.tar.gz
Size 63.6 kB
Tags Source
SHA-256 checksum
How to use checksums
78caf3ec05977617bcf5c7fc143006cf83d4f97b1926b0215b9feff3b824ad6d
BLAKE2b-256 checksum
How to use checksums
18be05b75f1c4e5bc5bf4464bc80f5d2c502b64c8f40d876e74542732f0d83be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / compforge_repocli-0.2.0-py3-none-any.whl

Download URL compforge_repocli-0.2.0-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2df9c13486a92d6ead970b144b50be5f39594ad1af0f37d53f1f74b2765a3974
BLAKE2b-256 checksum
How to use checksums
9ed2ba23a09ceea8eb1651c55e1cab7b26da67c00e8b33bbf89e5417918bc0ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release history Release notifications | RSS feed

0.5.0

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page