Skip to main content

simple_module_users

Email+password user management for simple_module apps. Replaces Keycloak/Auth0 for the common case: local accounts, admin invites, password reset, optional public signup. Built on fastapi-users.

Install

pip install simple_module_users

Pre-wired into any app scaffolded with smpy new.

What it provides

  • Email + password registration, login, logout, password reset.
  • Admin invite flow — admin enters an email, recipient clicks a link, sets a password, is logged in.
  • Public signup toggle (SM_USERS_ALLOW_SIGNUP, default false).
  • Bootstrap admin via env vars (SM_USERS_BOOTSTRAP_EMAIL + SM_USERS_BOOTSTRAP_PASSWORD) — idempotent, only creates if the users table is empty.
  • smpy users create-admin CLI for ad-hoc admin creation.
  • Inertia pages for login/register/invite-accept/admin-invite.
  • Sends verification, reset and invite emails through the framework mail sender (configure the transport in the mail module).
  • Demo mode — one-click, read-only shared admin and standard user accounts on the sign-in card, for public showcase instances.

Usage

CLI:

uv run smpy users create-admin --email admin@example.com --password 'change-me'

Bootstrap-on-boot (.env):

SM_USERS_BOOTSTRAP_EMAIL=admin@example.com
SM_USERS_BOOTSTRAP_PASSWORD=change-me

Program:

from auth.web.deps import CurrentUser


@router.get("/profile")
async def profile(user: CurrentUser):
    return {"email": user.email}

Depends on

  • simple_module_core, simple_module_db, simple_module_hosting, simple_module_settings, simple_module_auth
  • fastapi-users[sqlalchemy,oauth]>=15,<16, cachetools, typer

Demo mode

For hosting a public showcase instance. Set under /admin/settings/ → Users:

demo_mode        = true
demo_admin_email = demo-admin@example.com
demo_user_email  = demo-user@example.com
demo_read_only   = true    # default — keep it on

The sign-in card grows one button per configured account — Explore as an administrator and Explore as a standard user — each posting to POST /api/users/auth/demo/{role}. Neither account's password reaches the browser. Two accounts because the admin surface is what the framework is for and the end-user app is what you build with it; a visitor can switch between them without signing out. Blank either email to offer only the other; that closes its route too, not just its button.

Both accounts are seeded (and reconciled) at boot and on every settings reload, and while demo_read_only is on, DemoReadOnlyMiddleware refuses every unsafe HTTP method from either demo session — everyone else on the instance is unaffected. A standing banner tells the visitor they are in a demo.

Full detail, including the demo_read_only = false warning, is in docs/modules/users.md.

Social sign-in (Google, GitHub, Microsoft, OIDC)

OAuth providers are configured in the admin UI at /settings/modules → Users (no environment variables). Each provider activates once its client id and secret are set; the secret is masked in the UI. Changes apply live — no restart.

Microsoft (Entra ID). Register an app in the Entra admin center and set the redirect URI to <base-url>/api/users/auth/microsoft/callback. Configure under the Microsoft OAuth group:

  • oauth_microsoft_client_id, oauth_microsoft_client_secret
  • oauth_microsoft_tenant — common (any work/school or personal account, the default), organizations (work/school only), or your tenant GUID to restrict sign-in to one tenant.

Each provider's callback URL is <base-url>/api/users/auth/<provider>/callback (google, github, microsoft, oidc).

Note: for Microsoft guest/external accounts the identity email comes from the Graph userPrincipalName, which may not be a plain email (e.g. user_ext.com#EXT#@tenant.onmicrosoft.com). For tenant members it is the user's email.

Migrating from SM_USERS_OAUTH_* env vars

Earlier versions read provider credentials from SM_USERS_OAUTH_* environment variables. These are no longer read at runtime. Migrate existing values into the settings store once with:

uv run smpy settings import-from-env

License

MIT — see LICENSE.

Metadata

Release files for simple-module-users 0.0.45

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

Source distribution (sdist)

Source distribution for simple-module-users 0.0.45
File Size Uploaded Provenance Actions
simple_module_users-0.0.45.tar.gz 328.5 kB With provenance Details for simple_module_users-0.0.45.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-module-users 0.0.45
File Interpreter ABI Platform Actions
simple_module_users-0.0.45-py3-none-any.whl Python 3 none any Details for simple_module_users-0.0.45-py3-none-any.whl

Total release size: 589.8 kB

Release files / simple_module_users-0.0.45.tar.gz

Download URL simple_module_users-0.0.45.tar.gz
Size 328.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa8a2918aca0eedafe80675e6d6c97c71a3bc56b4e1b2e750bf5449703af9b73
BLAKE2b-256 checksum
How to use checksums
9c8e0426097efa7dba554340ff69f4228d980d7c56a09f091f3036d9ab853258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / simple_module_users-0.0.45-py3-none-any.whl

Download URL simple_module_users-0.0.45-py3-none-any.whl
Size 261.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4094329db1421489b0cf546560e15a14b6612f0a277bf3d89a19f19af3f9af3e
BLAKE2b-256 checksum
How to use checksums
b0ed2590d1534d6587d7b3709bdee3d1e5d9788086f6111e6eba8326cecc9cf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for simple-module-users 0.0.45

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simple_module_users-0.0.45.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.0.45 This release

2 release files Full provenance

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