Skip to main content

NeoZen

Authentication and authorization for modern Python applications.

License: Apache 2.0 Python 3.12+

NeoZen (NeoZeN = AuthN + AuthZ) is a framework-agnostic authentication and authorization toolkit for Python. It can also run, secondarily, as a self-hosted service with an admin console; that service is also a small identity provider (OpenID Connect, and SCIM; experimental).

Status: NeoZen is 0.x. Docs, tests, packaging and the reference deployment are in good shape, but the API isn't stable before 1.0: CHANGES.md says what each release changes, and what to do. Some features are experimental or sketched: see Status.

Two ways to use NeoZen

As a library

pip install neozen and embed it in your own Litestar, Starlette, Flask, or other Python web app. Bring your own User model. Pick the factors you need.

pip install "neozen[sqlalchemy,password]"

See the Developer Quickstart: a runnable 80-line Litestar app in under five minutes.

As a self-hosted service

docker compose up -d to run NeoZen as its own IAM service with an admin console. Other apps can sign in through it with OpenID Connect, and a directory can provision its users and groups over SCIM (experimental: password sign-in, consent and sign-out pages).

cd deploy/docker
docker compose up -d
docker compose logs neozen | grep NEOZEN-BOOTSTRAP-CREDENTIALS -A 6

See the Self-Hosted Quickstart: a working self-hosted IAM in under ten minutes.

What NeoZen provides

  • Authentication: passwords (Argon2id), magic links, TOTP, email OTP, WebAuthn/passkeys, social login (Google, GitHub), sign-in through an OpenID Connect provider (experimental)
  • Authorization: role-based access control (RBAC), permissions, policy-based authorization
  • OAuth 2.1 server: authorization code with PKCE, refresh, client credentials
  • OpenID Connect 1.0 Provider (experimental): discovery, JWKS, ID tokens, UserInfo, consent, RP-initiated logout, dynamic client registration, prompt=login and max_age
  • SCIM 2.0 server (experimental): User and Group resources with filters and PATCH, as framework-neutral handlers your app mounts, and SQL adapters for both
  • LDAP backend (experimental): read-only LDAP/Active Directory with bind-based password authentication; no writes, pooling or group lookups
  • Organizations: members, owners, roles in them and on your resources, invitations
  • Groups: kept by administrators, by a directory over SCIM, or by rules of your own
  • Sessions, rate limiting, i18n
  • Account lockout: a LockoutManager your login handler calls; the factors don't call it
  • Framework adapters for Flask, Litestar, Starlette
  • Storage: SQLAlchemy; Peewee, Tortoise ORM and plain SQL for the generic repository only
  • Admin console (Litestar) with user management, bulk import/export, and a live audit log of the console's own actions
  • Reference deployment: Dockerfile, docker-compose, starter Helm chart, neozen serve production-mode CLI

Design principles

  • Framework-agnostic: works with Flask, Litestar, Starlette, or any WSGI/ASGI app
  • Protocol-based: depend on interfaces, not implementations
  • Bring Your Own Model: factory functions and split protocols let you plug your own User model without inheriting from NeoZen base classes
  • Secure by default: Argon2id hashing, timing-safe comparison, hashed session tokens, PKCE, refresh-token rotation
  • Modular: use only the components you need
  • Type-checked across mypy, ty, pyrefly, and zuban

Documentation

Full docs at https://neozen.lab.abilian.com/ (or build locally with make -C docs serve).

Development

# Clone
git clone https://git.sr.ht/~sfermigier/neozen
cd neozen

# Install with all extras
uv sync --all-extras

# Run the full test suite
uv run pytest tests/a_unit tests/b_integration tests/c_e2e

# Lint
uv run ruff check

# Build the docs
make -C docs serve

# Rebuild the admin console's scripts and styles (needs Node)
make assets

The admin console's scripts and styles are bundled with Vite from frontend/ into src/neozen/admin/static/, which is committed, so installing NeoZen needs no Node. Rebuild them after changing a template's Tailwind classes or a script, and commit the result.

License

Apache License 2.0. See LICENSE.

NeoZen is sponsored by Abilian SAS. Abilian's interest in NeoZen is in consulting and integration services around the OSS, not in a product upsell. There is no paid tier and no open-core gating.

Metadata

Release files for neozen 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neozen 0.14.0
File Size Uploaded Provenance Actions
neozen-0.14.0.tar.gz 544.7 kB Without provenance Details for neozen-0.14.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neozen 0.14.0
File Interpreter ABI Platform Actions
neozen-0.14.0-py3-none-any.whl Python 3 none any Details for neozen-0.14.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / neozen-0.14.0.tar.gz

Download URL neozen-0.14.0.tar.gz
Size 544.7 kB
Tags Source
SHA-256 checksum
How to use checksums
85b4ed001d9e7a238202ebfc09e3c293a2db902897f65e489302377ffb953f7b
BLAKE2b-256 checksum
How to use checksums
f8e8f47a0c0f3f18edf48be300afcb3259ef1e22efb2570352ba86d0c64b653c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 / neozen-0.14.0-py3-none-any.whl

Download URL neozen-0.14.0-py3-none-any.whl
Size 694.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53362dfb6784554e513b98c5e5444e93275ee60512aa757e6f678798e14fb02d
BLAKE2b-256 checksum
How to use checksums
0daba59f8957ca088f8efcf26f5258f0e9002ad2f8baac62308ef090d5b09a00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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 neozen 0.14.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page