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.17.1-cp39-abi3-win_amd64.whl (10.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

secretspec-0.17.1-cp39-abi3-manylinux_2_28_x86_64.whl (14.9 MB view details)

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

secretspec-0.17.1-cp39-abi3-manylinux_2_28_aarch64.whl (14.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

secretspec-0.17.1-cp39-abi3-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: secretspec-0.17.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.1 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.17.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4a7f371de3585d5d0aa4fc577411ee0eea15f6f9150e2c0179ee8307168fbebb
MD5 9ad9b1051050edf1dde47edc85762cea
BLAKE2b-256 80775fdce9a12574d34c495ca837e5cf7ab8ba2d9c31a0f8d5c99d9d5e91fedd

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.17.1-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.17.1-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for secretspec-0.17.1-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cb2e30cbdbb81902acde57ae1298d5fa1c7937ec6ec7ea92129b3785eecc4481
MD5 b2e432e6f1cf6d84ca7f611346e06ba1
BLAKE2b-256 aa198c7b07ec6ad220318c9d0da66bd0b45d8bdc915b256c33418e098ba980f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.17.1-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.17.1-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for secretspec-0.17.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0eadb2403aaaf82ead436af405a2f4381ddb4eb1fd2f88ee0c26d0557415a91f
MD5 5c3598f491c5a9b413e8837dc8a070f4
BLAKE2b-256 661f88517845d9eee9e291a069dbea57b1e537e4297ff7feacf14f97e3e4de83

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.17.1-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.17.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for secretspec-0.17.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4de327bba02300bd37d247a657fad5c43def44c21e688bf685e9c557dbe2e214
MD5 32d2a890f4895f488e8dec447dff79c4
BLAKE2b-256 8735d4c6ef02955c2bde74f383805e80c9336a0dbb01708539a5bfd13f571ed2

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretspec-0.17.1-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