Skip to main content

Official Python SDK for Calvery Vault secret manager

Project description

calvery

Official Python SDK untuk Calvery Vault — secret manager untuk tim developer.

Install

pip install calvery

Python 3.8+.

Quick start

import os
from calvery import Calvery

c = Calvery(token=os.environ["CVSM_TOKEN"], team="acme-corp")

# Ambil satu secret
db_url = c.get("DATABASE_URL")

# Ambil semua sebagai dict
secrets = c.get_all()

# Inject ke os.environ
c.inject()
print(os.environ["DATABASE_URL"])  # sudah terisi

API

Calvery(token, team, **opts)

Arg Type Default Keterangan
token str wajib Personal Access Token (cvsm_...)
team str wajib Team slug atau UUID
base_url str https://api.calvery.xyz Override untuk self-host
environment str "production" Default env kalau tidak di-override
cache_ttl float 30.0 Cache TTL (detik). Set 0 untuk disable
max_retries int 3 Retry 5xx + network error
timeout float 10.0 HTTP timeout per attempt

c.get(name, *, environment=None) -> str

val = c.get("STRIPE_KEY")
staging = c.get("STRIPE_KEY", environment="staging")

Raise CalverySecretNotFoundError kalau secret tidak ada.

c.get_all(*, environment=None) -> dict[str, str]

for k, v in c.get_all().items():
    print(k, v)

c.inject(*, environment=None, overwrite=False) -> list[str]

Inject semua secret ke os.environ. Default tidak overwrite env yang sudah ada.

c.clear_cache()

Manual clear cache tanpa nunggu TTL.

Patterns

Django settings.py

from calvery import Calvery

c = Calvery(token=os.environ["CVSM_TOKEN"], team="acme")
c.inject()

DATABASE_URL = os.environ["DATABASE_URL"]
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]

FastAPI startup

from contextlib import asynccontextmanager
from fastapi import FastAPI
from calvery import Calvery

@asynccontextmanager
async def lifespan(app: FastAPI):
    Calvery(token=os.environ["CVSM_TOKEN"], team="acme").inject()
    yield

app = FastAPI(lifespan=lifespan)

Jupyter / data science

from calvery import Calvery
c = Calvery(token="cvsm_...", team="data-team", environment="staging")
db_conn_string = c.get("WAREHOUSE_URL")

Error handling

from calvery import Calvery, CalveryAuthError, CalverySecretNotFoundError

try:
    val = c.get("FOO")
except CalveryAuthError:
    # Token expired / revoked
    ...
except CalverySecretNotFoundError:
    # Secret belum dibuat
    ...

License

MIT

Project details


Download files

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

Source Distribution

calvery-0.3.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

calvery-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file calvery-0.3.0.tar.gz.

File metadata

  • Download URL: calvery-0.3.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for calvery-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6f8729a68e1c5157877aa4f277867d2ed04e030483fbcb046d3f045d23f6048f
MD5 08b71508c959451dc41bc4059251a173
BLAKE2b-256 6adb9e68a6811fcf87c6634d039043413e9686bbc3ea025d21e001d43b7add35

See more details on using hashes here.

File details

Details for the file calvery-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: calvery-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for calvery-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d7fb5468e3685ba19952c84ab3051236642e21381bd6719655e281beab032dc
MD5 8517b491b92f3dd9c261a2bd34f77a7e
BLAKE2b-256 1ab873be7c0bcb52d7c4dcc47a522608cfa9c4cc59733b09915bab918ae2beb1

See more details on using hashes here.

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