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, defaultfalse). - 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-adminCLI for ad-hoc admin creation.- Inertia pages for login/register/invite-accept/admin-invite.
- Console mailer (logs to stdout) or SMTP mailer (
SM_USERS_MAILER=smtp). - 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.deps import CurrentUser # type: ignore[import-not-found]
@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_authfastapi-users[sqlalchemy,oauth]>=15,<16,aiosmtplib,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_secretoauth_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.36
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 | |
|---|---|---|---|---|
| simple_module_users-0.0.36.tar.gz | 225.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_module_users-0.0.36-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 431.5 kB
Release files / simple_module_users-0.0.36.tar.gz
| Download URL | simple_module_users-0.0.36.tar.gz |
|---|---|
| Size | 225.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eac525708067dd01a113b38295428ad0aeb9514008accf4b15d580dd19ed6ac7
|
|
BLAKE2b-256 checksum How to use checksums |
33cc21c3830a0cae4c09b6809607b9090feed69b2453bfde17c9169d07c2474f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 13, 2026.
Transparency logRelease files / simple_module_users-0.0.36-py3-none-any.whl
| Download URL | simple_module_users-0.0.36-py3-none-any.whl |
|---|---|
| Size | 205.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b915a6ab08e51c6c9d98b6f5a3a77d0b124472ad9bc10811fc6f0777d9568dd3
|
|
BLAKE2b-256 checksum How to use checksums |
131b3d22711d1b2c71af30a3143db96ff0e0e38dfe1e810389b8a151a2033b33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 13, 2026.
Transparency logSecurity for simple-module-users 0.0.36
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for simple_module_users-0.0.36.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 Oct 13, 2026.
Transparency logA 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.