skillfed

krb5

Kerberos API bindings for Python

krb5 v0.9.0 4.8M downloads/30d#2,230 on PyPI21
Permissive license MIT AGING released

What it is and what it does

krb5 is a direct Python wrapper around the Kerberos 5 C API, exposing low-level functions for Kerberos operations. It strips the `krb5_` prefix from standard KRB5 functions—for example, `krb5_init_context()` becomes `krb5.init_context()`—and raises `Krb5Error` exceptions with formatted error messages and codes. The library returns Python classes for KRB5 structures, which are automatically freed when dereferenced; some expose an `addr` property to pass raw pointers to other libraries like python-gssapi.

The package requires either MIT Kerberos (minimum 1.17) or Heimdal with development headers and a C compiler to build from source; macOS users can install pre-built wheels without compilation. Not all functions are available on every KRB5 implementation, so callers must check availability at runtime. The library supports Python 3.9+ and includes beta-level support for Python free-threading (PEP 779). The description explicitly recommends using python-gssapi for simpler Kerberos authentication workflows.

Use it for:

  • Build low-level Kerberos authentication systems where direct KRB5 API control is needed
  • Integrate Kerberos credential and ticket management into Python applications
  • Pass KRB5 structures to other libraries (like python-gssapi) via the addr property
  • Develop Kerberos-aware network services that require fine-grained context and credential handling

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Wraps the Kerberos 5 C API to provide Python functions for low-level Kerberos operations, with functions matching the KRB5 API specification.

Yes, if you need direct Kerberos 5 API access and have the required system dependencies (Kerberos implementation + C compiler). No, if you want simpler Kerberos authentication—use python-gssapi instead. The package is stable (MIT license, no known vulnerabilities, active repository) but aging (262 days since last release) and marked Beta. Install friction is medium due to compiled dependencies.

Install

krb5 on PyPI

pip

pip install krb5

uv

uv add krb5

poetry

poetry add krb5

Installing krb5

Before you install

Medium install friction due to compiled C extension requirements. Needs a Kerberos 5 implementation (MIT Kerberos 1.17+ or Heimdal) and C compiler on most platforms; macOS wheels avoid compilation if installing pre-built. Last release 262 days ago; repository active but aging.

License in practice

MIT license is permissive and imposes no restrictions on use, modification, or distribution in proprietary or open-source contexts.

Quickstart

pip install krb5

import krb5

ctx = krb5.init_context()
# Use context for Kerberos operations

Requires Kerberos 5 implementation (MIT Kerberos 1.17+ or Heimdal) with development headers and C compiler, except on macOS when using pre-built wheels. Python 3.9+.

Verify before relying

  • Thread safety guarantees and limitations under free-threading mode (PEP 779)
  • Behavioral differences and error handling across MIT Kerberos vs. Heimdal implementations
  • Production readiness status (Development Status is Beta)

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 262 days since the last release
Last repo commit
First released
Downloads 4,788,678/month — #2,230 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: krb5-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl; krb5-0.9.0-cp310-cp310-macosx_11_0_arm64.whl; krb5-0.9.0-cp311-abi3-macosx_10_9_x86_64.whl; krb5-0.9.0-cp311-abi3-macosx_11_0_arm64.whl; krb5-0.9.0-cp314-cp314t-macosx_10_15_x86_64.whl; krb5-0.9.0-cp314-cp314t-macosx_11_0_arm64.whl; krb5-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl; krb5-0.9.0-cp39-cp39-macosx_11_0_arm64.whl

Keywords: krb5, kerberos

Development Status :: 4 - BetaProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - Beta

Tags

kerberos 5 python bindingskrb5 c api wrapperkerberos authentication librarykrb5 context and ticket managementkerberos credential handlinglow-level kerberos operations
kerberosauthenticationc-bindings

More Security packages