Typed HashiCorp Vault KV helper library with pragmatic auth and env helpers.
Project description
vault-kv-client
vault-kv-client is a small, typed, and production-friendly helper library for
working with HashiCorp Vault KV engines through hvac.
It focuses on the common parts teams end up re-implementing around Vault:
- KV v1 and v2 support with automatic mount version detection
- Token, AppRole, Kubernetes, and Vault JWT/OIDC authentication
- Enterprise namespace support
- Recursive listing and secret copy helpers
- Optional in-memory read caching
- Environment-driven bootstrap for CI, Kubernetes, and legacy Airflow deployments
Installation
pip install vault-kv-client
With uv:
uv add vault-kv-client
With Poetry:
poetry add vault-kv-client
Quick Start
from vault_kv_client import VaultAuth, VaultManager, VaultSettings
settings = VaultSettings(
addr="https://vault.example.com",
verify=True,
namespace=None,
)
auth = VaultAuth(token="s.xxxxx")
client = VaultManager(settings=settings, auth=auth)
secret = client.get_secret("kv", "apps/my-service")
print(secret["username"])
Environment-driven bootstrap is also available:
from vault_kv_client import get_default_manager
client = get_default_manager()
secret = client.get_secret("kv", "apps/my-service")
Public API
Root package exports:
VaultManagerVaultSettingsVaultAuthVaultJWTAuthVaultKubernetesAuthVaultClientErrorVaultNotConfiguredErrorVaultDependencyErrorSecretNotFoundErrorget_default_manager()get_creds()
Core methods:
get_secret(mount_point, path, kv_version=None)upsert_secret(mount_point=..., path=..., secret=..., kv_version=None)list_secrets(mount_point, path="", kv_version=None)list_all_secrets(mount_point, path="", kv_version=None)copy_secret(source_mount=..., target_mount=..., path=...)clear_cache()
Authentication Modes
The library supports four mutually exclusive auth modes:
tokenapprolekubernetesjwt
Full examples are documented in docs/auth-methods.md.
Legacy Compatibility
The historical package name vault_client is still shipped as a temporary
compatibility layer:
from vault_client import VaultManager
That import path now emits a DeprecationWarning. New projects should use
vault_kv_client.
Documentation
Repository docs are designed for self-service onboarding:
- Getting Started
- Installation
- Auth Methods
- KV v1/v2 Behavior
- API Reference
- Migration from
vault_client - Development
- Security
- Release Process
The GitHub Pages site is generated from the same sources via MkDocs Material.
Development
python3 -m venv .venv
. .venv/bin/activate
pip install -U pip uv
uv pip install -e ".[dev]"
ruff check .
mypy src
pytest -q
mkdocs build
Security
- Never log secret payloads.
- Prefer short-lived auth flows where possible.
- Use the minimum Vault policy scope required for your application.
- Report security issues through the process described in SECURITY.md.
License
This project is licensed under the Apache License 2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 vault_kv_client-0.1.0.tar.gz.
File metadata
- Download URL: vault_kv_client-0.1.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7e5598eb73641da7f6ca778ae31acb355aea796ec33c0bb50711b48e34c751a
|
|
| MD5 |
73cf13e7937541f6bf46c9561c889fdd
|
|
| BLAKE2b-256 |
52c661d5fa893066f7d1408d495d376b1fa8cca618545512eff68ce553391a68
|
File details
Details for the file vault_kv_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vault_kv_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbbee03db68f33d93a900b9809e30854699a2bab712c6052e1864d8c038b76ce
|
|
| MD5 |
fc4bad8060834a6781d833eb57f0d025
|
|
| BLAKE2b-256 |
50fa6221b9dd0ae41da1bd878f4a20bf41490e167e3cf24d45d8f3daf5a83da6
|