Skip to main content

Python bindings for the theta CLI

Project description

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/ and theta.lock are redirected into an internal temp directory.
  • proj.skills[name].path is the materialized .theta/skills/name/ directory — pass it directly to harbor 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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

theta_py-0.0.4-py3-none-win_amd64.whl (4.4 MB view details)

Uploaded Python 3Windows x86-64

theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl (4.9 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl (4.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file theta_py-0.0.4-py3-none-win_amd64.whl.

File metadata

  • Download URL: theta_py-0.0.4-py3-none-win_amd64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for theta_py-0.0.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bcbbba6c3a9dac278745ad7c0b3dbe4958a7ed02b371ca2295fa91bae3bbd72f
MD5 349ae4482fdc981bb24087093820f0dc
BLAKE2b-256 2b683a179cd65d4cfae465ddcf54e5e6fe13bc396e1e6513e70ea655a0847100

See more details on using hashes here.

Provenance

The following attestation bundles were made for theta_py-0.0.4-py3-none-win_amd64.whl:

Publisher: release.yml on tamarillo-ai/theta_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 703a7eb94da15c49eb5d222b50985c8c8a7f5fda38b7c0f060b14d5a02dd0b2c
MD5 816973b91f3fc352f9be985df6234f23
BLAKE2b-256 a09fa6627fc4c642e867db9feff17e2acb49e216ee8cec38e144d5804023ab32

See more details on using hashes here.

Provenance

The following attestation bundles were made for theta_py-0.0.4-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on tamarillo-ai/theta_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 902cd2bc9a691fe0b7334ef49acfa6f7dcb34cfd9978579df0ea12e10d547bcc
MD5 ea0d9a6942534e10666fb9c9c49f862d
BLAKE2b-256 9d9ffd1de9690ca16d1d083900950ad36dbf560c4b43569fd55646ac87f2c0f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for theta_py-0.0.4-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tamarillo-ai/theta_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 23c0e60a9759f1a35282e8618618bac5e2dc0dab578d3144b5d9939c4b2cf121
MD5 3d5f7c71640ee9fa38960e6ca817b10a
BLAKE2b-256 0d9d59d6e7827adf3eee9a7cf3e27d9530c0c03e8bd43d3e216146dce66d0943

See more details on using hashes here.

Provenance

The following attestation bundles were made for theta_py-0.0.4-py3-none-macosx_11_0_x86_64.whl:

Publisher: release.yml on tamarillo-ai/theta_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ff98070fae2455521a2b506c8a3636e0dbe9622291967359eb34a3e748d263c
MD5 c037f41b6ee58a13664454673a5405ee
BLAKE2b-256 d912e8759b403a175719955364bcc5b72c83e5f70ab1e8eb7595a4d0a6ac17e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for theta_py-0.0.4-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on tamarillo-ai/theta_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page