Kanidm
A Python module for interacting with Kanidm.
Currently in very very very early beta, please log an issue for feature requests and bugs.
Installation
python -m pip install kanidm
Documentation
Documentation can be generated by cloning the repository and running
make docs/pykanidm/build. The documentation will appear in ./pykanidm/site. You'll need make and the
uv package installed.
Testing
Set up your dev environment using uv - python -m pip install uv && uv sync.
Pytest it used for testing, if you don't have a live server to test against and config set up, use
uv run pytest -m 'not network'.
OpenAPI client generation
The OpenAPI spec is served by the running Kanidm server. To generate/update the OpenAPI-based client package:
uv run kanidm_openapi_codegen
You can also point it at a local spec file or override the URL:
uv run kanidm_openapi_codegen --spec-file /path/to/openapi.json
uv run kanidm_openapi_codegen --spec-url https://localhost:8443/docs/v1/openapi.json
Programmatic code generation lives in kanidm.openapi_codegen, which is behind the optional feature openapi_codegen:
python -m pip install "kanidm[openapi_codegen]"
Programmatic use is also supported:
from pathlib import Path
from kanidm.openapi_codegen import generate_openapi_client
generate_openapi_client(
spec_url="https://localhost:8443/docs/v1/openapi.json",
verify_tls=True,
ca_file=Path("/tmp/kanidm/ca.pem"),
# season to taste
output=Path("pykanidm/kanidm_openapi_client"),
)
The generated client is packaged as kanidm_openapi_client.
KanidmClient now initializes an OpenAPI client by default at startup as client.openapi_client:
from kanidm import KanidmClient
client = KanidmClient(uri="https://localhost:8443")
openapi_client = client.openapi_client
You can still build one explicitly from config helpers in kanidm.openapi if needed.
OpenAPI structure
kanidm_openapi_client/contains the generated OpenAPI client (API classes, models, and transport).kanidm/openapi.pyprovides helpers to build an OpenAPIApiClientfrom aKanidmClient/KanidmClientConfig.- The generated package is included in the build via
tool.pdm.build.includes.
OpenAPI spec tests
Networked OpenAPI tests are marked openapi and include both spec validation and generated-client GET calls. Run them
with:
IDM_ADMIN_PASS=... uv run pytest -m openapi
OpenAPI tests regenerate kanidm_openapi_client once per pytest session before running marked tests. This uses
kanidm.openapi_codegen and requires Docker to be available.
Optional environment overrides:
KANIDM_CA_PATH(default:/tmp/kanidm/ca.pemif present)KANIDM_OPENAPI_URL(default:https://localhost:8443)IDM_ADMIN_PASS(required for auth'd OpenAPI tests; matchesscripts/setup_dev_environment.sh)KANIDM_INSECURE(true/false, default:false) disables TLS verification for tests
Note: tests always verify TLS unless KANIDM_INSECURE=true. Provide a CA via KANIDM_CA_PATH (or use the default
/tmp/kanidm/ca.pem) so the server cert validates.
Changelog
| Version | Date | Notes |
|---|---|---|
| 0.0.1 | 2022-08-16 | Initial release |
| 0.0.2 | 2022-08-16 | Updated license, including test code in package |
| 0.0.3 | 2022-08-17 | Updated test suite to allow skipping of network tests |
| 1.2.0 | 2025-05-13 | Replaced poetry with uv for packaging |
| 1.3.0 | 2026-02-19 | Major rewrite to use openapi-generated codebase, based on 1.9.0 API |
Metadata
Release files for kanidm 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kanidm-1.3.0.tar.gz | 149.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kanidm-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 513.2 kB
Release files / kanidm-1.3.0.tar.gz
| Download URL | kanidm-1.3.0.tar.gz |
|---|---|
| Size | 149.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a55315bf6c9072427ccf75177d679a52b47dbb4a95ab0a28d97398e5553e631
|
|
BLAKE2b-256 checksum How to use checksums |
d34a61f5caeea8dd9fc515ae4dc1e0307472ac34f44035754ad236d8e2db9e6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / kanidm-1.3.0-py3-none-any.whl
| Download URL | kanidm-1.3.0-py3-none-any.whl |
|---|---|
| Size | 363.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e34f98c9e7275d82115c494de6ccd3b07bec89744e071d51fdaa2e11ac20b24b
|
|
BLAKE2b-256 checksum How to use checksums |
f5cd557a948b8cad7ec81f7bde8c09c7d9de2debfd3e05d30092cc6e965c9c50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for kanidm 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.