Skip to main content

Thorax for Python

Native Python SDK for Thorax, secrets management for humans, agents, and apps.

The SDK is a small application-facing facade over Thorax's shared operation layer. It uses the same vault validation, authorization, keychain, and cryptography as the CLI, TUI, Rust SDK, and Node SDK.

Installation

Thorax requires Python 3.9 or later.

pip install thorax

The SDK opens an existing Thorax vault. Install the Thorax CLI and run thorax init in your project if you do not have one yet.

Quick start

By default, Vault opens .thorax/vault.cord and authenticates with the configured local identity and keychain:

import thorax

vault = thorax.Vault()
database_url = vault.get("app/prod/db")

Pass the directory containing vault.cord when the vault is elsewhere:

vault = thorax.Vault("/srv/my-app/.thorax")

Values are UTF-8 strings by default. Set as_bytes=True when reading a binary value:

certificate = vault.get("app/prod/certificate", as_bytes=True)
vault.set("app/prod/token", b"binary value")

Working with secrets

vault.set("app/prod/db", "postgres://localhost/app")
vault.set_field("app/prod/db", "username", "app")

username = vault.get_field("app/prod/db", "username")
fields = vault.fields("app/prod/db")
selectors = vault.list("app/prod")

vault.delete_field("app/prod/db", "username")
vault.delete("app/prod/db")

Selectors may be strings such as app/prod/db@region=eu, or structured thorax.Selector objects.

Authentication

Local development uses the keychain by default. You can select a particular identity or supply a passphrase to a noninteractive caller:

auth = thorax.Auth.from_keychain("alice", passphrase="...")
vault = thorax.Vault(auth=auth)

For CI and deployed applications, use a dedicated, least-privilege invite identity. Auth.from_env() reads exactly one of THORAX_UNSAFE_INVITE or THORAX_UNSAFE_INVITE_FILE:

vault = thorax.Vault(auth=thorax.Auth.from_env())

An invite is a private capability. Keep it out of source control and prefer the file variable when your runtime can mount it as a secret. Auth.from_invite() also accepts an invite directly.

Errors and session behavior

Operations raise subclasses of thorax.ThoraxError: NotFound, PermissionDenied, ConflictError, ValidationError, and IdentityError.

A session validates the vault when it opens and sees its own writes immediately. Create a new Vault to pick up changes written by another process. Opening fails while the vault has unresolved conflicts.

See the Thorax documentation for vault setup, selectors, access control, and the security model.

Thorax is licensed under the Apache License 2.0.

Metadata

Release files for thorax 1.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for thorax 1.1.0
File
thorax-1.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
thorax-1.1.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
thorax-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
thorax-1.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
thorax-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 6.5 MB

Release files / thorax-1.1.0-cp39-abi3-win_amd64.whl

Download URL thorax-1.1.0-cp39-abi3-win_amd64.whl
Size 1.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b2f94d4325bcbd25d4806c5f66d536395ca6e592fa756b8805fb3911af6f60fc
BLAKE2b-256 checksum
How to use checksums
045f076cc852d1920df7f39d81e14932d22ca732b07816e62564f9a3d4ad5262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / thorax-1.1.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL thorax-1.1.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
30abbdb4347f313cc83795b271d5158acd830b047bb9b45be5762167f2a268c3
BLAKE2b-256 checksum
How to use checksums
e61c9298129e9b9fdc7f53280fd3c32db9174b24d3cf48c3109afffc3054ebed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / thorax-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL thorax-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b631b902cfc00829cff27a368af6ff6b4ba29313d6d036ac5719d14eda29bc6d
BLAKE2b-256 checksum
How to use checksums
e34e233461e03542c775acde0d282b9c7aac7862d23f18c96f4c4ac13328b448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / thorax-1.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL thorax-1.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
eed0cff31914c55fdf414d36b53da55a2bfb766550ab548e573541e9a78f4072
BLAKE2b-256 checksum
How to use checksums
1018c17dee7de7d8c99ec7ac203519f8b33b33e0aaca5149acfe6753eddb2d50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / thorax-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL thorax-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6fbd2951d21f44af84fb5be5f371a772aebaaa3008ac3da55ac85a31a0b6cbfe
BLAKE2b-256 checksum
How to use checksums
69f8755a9a0c5156754affc0ce770e2f327b1c5efa9bac6b2a672a5e47a57bbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.1.0 This release

5 release files

1.0.1

5 release files

1.0.0

5 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