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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thorax-1.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: thorax-1.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2f94d4325bcbd25d4806c5f66d536395ca6e592fa756b8805fb3911af6f60fc
|
|
| MD5 |
a7dc7eb992fb526cbc066055fa29ddff
|
|
| BLAKE2b-256 |
045f076cc852d1920df7f39d81e14932d22ca732b07816e62564f9a3d4ad5262
|
File details
Details for the file thorax-1.1.0-cp39-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: thorax-1.1.0-cp39-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ x86-64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30abbdb4347f313cc83795b271d5158acd830b047bb9b45be5762167f2a268c3
|
|
| MD5 |
974ccdfbaa7a1f8602793453b6c735dc
|
|
| BLAKE2b-256 |
e61c9298129e9b9fdc7f53280fd3c32db9174b24d3cf48c3109afffc3054ebed
|
File details
Details for the file thorax-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: thorax-1.1.0-cp39-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ ARM64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b631b902cfc00829cff27a368af6ff6b4ba29313d6d036ac5719d14eda29bc6d
|
|
| MD5 |
ba94524d251b3c565321bbd4af703c5d
|
|
| BLAKE2b-256 |
e34e233461e03542c775acde0d282b9c7aac7862d23f18c96f4c4ac13328b448
|
File details
Details for the file thorax-1.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: thorax-1.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eed0cff31914c55fdf414d36b53da55a2bfb766550ab548e573541e9a78f4072
|
|
| MD5 |
2e593781a1345962e7e02d94ce829fb1
|
|
| BLAKE2b-256 |
1018c17dee7de7d8c99ec7ac203519f8b33b33e0aaca5149acfe6753eddb2d50
|
File details
Details for the file thorax-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: thorax-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fbd2951d21f44af84fb5be5f371a772aebaaa3008ac3da55ac85a31a0b6cbfe
|
|
| MD5 |
c6d9efaf851bb67e06a00243f24ec656
|
|
| BLAKE2b-256 |
69f8755a9a0c5156754affc0ce770e2f327b1c5efa9bac6b2a672a5e47a57bbc
|