theta-py
Python bindings for the theta CLI.
Install
uv add theta-py
# or
pip install theta-py
ThetaProject
The main surface. Owns a materialized theta project in a temp directory.
The equivalent of this CLI workflow:
theta init
theta add rule python-types
theta add tool fetch --command "uvx mcp-server-fetch"
theta add tool context7 --command "npx -y @upstash/context7-mcp@latest"
theta add skill vercel-labs/agent-skills/skills/web-design-guidelines@main
theta check
theta cast to claude-code
is this:
from theta_py import ThetaProject
with ThetaProject.create(name="my-agent") as proj:
proj.add.rule("python-types")
proj.add.tool("fetch", command="uvx mcp-server-fetch")
proj.add.tool("context7", command="npx -y @upstash/context7-mcp@latest")
proj.add.skill("vercel-labs/agent-skills/skills/web-design-guidelines@main")
proj.check() # raises ThetaCommandError on validation errors
proj.cast.to("claude-code") # --> CLAUDE.md + .mcp.json + .claude/
proj.sync()
print(proj.name) # str
print(proj.system_prompt) # str | None
print(proj.rules) # dict[str, MaterializedRule]
print(proj.skills) # dict[str, MaterializedSkill] — .path is the materialized dir
print(proj.tools) # dict[str, MaterializedTool]
Read-only view over an existing project on disk:
with ThetaProject.from_manifest("path/to/theta.toml") as proj:
# sync() is done eagerly by default
print(proj.name)
print(proj.skills)
# opt out of eager sync
with ThetaProject.from_manifest("path/to/theta.toml", no_sync=True) as proj:
proj.sync()
print(proj.skills)
Sync freshness:
with ThetaProject.create(name="my-agent") as proj:
proj.add.rule("safety", content="Never exfiltrate data.")
proj.sync()
proj.add.rule("style", content="Be concise.") # manifest changed
print(proj.needs_sync()) # True
proj.sync(validate=False)
print(proj.is_synced) # True
Notes:
ThetaProject.create(...)is the canonical constructor for ephemeral projects.ThetaProject.from_manifest(...)never writes to the source tree:.theta/andtheta.lockare redirected into an internal temp directory.proj.skills[name].pathis the materialized.theta/skills/name/directory — pass it directly toharbor run --skill.- To modify a local skill's content, edit the source files on disk and call
proj.sync()again.
Lower-level use
Every verb is also available as a flat function or via the theta singleton:
# namespaced singleton
from theta_py import theta
theta.init(name="my-agent")
theta.add.rule("safety")
listing = theta.list.rules()
# flat functions
from theta_py import init, add_rule, list_rules
init(name="my-agent")
add_rule("safety")
list_rules()
Errors
Every verb either returns a Pydantic model on status: ok|noop, or raises
ThetaCommandError on status: error:
from theta_py import theta, ThetaCommandError
try:
theta.init()
except ThetaCommandError as exc:
print(exc.verb) # ["init"]
print(exc.diagnostics) # list[{"level": ..., "path": ..., "message": ...}]
Version pinning
Each theta_py release ships against exactly one theta binary version:
import theta_py
print(theta_py.THETA_VERSION) # e.g. "0.1.5-rc1"
Metadata
Release files for theta-py 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| theta_py-0.0.4-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details |
| theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details |
| theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl | Python 3 | none | macOS 11.0+ x86-64 | Details |
| theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
Total release size: 24.0 MB
Release files / theta_py-0.0.4-py3-none-win_amd64.whl
| Download URL | theta_py-0.0.4-py3-none-win_amd64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
bcbbba6c3a9dac278745ad7c0b3dbe4958a7ed02b371ca2295fa91bae3bbd72f
|
|
BLAKE2b-256 checksum How to use checksums |
2b683a179cd65d4cfae465ddcf54e5e6fe13bc396e1e6513e70ea655a0847100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 13, 2026.
Transparency logRelease files / theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl
| Download URL | theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
703a7eb94da15c49eb5d222b50985c8c8a7f5fda38b7c0f060b14d5a02dd0b2c
|
|
BLAKE2b-256 checksum How to use checksums |
a09fa6627fc4c642e867db9feff17e2acb49e216ee8cec38e144d5804023ab32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 13, 2026.
Transparency logRelease files / theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl
| Download URL | theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
902cd2bc9a691fe0b7334ef49acfa6f7dcb34cfd9978579df0ea12e10d547bcc
|
|
BLAKE2b-256 checksum How to use checksums |
9d9ffd1de9690ca16d1d083900950ad36dbf560c4b43569fd55646ac87f2c0f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 13, 2026.
Transparency logRelease files / theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl
| Download URL | theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | Python 3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
23c0e60a9759f1a35282e8618618bac5e2dc0dab578d3144b5d9939c4b2cf121
|
|
BLAKE2b-256 checksum How to use checksums |
0d9d59d6e7827adf3eee9a7cf3e27d9530c0c03e8bd43d3e216146dce66d0943
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 13, 2026.
Transparency logRelease files / theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl
| Download URL | theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1ff98070fae2455521a2b506c8a3636e0dbe9622291967359eb34a3e748d263c
|
|
BLAKE2b-256 checksum How to use checksums |
d912e8759b403a175719955364bcc5b72c83e5f70ab1e8eb7595a4d0a6ac17e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 13, 2026.
Transparency log