Coverage of the FastAPI, Pydantic and SQLAlchemy documentation
py2axum is measured on the examples of the official documentation: every app of FastAPI's docs_src/ (FastAPI 0.142.3), replayed with FastAPI's own tests (tests/test_tutorial/) against the Python reference and against the binary, and every Pydantic 2.14.0 documentation block that validates a model, served by a minimal FastAPI route around each model. Responses are compared as the conformance harness compares them: status, headers, body byte for byte, key order included. The SQLAlchemy documentation has its own section. The bench is in corpus/ (how it works).
| Status |
Meaning |
| identical |
every compared response is the same |
| documented |
the responses differ only by a documented difference (the order of a set, an integer beyond 64 bits) |
| differs |
at least one response differs (a bug, unless listed in supported.md) |
| refused |
py2axum refuses the example at translation, with the reason at file:line |
| error |
the translator crashed, or the generated code did not compile or start |
| untested |
translated, but no official test sends it a request |
| docs-only |
its tests only request /openapi.json or /docs, which the binary does not serve |
| nondeterministic |
Python's own responses vary from run to run (random): compared, never counted |
| reference-fails |
the Python reference itself fails (SQLAlchemy section only): listed, never counted |
The OpenAPI schema and documentation pages are not served by the binary (see supported.md): those requests are sent to both servers but not compared. Requests a test sends while it sets app.dependency_overrides are not compared either (only the in-process app sees the override). A JWT in a body is compared claim by claim, its exp/iat/nbf within 2 seconds (the two servers are called one after the other). The share is that of the identical and documented examples among those a test exercises over HTTP (untested, docs-only and nondeterministic ones are counted apart).
Summary
| Corpus |
Examples |
identical |
documented |
differs |
refused |
error |
untested |
docs-only |
nondeterministic |
reference-fails |
Share |
| FastAPI |
339 |
301 |
8 |
0 |
13 |
0 |
12 |
4 |
1 |
0 |
96.9 % |
| Pydantic |
238 |
227 |
3 |
0 |
8 |
0 |
0 |
0 |
0 |
0 |
96.6 % |
Bench run: discover 133.4 s, check 33.0 s, generate 321.0 s, build 2773.1 s, replay 254.1 s, sqlalchemy 653.6 s, total 4168.1 s.
Most frequent refusals
An example may be refused for several reasons; each is counted once per example.
| Construction |
Examples |
| type … |
5 |
| app.mount |
4 |
| non-constant value |
2 |
| library time |
2 |
| Enum or non-Pydantic type |
2 |
| Pydantic validator |
2 |
| route option …= |
1 |
| module-level statement |
1 |
| router of a library |
1 |
| FastAPI() option |
1 |
| library opentelemetry |
1 |
Tutorial - User Guide
Tutorial - User Guide: refused, differing and failing examples
### Response Model - Return Type
- `docs_src/response_model/tutorial003_04_py310.py` — refused: type … at `docs_src/response_model/tutorial003_04_py310.py:8`
### Static Files
- `docs_src/static_files/tutorial001_py310.py` — refused: app.mount at `docs_src/static_files/tutorial001_py310.py:6`
Advanced User Guide
Advanced User Guide: refused, differing and failing examples
### Custom Response - HTML, Stream, File, others
- `docs_src/custom_response/tutorial001_py310.py` — refused: route option …= at `docs_src/custom_response/tutorial001_py310.py:7`
### Advanced Dependencies
- `docs_src/dependencies/tutorial013_an_py310.py` — refused: library time at `docs_src/dependencies/tutorial013_an_py310.py:33`
- `docs_src/dependencies/tutorial014_an_py310.py` — refused: library time at `docs_src/dependencies/tutorial014_an_py310.py:34`
### Sub Applications - Mounts
- `docs_src/sub_applications/tutorial001_py310.py` — refused: app.mount at `docs_src/sub_applications/tutorial001_py310.py:19`
### Templates
- `docs_src/templates/tutorial001_py310.py` — refused: app.mount at `docs_src/templates/tutorial001_py310.py:8`
### OpenTelemetry
- `docs_src/opentelemetry/tutorial002_py310.py` — refused: FastAPI() option at `docs_src/opentelemetry/tutorial002_py310.py:8` (+1 more)
### Including WSGI - Flask, Django, others
- `docs_src/wsgi/tutorial001_py310.py` — refused: app.mount at `docs_src/wsgi/tutorial001_py310.py:23`
How To - Recipes
How To - Recipes: refused, differing and failing examples
### GraphQL
- `docs_src/graphql_/tutorial001_py310.py` — refused: router of a library at `docs_src/graphql_/tutorial001_py310.py:25`
### Extending OpenAPI
- `docs_src/extending_openapi/tutorial001_py310.py` — refused: module-level statement at `docs_src/extending_openapi/tutorial001_py310.py:29`
### Custom Docs UI Static Assets (Self-Hosting)
- `docs_src/custom_docs_ui/tutorial001_py310.py` — refused: non-constant value at `docs_src/custom_docs_ui/tutorial001_py310.py:22`
- `docs_src/custom_docs_ui/tutorial002_py310.py` — refused: non-constant value at `docs_src/custom_docs_ui/tutorial002_py310.py:25`
Pydantic
Pydantic: refused, differing and failing examples
### We now create an `Annotated` wrapper that we'll use as the annotation for fields on `BaseModel`s, etc.
- `docs/concepts/types.md:557` — refused: Enum or non-Pydantic type at `docs/concepts/types.md:598`
- `docs/concepts/types.md:746` — refused: type … at `docs/concepts/types.md:834`
- `docs/concepts/types.md:892` — refused: type … at `docs/concepts/types.md:946`
### this works, though
- `docs/errors/usage_errors.md:10` — refused: Enum or non-Pydantic type at `docs/errors/usage_errors.md:18`
- `docs/errors/usage_errors.md:403` — refused: Pydantic validator at `docs/errors/usage_errors.md:424`
### from Python
- `docs/errors/validation_errors.md:1664` — refused: type … at `docs/errors/validation_errors.md:1675`
- `docs/errors/validation_errors.md:182` — refused: type … at `docs/errors/validation_errors.md:189`
### V1
- `docs/migration.md:416` — refused: Pydantic validator at `docs/migration.md:424`
SQLAlchemy
The SQLAlchemy 2.1.4 documentation is run as SQLAlchemy runs it, as doctests (the units of test/base/test_tutorials.py: the Unified Tutorial, the ORM Quick Start, the ORM Querying Guide, large collections, asyncio; then other ORM, extension and Core pages, as written). Each code block that executes SQL is an example: a minimal FastAPI route runs it, preceded by the earlier statements of the page it depends on, in a session of its own, and returns what the block prints and displays. A block that only shows a SELECT for its SQL text is executed too (rows returned). Each route exists twice: sync (a Session dependency) and async (an AsyncSession with expire_on_commit=False, await on its methods). PostgreSQL, the database put back to the page's seed data before every request; the Python reference and the binary are compared as above. reference-fails: the Python reference fails on the route (mostly a lazy load under AsyncSession, which raises MissingGreenlet).
The examples are in three scopes. ORM: queries a route runs with the ORM (select, joins, aggregates, CTE, subqueries, insert/update/delete, relationships, loader options, types, extensions); its share is the one py2axum 1.0 requires (90 %). Core: the Core chapters of the Unified Tutorial (Table, text()). Outside API use: a block about DDL, reflection, events or the pool, or about a session's state across statements (identity map, expunge, pending sets), the way a script or a long-lived session works. Core and outside are measured and published, without a threshold.
| Scope / variant |
Examples |
identical |
documented |
differs |
refused |
error |
untested |
docs-only |
nondeterministic |
reference-fails |
Share |
| SQLAlchemy ORM (1.0 threshold: 90 %) |
276 |
257 |
0 |
0 |
2 |
0 |
0 |
0 |
2 |
15 |
99.2 % |
| SQLAlchemy Core (aimed at for 1.1) |
126 |
124 |
0 |
0 |
0 |
0 |
0 |
0 |
2 |
0 |
100.0 % |
| outside API use (measured only) |
78 |
44 |
0 |
0 |
32 |
0 |
0 |
0 |
0 |
2 |
57.9 % |
| sync |
239 |
221 |
0 |
0 |
16 |
0 |
0 |
0 |
2 |
0 |
93.2 % |
| async |
241 |
204 |
0 |
0 |
18 |
0 |
0 |
0 |
2 |
17 |
91.9 % |
| all of SQLAlchemy |
480 |
425 |
0 |
0 |
34 |
0 |
0 |
0 |
4 |
17 |
92.6 % |
Not in the corpus: 22 examples (both variants) the bench cannot run as written: Python fails on PostgreSQL (22) (SQLite-only SQL, a statement of the page that fails before them).
Refused and counted, though the documentation's own block is at fault: the mapping of ext/associationproxy.rst:592 imports Mapped from sqlalchemy.orm.collections, which has no such name (ImportError under SQLAlchemy 2.1.4; the doctest runner gets by with the Mapped an earlier block bound). py2axum refuses the unresolved annotation; the bench does not edit the documentation.
SQLAlchemy: most frequent refusals
| Construction |
Examples |
| sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla |
8 |
| method .from_statement() not in the runtime |
6 |
| method .columns() not in the runtime |
4 |
| sqlalchemy.orm.joinedload(): joinedload() takes exactly one positional argument here |
2 |
sqlalchemy.orm.contains_eager() |
2 |
sqlalchemy.orm.Bundle() |
2 |
| method .yield_per() not in the runtime |
2 |
| method .partitions() not in the runtime |
2 |
sqlalchemy.orm.with_expression() |
2 |
conn.run_sync(fn): only run_sync(Base.metadata.create_all) is supported (its DDL is compiled at tr |
2 |
| annotate with Mapped[...] |
2 |
SQLAlchemy: per page
SQLAlchemy: refused, differing and failing examples
#### Using SELECT Statements (`doc/build/tutorial/data_select.rst`)
- `doc/build/tutorial/data_select.rst:1239` async — refused: method .from_statement() not in the runtime at `doc/build/tutorial/data_select.rst:1239`
- `doc/build/tutorial/data_select.rst:1239` sync — refused: method .from_statement() not in the runtime at `doc/build/tutorial/data_select.rst:1239`
#### Data Manipulation with the ORM (`doc/build/tutorial/orm_data_manipulation.rst`)
- `doc/build/tutorial/orm_data_manipulation.rst:464` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/tutorial/orm_data_manipulation.rst:545` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
#### Working with ORM Related Objects (`doc/build/tutorial/orm_related_objects.rst`)
- `doc/build/tutorial/orm_related_objects.rst:243` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/tutorial/orm_related_objects.rst:490` async — refused: sqlalchemy.orm.joinedload(): joinedload() takes exactly one positional argument here at `doc/build/tutorial/orm_related_objects.rst:491`
- `doc/build/tutorial/orm_related_objects.rst:490` sync — refused: sqlalchemy.orm.joinedload(): joinedload() takes exactly one positional argument here at `doc/build/tutorial/orm_related_objects.rst:491`
- `doc/build/tutorial/orm_related_objects.rst:559` async — refused: `sqlalchemy.orm.contains_eager()` at `doc/build/tutorial/orm_related_objects.rst:560`
- `doc/build/tutorial/orm_related_objects.rst:559` sync — refused: `sqlalchemy.orm.contains_eager()` at `doc/build/tutorial/orm_related_objects.rst:560`
#### ORM Quick Start (`doc/build/orm/quickstart.rst`)
- `doc/build/orm/quickstart.rst:335` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/quickstart.rst:381` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/quickstart.rst:405` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/quickstart.rst:418` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/quickstart.rst:440` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
#### Writing SELECT statements for ORM Mapped Classes (`doc/build/orm/queryguide/select.rst`)
- `doc/build/orm/queryguide/select.rst:214` async — refused: `sqlalchemy.orm.Bundle()` at `doc/build/orm/queryguide/select.rst:215`
- `doc/build/orm/queryguide/select.rst:214` sync — refused: `sqlalchemy.orm.Bundle()` at `doc/build/orm/queryguide/select.rst:215`
- `doc/build/orm/queryguide/select.rst:325` async — refused: method .columns() not in the runtime at `doc/build/orm/queryguide/select.rst:316`
- `doc/build/orm/queryguide/select.rst:325` sync — refused: method .columns() not in the runtime at `doc/build/orm/queryguide/select.rst:316`
- `doc/build/orm/queryguide/select.rst:341` async — refused: method .columns() not in the runtime at `doc/build/orm/queryguide/select.rst:316`
- `doc/build/orm/queryguide/select.rst:341` sync — refused: method .columns() not in the runtime at `doc/build/orm/queryguide/select.rst:316`
- `doc/build/orm/queryguide/select.rst:393` async — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:400`
- `doc/build/orm/queryguide/select.rst:393` sync — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:400`
- `doc/build/orm/queryguide/select.rst:431` async — refused: method .from_statement() not in the runtime at `doc/build/orm/queryguide/select.rst:435`
- `doc/build/orm/queryguide/select.rst:431` sync — refused: method .from_statement() not in the runtime at `doc/build/orm/queryguide/select.rst:435`
- `doc/build/orm/queryguide/select.rst:774` async — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:774`
- `doc/build/orm/queryguide/select.rst:774` sync — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:774`
- `doc/build/orm/queryguide/select.rst:801` async — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:801`
- `doc/build/orm/queryguide/select.rst:801` sync — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:801`
- `doc/build/orm/queryguide/select.rst:845` async — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:838`
- `doc/build/orm/queryguide/select.rst:845` sync — refused: sqlalchemy.orm.aliased(): aliased(Model), aliased(Model, name=...), aliased(Model, subquery) and fla at `doc/build/orm/queryguide/select.rst:838`
#### ORM API Features for Querying (`doc/build/orm/queryguide/api.rst`)
- `doc/build/orm/queryguide/api.rst:211` async — the Python reference fails: `sqlalchemy.ext.asyncio.exc.AsyncMethodRequired: Can't use the AsyncSession.execute() method with a server-side cursor. Use the AsyncSession…`
- `doc/build/orm/queryguide/api.rst:229` async — refused: method .yield_per() not in the runtime at `doc/build/orm/queryguide/api.rst:230`
- `doc/build/orm/queryguide/api.rst:229` sync — refused: method .yield_per() not in the runtime at `doc/build/orm/queryguide/api.rst:230`
- `doc/build/orm/queryguide/api.rst:245` async — refused: method .partitions() not in the runtime at `doc/build/orm/queryguide/api.rst:246`
- `doc/build/orm/queryguide/api.rst:245` sync — refused: method .partitions() not in the runtime at `doc/build/orm/queryguide/api.rst:246`
#### Writing SELECT statements for Inheritance Mappings (`doc/build/orm/queryguide/inheritance.rst`)
- `doc/build/orm/queryguide/inheritance.rst:90` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/inheritance.rst:947` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
#### Column Loading Options (`doc/build/orm/queryguide/columns.rst`)
- `doc/build/orm/queryguide/columns.rst:89` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/columns.rst:129` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/columns.rst:180` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/columns.rst:225` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/columns.rst:356` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/columns.rst:507` async — the Python reference fails: `sqlalchemy.exc.StatementError: (sqlalchemy.exc.MissingGreenlet) greenlet_spawn has not been called; can't call await_() here. Was IO attemp…`
- `doc/build/orm/queryguide/columns.rst:723` async — refused: `sqlalchemy.orm.with_expression()` at `doc/build/orm/queryguide/columns.rst:724`
- `doc/build/orm/queryguide/columns.rst:723` sync — refused: `sqlalchemy.orm.with_expression()` at `doc/build/orm/queryguide/columns.rst:724`
- `doc/build/orm/queryguide/columns.rst:857` async — refused: method .from_statement() not in the runtime at `doc/build/orm/queryguide/columns.rst:869`
- `doc/build/orm/queryguide/columns.rst:857` sync — refused: method .from_statement() not in the runtime at `doc/build/orm/queryguide/columns.rst:869`
#### Asynchronous I/O (asyncio) (`doc/build/orm/extensions/asyncio.rst`)
- `doc/build/orm/extensions/asyncio.rst:63` async — refused: conn.run_sync(fn): only `run_sync(Base.metadata.create_all)` is supported (its DDL is compiled at tr at `doc/build/orm/extensions/asyncio.rst:76`
- `doc/build/orm/extensions/asyncio.rst:170` async — refused: conn.run_sync(fn): only `run_sync(Base.metadata.create_all)` is supported (its DDL is compiled at tr at `doc/build/orm/extensions/asyncio.rst:76`
#### Association Proxy (`doc/build/orm/extensions/associationproxy.rst`)
- `doc/build/orm/extensions/associationproxy.rst:592` async — refused: annotate with Mapped[...] at `doc/build/orm/extensions/associationproxy.rst:548`
- `doc/build/orm/extensions/associationproxy.rst:592` sync — refused: annotate with Mapped[...] at `doc/build/orm/extensions/associationproxy.rst:548`