Skip to content

Commit 192b574

Browse files
authored
Add Yara ORM support, action-results refresh button, parallel tests (#134)
- Add YaraOrmModelAdmin / YaraOrmInlineModelAdmin adapter and fastadmin[yara-orm] extra; full introspection + CRUD (FK, O2O, M2M) mirroring the other ORMs - Wire Yara ORM into docs, README, API reference and the install matrix; add a runnable examples/fastapi_yaraorm app; cross-link to the yara-orm project - Add a refresh button to widget action results (toolbar + expand modal) so results re-run in place without losing scroll position (#132) - Run the test suite in parallel: per-xdist-worker SQLite files with a busy timeout fix the Django/Pony 'database is locked' errors; Makefile/CI use -n auto - Restore ADMIN_USER_MODEL after each test so a torn-down ORM cannot leak - Release 0.7.0
1 parent 6624cc2 commit 192b574

29 files changed

Lines changed: 1276 additions & 167 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Install dependencies
5252
run: uv sync --all-extras
5353
- name: Run tests with 100% coverage gate
54-
run: uv run pytest -n 1 --cov=fastadmin --cov-report=term-missing --cov-report=xml -s tests
54+
run: uv run pytest -n auto --cov=fastadmin --cov-report=term-missing --cov-report=xml tests
5555
- name: Upload coverage to Codecov
5656
if: matrix.python-version == '3.13'
5757
uses: codecov/codecov-action@v5
@@ -74,6 +74,7 @@ jobs:
7474
- "fastapi,tortoise-orm"
7575
- "fastapi,pony"
7676
- "fastapi,sqlalchemy"
77+
- "fastapi,yara-orm"
7778
- "django"
7879
- "django,pony"
7980
- "flask,sqlalchemy"

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
All notable changes to FastAdmin are documented in this file.
44

5+
## 0.7.0
6+
7+
- Add support for [Yara ORM](https://github.com/vsdudakov/yara-orm) — a fast,
8+
async Python ORM with a Rust engine. New `YaraOrmModelAdmin` /
9+
`YaraOrmInlineModelAdmin` admin classes and a `fastadmin[yara-orm]` extra, with
10+
a runnable FastAPI example (`examples/fastapi_yaraorm`).
11+
- Add a refresh button to the widget action results (toolbar and expand modal)
12+
so results can be re-run in place without losing scroll position (#132).
13+
514
## 0.6.0
615

716
Security hardening release. No changes to the documented public API, but

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ format:
2525
uv run ruff format $(LINT_PATHS)
2626
make -C frontend fix
2727

28-
# Use -n 1: -n auto causes flaky failures with Django+SQLite (database is locked, 500s). conftest
29-
# uses a per-worker DB and SQLite timeout when xdist is used, but parallel runs remain unreliable.
28+
# -n auto runs the suite in parallel via pytest-xdist. Each worker gets its own
29+
# SQLite file (Django/Pony) with a busy timeout, so there are no "database is
30+
# locked" failures.
3031
test:
31-
uv run pytest -n 1 --cov=fastadmin --cov-report=term-missing --cov-report=xml -s tests
32+
uv run pytest -n auto --cov=fastadmin --cov-report=term-missing --cov-report=xml tests
3233
make -C frontend test
3334

3435
cov: test

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
**FastAdmin** is an easy-to-use **admin dashboard (admin panel) for FastAPI, Flask and
1212
Django**, inspired by Django Admin. It gives your Python web application a
1313
production-ready **CRUD admin interface** in minutes — on top of **Tortoise ORM,
14-
Django ORM, SQLAlchemy or Pony ORM** — with authentication, filters, search,
14+
Django ORM, SQLAlchemy, Pony ORM or [Yara ORM](https://github.com/vsdudakov/yara-orm)**
15+
with authentication, filters, search,
1516
inline editing, file uploads, CSV/JSON export and dashboard charts out of the box.
1617

1718
FastAdmin is built with relationships in mind and admiration for Django Admin.
@@ -31,7 +32,8 @@ already know FastAdmin.
3132
- **Any web framework** — mount as a FastAPI sub-app, a Flask blueprint or
3233
Django urlpatterns.
3334
- **Any ORM** — first-class admin classes for Tortoise ORM, Django ORM,
34-
SQLAlchemy (async) and Pony ORM.
35+
SQLAlchemy (async), Pony ORM and [Yara ORM](https://github.com/vsdudakov/yara-orm)
36+
(a fast, Rust-engine async ORM).
3537
- **Authentication & permissions** — pluggable sign-in against your own user
3638
model, per-action permission hooks, request/user context in every admin method.
3739
- **Rich form widgets** — 20+ antd-based widgets (rich text, JSON, async
@@ -56,6 +58,7 @@ pip install fastadmin[fastapi,django] # FastAPI with Django ORM
5658
pip install fastadmin[fastapi,tortoise-orm] # FastAPI with Tortoise ORM
5759
pip install fastadmin[fastapi,pony] # FastAPI with Pony ORM
5860
pip install fastadmin[fastapi,sqlalchemy] # FastAPI with SQLAlchemy (includes greenlet)
61+
pip install fastadmin[fastapi,yara-orm] # FastAPI with Yara ORM
5962
pip install fastadmin[django] # Django with Django ORM
6063
pip install fastadmin[django,pony] # Django with Pony ORM
6164
pip install fastadmin[flask,sqlalchemy] # Flask with SQLAlchemy (includes greenlet)
@@ -147,11 +150,15 @@ Runnable example apps for every framework/ORM combination are in
147150
## Why FastAdmin?
148151

149152
If you are looking for a **Django-Admin-like admin panel for FastAPI**, an
150-
**admin interface for SQLAlchemy or Tortoise ORM**, or a lightweight
153+
**admin interface for SQLAlchemy, Tortoise ORM or
154+
[Yara ORM](https://github.com/vsdudakov/yara-orm)**, or a lightweight
151155
**alternative to building a custom back office**, FastAdmin gives you a
152156
batteries-included, themeable admin UI without code generation, without tying
153157
your app to a specific framework, and without writing a single React component.
154158

159+
Pair it with [Yara ORM](https://github.com/vsdudakov/yara-orm) — our fast, async
160+
Python ORM with a Rust engine — for a high-performance FastAPI + admin stack.
161+
155162
## Contributing
156163

157164
Contributions are welcome — see the

docs/api-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ package.
2626
| `DjangoModelAdmin` / `DjangoInlineModelAdmin` | Django ORM admins. |
2727
| `SqlAlchemyModelAdmin` / `SqlAlchemyInlineModelAdmin` | SQLAlchemy (async) admins. |
2828
| `PonyORMModelAdmin` / `PonyORMInlineModelAdmin` | Pony ORM admins. |
29+
| `YaraOrmModelAdmin` / `YaraOrmInlineModelAdmin` | [Yara ORM](https://github.com/vsdudakov/yara-orm) admins. |
2930

3031
Attributes are documented in [Model admins](guides/model-admins.md) and
3132
[Inline admins](guides/inline-admins.md).

docs/getting-started/installation.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Install the package with the extras matching your web framework and ORM:
1616
pip install fastadmin[fastapi,tortoise-orm] # FastAPI with Tortoise ORM
1717
pip install fastadmin[fastapi,pony] # FastAPI with Pony ORM
1818
pip install fastadmin[fastapi,sqlalchemy] # FastAPI with SQLAlchemy (includes greenlet)
19+
pip install fastadmin[fastapi,yara-orm] # FastAPI with Yara ORM
1920
pip install fastadmin[django] # Django with Django ORM
2021
pip install fastadmin[django,pony] # Django with Pony ORM
2122
pip install fastadmin[flask,sqlalchemy] # Flask with SQLAlchemy (includes greenlet)
@@ -28,6 +29,7 @@ Install the package with the extras matching your web framework and ORM:
2829
uv add 'fastadmin[fastapi,tortoise-orm]'
2930
uv add 'fastadmin[fastapi,pony]'
3031
uv add 'fastadmin[fastapi,sqlalchemy]'
32+
uv add 'fastadmin[fastapi,yara-orm]'
3133
uv add 'fastadmin[django]'
3234
uv add 'fastadmin[django,pony]'
3335
uv add 'fastadmin[flask,sqlalchemy]'
@@ -40,6 +42,7 @@ Install the package with the extras matching your web framework and ORM:
4042
poetry add 'fastadmin[fastapi,tortoise-orm]'
4143
poetry add 'fastadmin[fastapi,pony]'
4244
poetry add 'fastadmin[fastapi,sqlalchemy]'
45+
poetry add 'fastadmin[fastapi,yara-orm]'
4346
poetry add 'fastadmin[django]'
4447
poetry add 'fastadmin[django,pony]'
4548
poetry add 'fastadmin[flask,sqlalchemy]'

docs/guides/registering-models.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Registering models
3-
description: Register ORM models with FastAdmin — complete runnable examples for Tortoise ORM, Django ORM, SQLAlchemy and Pony ORM.
3+
description: Register ORM models with FastAdmin — complete runnable examples for Tortoise ORM, Django ORM, SQLAlchemy, Pony ORM and Yara ORM.
44
---
55

66
# Registering models
@@ -14,6 +14,7 @@ The admin base class must match your ORM:
1414
| Django ORM | `DjangoModelAdmin` | `DjangoInlineModelAdmin` |
1515
| SQLAlchemy | `SqlAlchemyModelAdmin` | `SqlAlchemyInlineModelAdmin` |
1616
| Pony ORM | `PonyORMModelAdmin` | `PonyORMInlineModelAdmin` |
17+
| [Yara ORM](https://github.com/vsdudakov/yara-orm) | `YaraOrmModelAdmin` | `YaraOrmInlineModelAdmin` |
1718

1819
```python
1920
from fastadmin import TortoiseModelAdmin, register
@@ -70,3 +71,9 @@ fields, uploads and dashboard widgets), authentication and app mounting.
7071
```python
7172
--8<-- "examples/fastapi_ponyorm/example.py"
7273
```
74+
75+
=== "Yara ORM"
76+
77+
```python
78+
--8<-- "examples/fastapi_yaraorm/example.py"
79+
```

docs/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: FastAdmin — Admin dashboard for FastAPI, Flask and Django
3-
description: FastAdmin is an easy-to-use admin dashboard for FastAPI, Flask and Django, inspired by Django Admin. Works with Tortoise ORM, Django ORM, SQLAlchemy and Pony ORM.
3+
description: FastAdmin is an easy-to-use admin dashboard for FastAPI, Flask and Django, inspired by Django Admin. Works with Tortoise ORM, Django ORM, SQLAlchemy, Pony ORM and Yara ORM.
44
---
55

66
# FastAdmin
@@ -16,7 +16,8 @@ description: FastAdmin is an easy-to-use admin dashboard for FastAPI, Flask and
1616
FastAdmin is built with relationships in mind and admiration for Django Admin.
1717
Its design focuses on making it as easy as possible to configure an admin
1818
dashboard for **FastAPI**, **Flask** or **Django** on top of **Tortoise ORM**,
19-
**Django ORM**, **SQLAlchemy** or **Pony ORM**. It aims to be minimal,
19+
**Django ORM**, **SQLAlchemy**, **Pony ORM** or
20+
**[Yara ORM](https://github.com/vsdudakov/yara-orm)**. It aims to be minimal,
2021
functional and familiar.
2122

2223
![FastAdmin demo](assets/images/demo.gif)
@@ -56,7 +57,8 @@ app.mount("/admin", admin_app)
5657
- :jigsaw: **Framework-agnostic** — mount it into FastAPI, register it as a
5758
Flask blueprint or include it in Django urlpatterns.
5859
- :file_cabinet: **ORM-agnostic** — first-class admins for Tortoise ORM,
59-
Django ORM, SQLAlchemy (async) and Pony ORM.
60+
Django ORM, SQLAlchemy (async), Pony ORM and
61+
[Yara ORM](https://github.com/vsdudakov/yara-orm) (a fast, Rust-engine async ORM).
6062
- :bar_chart: **Dashboard widgets** — declarative chart and action widgets
6163
(line, area, column, bar, pie) with filters, powered by antd charts.
6264
- :outbox_tray: **Uploads & exports** — file/image upload widgets with

examples/fastapi_yaraorm/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
all: install run
2+
3+
.PHONY: fastapi
4+
run:
5+
uv run uvicorn example:app --reload --host=0.0.0.0 --port=8090
6+
7+
.PHONY: install
8+
install:
9+
uv pip install fastadmin[fastapi] yara-orm uvicorn
10+
uv pip install -e ../../

examples/fastapi_yaraorm/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# FastAdmin — FastAPI + Yara ORM example
2+
3+
A minimal admin dashboard for a FastAPI app backed by
4+
[Yara ORM](https://github.com/vsdudakov/yara-orm) (a fast, async, Tortoise-style
5+
Python ORM with a Rust engine).
6+
7+
## Run
8+
9+
```bash
10+
make install
11+
make run
12+
```
13+
14+
Then open <http://localhost:8090/admin> and sign in with `admin` / `admin`.
15+
16+
The example registers `User`, `Tournament`, `BaseEvent` and `Event` admins,
17+
demonstrating foreign keys, one-to-one and many-to-many relations, an inline,
18+
bulk actions, display fields, a dashboard chart widget and file uploads.
19+
20+
See the [FastAdmin documentation](https://vsdudakov.github.io/fastadmin/) for
21+
details.

0 commit comments

Comments
 (0)