Skip to main content

Generic FastAPI + SQLAlchemy admin backend.

Project description

xladmin backend

xladmin-backend is the backend package published to PyPI as xladmin.

Important:

  • package name on PyPI: xladmin
  • Python import: from xladmin import ...
  • monorepo: Artasov/xladmin

Public API

  • AdminConfig / ModelConfig / FieldConfig
  • ListFilterConfig
  • BulkActionConfig / ObjectActionConfig
  • ModelsBlock
  • HttpConfig
  • create_router(...)

Compatibility aliases are kept:

  • Admin* config names
  • create_admin_router(...)

Minimal Example

from xladmin import AdminConfig, HttpConfig, ModelConfig, create_router

from src.core.auth.dependencies import get_current_user
from src.core.db.session import get_db_session
from src.modules.identity.models import UserORM


config = AdminConfig(
    models=(
        ModelConfig(model=UserORM),
    ),
)

router = create_router(
    HttpConfig(
        registry=config,
        get_db_session_dependency=get_db_session,
        get_current_user_dependency=get_current_user,
        is_allowed=lambda user: bool(user.is_staff),
    ),
)

ModelConfig(model=UserORM) is enough for a basic admin. The library derives default slug, title, search fields, and ordering from the ORM model.

Features

  • list / detail / create / patch / delete endpoints
  • bulk actions and object actions
  • relation choices and relation filters
  • overview metadata and model blocks
  • query_for_list and custom search_query_builder
  • delete preview for single and bulk delete
  • RU / EN locale metadata for the frontend

Compatibility

  • FastAPI >=0.115,<1.0
  • Pydantic >=2.9,<3.0
  • SQLAlchemy >=2.0,<3.0
  • Python >=3.12

Development

uv sync --extra dev
uv run pytest
uv run ruff check .
uv run mypy
uv run python -m build
uv run python -m twine check dist/*

Docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xladmin-0.2.9.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xladmin-0.2.9-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file xladmin-0.2.9.tar.gz.

File metadata

  • Download URL: xladmin-0.2.9.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for xladmin-0.2.9.tar.gz
Algorithm Hash digest
SHA256 c46e280512dae54f9868472459acac1b70fa202b368e74b4f81b07e743f1a7a2
MD5 519386f00a4d64bb953f883c5c8c2f4e
BLAKE2b-256 f161d187567a2fc8c7580eb50be1cfdfaeb024dd58fc25644f087c3d4beb278f

See more details on using hashes here.

File details

Details for the file xladmin-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: xladmin-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for xladmin-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 72356ead9e0f6a56784941d68afb7b34a9b43bf2ef7b94061a4fb780076c83fa
MD5 a3e14931f485c5df126f892c99e72647
BLAKE2b-256 5418648cb5edc3466fbf63054f7a6c57bb9f5d2c9b2411a61742bff466f28c31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page