Install & Compatibility
Where this runs
tested against v5.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.582s · 87.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 8.2s · import 0.568s · 89MB
94MB installed
● package 94MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
key_manager
✓ from castellan import key_manager
Key manager factory to get backend instances
BarbicanKeyManager
✓ from castellan.key_manager.barbican_key_manager import BarbicanKeyManager
✗ from castellan.barbican_key_manager import BarbicanKeyManager
Wrong path: must include full module path
KMIPKeyManager
✓ from castellan.key_manager.kmip_key_manager import KMIPKeyManager
Key
✓ from castellan.common.objects import Key
✗ from castellan.objects import Key
Key base class is in common.objects
Passphrase
✓ from castellan.common.objects import Passphrase
Basic usage: create a key manager using config, store and retrieve a passphrase.
import os
from castellan import key_manager
from castellan.common.objects import Passphrase, SymmetricKey
conf = {
'key_manager': 'barbican',
'barbican': {
'auth_url': os.environ.get('OS_AUTH_URL', ''),
'project_name': os.environ.get('OS_PROJECT_NAME', ''),
}
}
km = key_manager.KeyManager(conf)
# Create a passphrase
passphrase = Passphrase('my-secret-passphrase')
stored = km.store('default', passphrase)
print(f"Stored passphrase with ID: {stored}")
# Retrieve
retrieved = km.get('default', stored)
print(f"Retrieved passphrase: {retrieved.get_encoded()}")
castellan --version
Errors
Common errors & fixes
ImportError: cannot import name 'key_manager' from 'castellan'
Incorrect import path; castellan.key_manager is a module, not a top-level attribute.
fixUse: from castellan import key_manager
castellan.key_manager.KeyManager object has no attribute 'store'
KeyManager is a factory; you must call it to get a backend manager instance.
fixkm = key_manager.KeyManager(conf) then km.store(...)
castellan.common.exception.KeyManagerError: Connection refused
Barbican endpoint is unreachable or misconfigured.
fixCheck OS_AUTH_URL and OS_PROJECT_NAME environment variables, or provide correct barbican_url in config.
Upgrade
Version history
5.7.0latest on PyPI · released May 18, 2026
Audit
Dependencies
keystoneauth1optionalAuthentication for OpenStack identity
oslo.configoptionalConfiguration management