Skip to main content

secretspec (Python SDK)

Python bindings for SecretSpec, a declarative secrets manager. This package is a thin client over a pyo3 extension that calls secretspec::resolve_json directly: resolution (providers, chains, profiles, generation, as_path) happens in the Rust core, so the SDK inherits every provider with no Python-side logic.

from secretspec import SecretSpec

resolved = (
    SecretSpec.builder()
    .with_provider("keyring://")
    .with_profile("production")
    .with_reason("boot web app")
    .load()
)

print(resolved.provider, resolved.profile)
db = resolved.secrets["DATABASE_URL"]
print(db.get)              # the value, or the file path for as_path secrets
resolved.set_as_env()      # export everything into os.environ

A missing required secret raises MissingRequiredError; any other failure raises SecretSpecError (with a stable .kind).

Scopes (0.17+)

Use .with_scope("api") to resolve only a named [scopes.api] subset. Both resolved.scope and report.scope return the selected scope:

resolved = SecretSpec.builder().with_scope("api").load()

Cleanup

as_path secrets are materialized to temp files that outlive the call. Use the result as a context manager (with SecretSpec.builder()...load() as resolved:) or call resolved.close() when done so the secret files do not accumulate.

Value-free report

report() returns the inventory/preflight view: per-secret status and provenance, never a value. Unlike load(), it does not raise when a required secret is missing — it appears as a SecretReport with status "missing_required".

report = SecretSpec.builder().with_profile("production").report()
for s in report.secrets:
    print(s.name, s.status, s.required)

Native library

The Rust resolver is statically linked into a compiled pyo3 extension (secretspec._native, built from the secretspec-py-native crate) inside the installed wheel, so there is nothing to locate at runtime. The prebuilt abi3 wheels are self-contained (pip install secretspec). From a source checkout the extension is built on demand by the test harness via maturin develop, which needs maturin and a Rust toolchain on PATH.

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.

secretspec-0.19.0-cp39-abi3-win_amd64.whl (12.0 MB view details)

Uploaded CPython 3.9+Windows x86-64

secretspec-0.19.0-cp39-abi3-manylinux_2_28_x86_64.whl (16.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

secretspec-0.19.0-cp39-abi3-manylinux_2_28_aarch64.whl (16.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

secretspec-0.19.0-cp39-abi3-macosx_11_0_arm64.whl (13.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file secretspec-0.19.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: secretspec-0.19.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 12.0 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for secretspec-0.19.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2a71d134872c94ef488b64d248556394b4d602aa3137d14cc9610dc27ae03d8e
MD5 b586393d5fe698783f03534ccb7320ac
BLAKE2b-256 7d520e9b7ec25c1dfdbc51feec1df67a0b55baabac5a395375367c5a1431d566

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.19.0-cp39-abi3-win_amd64.whl:

Publisher: python-wheels.yml on cachix/secretspec

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

File details

Details for the file secretspec-0.19.0-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for secretspec-0.19.0-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4b8fd6038f367fd918a602ec0ab378b145ff1b8dee24ce7658001bb3ebbf97ef
MD5 19a3bffd933dad91d6604326415d596b
BLAKE2b-256 f18e5f987d602fd161217d7cb521093dd1af544f35ce48a8e48411c62c5519f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.19.0-cp39-abi3-manylinux_2_28_x86_64.whl:

Publisher: python-wheels.yml on cachix/secretspec

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

File details

Details for the file secretspec-0.19.0-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for secretspec-0.19.0-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ddb8b89fad2f0a6cb351e644b58a24e9fbeaa2a08b349548876e8e209caa5a8e
MD5 17537554172008ff14b9a62cdb89b268
BLAKE2b-256 55befe37f1cd0c0de5067ab6d2b14559187f93eaf70c921367eb3a5bb58c1416

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.19.0-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: python-wheels.yml on cachix/secretspec

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

File details

Details for the file secretspec-0.19.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for secretspec-0.19.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77e364494325b458ba8c9b51014039909e1b63452fc269b375afb0e3ca95e521
MD5 44113bce9601d138ef3ebbede019b686
BLAKE2b-256 e5dcbd375289502ee0100afa48c97215cdce7462121f4cf8ce449984673646e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.19.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: python-wheels.yml on cachix/secretspec

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 Sentry Error logging StatusPage Status page