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.1

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.1
File Size Uploaded
compforge_repocli-0.2.1.tar.gz 65.5 kB Details

Built distribution (wheel)

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

Total release size: 105.8 kB

Release files / compforge_repocli-0.2.1.tar.gz

Download URL compforge_repocli-0.2.1.tar.gz
Size 65.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ef2cf2904ea29377d94b7de466b333f7678f62f127ad0e70c21de38e42ec3a9a
BLAKE2b-256 checksum
How to use checksums
46760581d2830bea2d66ed2c4e10a5a15a3d08601e884030794a7ea40a25f6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

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

Download URL compforge_repocli-0.2.1-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c9597967680e8c9199dfa1f0eaab86e5744e6c7ad3c90436230abb96cb35ced
BLAKE2b-256 checksum
How to use checksums
e7e0ff95f79b8b33ef123ab3d35197e43764647a0aea15e93aee2c8251990e55
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

This release

0.2.1 This release

2 release files

0.2.0

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