Skip to main content

treepos

treepos manages a GitHub organization declaratively, as a tree. Each object holds the ones below it: an organization holds repos, and a repo's config can declare more repos and teams. Any branch of the tree can be handed to the team that owns it, who can hand part of theirs on in turn. A runner repo reads the tree from files in GitHub and makes GitHub match it.

Status: pre-alpha. This repository is the treepos command-line tool. So far it plans an org's teams, members and team members, its repos, and the custom properties that mark them, against live GitHub or a live-state file, and applies a plan to either. Its files are read from the runner file's folder, and refs into other repos from GitHub, once a run signs in to it, a pinned commit only where it's on a branch of its repo. Who can read and write what those refs bring in isn't checked yet.

Warning: config is the whole org. A plan archives every repo the tree doesn't declare and marks it removed, never deleting it. The one repo it spares is the runner repo, and only when --runner-repo-id gives its ID, as the action always does. Try it on a live-state file or a test org before a real one.

Install

uv tool install treepos  # or: pipx install treepos

It needs Python 3.14 or later, which uv fetches if it's missing.

Try it

From a runner repo, whose runner file, .treepos/runner.yaml by convention, declares the tree's ID, tree, and holds the org or refs its file:

treepos plan --runner .treepos/runner.yaml --live-state github.yaml
treepos apply --runner .treepos/runner.yaml --live-state github.yaml
treepos plan --runner .treepos/runner.yaml --live-state github.yaml --out -  # nothing left

github.yaml is the state of an in-memory GitHub, in the form live_state.py reads. plan writes the plan to treepos-plan.json, and apply applies it to the same file, rewriting it to the state it leaves; any comments in it are lost. Results go to --out, and findings to stderr. Without --runner-repo-id, a warning says no repo is spared. The marks name the tree by its declared tree.

To plan against live GitHub instead, leave out --live-state: the run signs in with the runner object's credential, a credential/fine_grained_pat or a credential/app_installation, whose keys it reads from the secrets they name: in Actions from TREEPOS_SECRETS, the job's secrets as JSON, and otherwise from environment variables of those names. Or name where a raw token that can read the org is, never the token itself: --credential env:GITHUB_TOKEN, file:<path>, stdin or gh, for gh auth token. A plan read with a raw token is a preview, so it's never applied.

To apply to live GitHub, leave out --live-state there too: apply signs in with the runner object's credential, never a raw token. It applies only a plan that isn't a preview: one planned with the runner's credential. The runner file and the files beside it are read from disk.

To run it as a runner, in a runner repo's GitHub Actions: docs/actions.md.

Why

GitHub can't limit a permission to a name prefix, and creating a repo needs a permission that reaches every repo in the org. treepos makes delegation real: a parent wraps the part it hands over in a policy that says what may be written below and what values must satisfy. treepos checks every write against every policy above it before anything changes.

Contributing

CONTRIBUTING.md has the setup, the rules and the checks.

License

Apache-2.0.

Metadata

Release files for treepos 0.0.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 treepos 0.0.1
File Size Uploaded Provenance Actions
treepos-0.0.1.tar.gz 152.5 kB With provenance Details for treepos-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for treepos 0.0.1
File Interpreter ABI Platform Actions
treepos-0.0.1-py3-none-any.whl Python 3 none any Details for treepos-0.0.1-py3-none-any.whl

Total release size: 398.9 kB

Release files / treepos-0.0.1.tar.gz

Download URL treepos-0.0.1.tar.gz
Size 152.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c47cee4cb54c844b67b08a15e5a1ef8b358979f507cb67c55ca5b20f5b10fbf0
BLAKE2b-256 checksum
How to use checksums
1775880ea93932f8a75f4f6a6cfa15cc994125662439e32f9d386e8d554c0f7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / treepos-0.0.1-py3-none-any.whl

Download URL treepos-0.0.1-py3-none-any.whl
Size 246.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7006e74a20f394b0d1148d3d3cabfe2ad51a9dce83327323a64b6cff344c7cdf
BLAKE2b-256 checksum
How to use checksums
e3299e80c2e08f93978aa10ce99c4342a20761287a6a211b345cfa57fe1837ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for treepos 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for treepos-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

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