Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SpiffeId
✓ from spiffe import SpiffeId
✗ from spiffe.core import SpiffeId
SpiffeId is in top-level package, not spiffe.core
X509Source
✓ from spiffe.workload_api.x509_source import X509Source
✗ from spiffe.x509_source import X509Source
Correct import from submodule
JwtSource
✓ from spiffe.workload_api.jwt_source import JwtSource
✗ from spiffe.jwt_source import JwtSource
Correct import from submodule
Fetch an X.509 SVID from a SPIRE Agent using the default Unix domain socket path.
import os
from spiffe import SpiffeId
from spiffe.workload_api.x509_source import X509Source
# Create X509 source using default SPIRE agent socket path
# Or set environment variable SPIFFE_ENDPOINT_SOCKET
x509_source = X509Source()
# Fetch X509 SVID
svid = x509_source.fetch_x509_svid()
print(f'SPIFFE ID: {svid.spiffe_id}')
x509_source.stop()
Errors
Common errors & fixes
ImportError: cannot import name 'SpiffeId' from 'spiffe'
Incorrect package installation or very old version (pre-0.2.0). SpiffeId was added in 0.2.0.
fixUpgrade spiffe to >=0.2.0: `pip install --upgrade spiffe`
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/spire-agent/public/api.sock'
Default socket path is /tmp/spire-agent/public/api.sock but your SPIRE Agent uses a different path or socket is missing.
fixSet the environment variable `SPIFFE_ENDPOINT_SOCKET` to the correct socket path, e.g., `export SPIFFE_ENDPOINT_SOCKET=/run/spire/agent.sock`.
TypeError: __init__() got an unexpected keyword argument 'spiffe_id'
Using deprecated constructor signature. Newer versions changed the SpiffeId constructor parameter from 'spiffe_id' to 'trust_domain' and 'path'.
fixUse `SpiffeId(trust_domain='example.org', path='/workload')` instead of `SpiffeId(spiffe_id='spiffe://example.org/workload')`.
grpc.RpcError: <_MultiThreadedRendezvous: StatusCode.UNAVAILABLE, ...>
Failed to connect to SPIRE Agent. Agent may be down or socket path is incorrect.
fixVerify SPIRE Agent is running and the socket path is correct. Check `SPIFFE_ENDPOINT_SOCKET` environment variable.
Upgrade
Version history
0.2.9latest on PyPI · released May 11, 2026
Audit
Dependencies
cryptographyrequiredX.509 certificate handling
grpciorequiredgRPC communication with SPIRE Agent