diff options
| author | Bobby <[email protected]> | 2026-07-16 14:21:24 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-16 14:21:24 +0530 |
| commit | b9914de793844d3ad6e2d7503209ac8fd339d6de (patch) | |
| tree | ede1621e0daf6e15706595fb905c0fbc91f26dfd /tests/pattern/composition.test.py | |
| parent | 433d41bf5887e61cc570a874e244e226c25b8a41 (diff) | |
| parent | 453aea2b3ec5ae941407ac781ede7e4efda43ae8 (diff) | |
| download | edify-b9914de793844d3ad6e2d7503209ac8fd339d6de.tar.xz edify-b9914de793844d3ad6e2d7503209ac8fd339d6de.zip | |
feat(integrations): pydantic, fastapi, django integration modules as opt-in extras (#284)
Ships the framework-integrations bundle end to end so an
:class:`edify.Pattern` can drop straight into the field-validation
layers of the three Python frameworks most teams actually use.
## Integration modules
- **`edify.integrations.pydantic`** — `pattern_validator(pattern)`
returns a Pydantic-compatible validator callable;
`pattern_field(pattern)` returns an `Annotated[str,
AfterValidator(...)]` type you drop into a `BaseModel` field.
- **`edify.integrations.fastapi`** — `pattern_query(pattern, ...)` and
`pattern_path(pattern, ...)` return `fastapi.Query` / `fastapi.Path`
values pinned to the pattern's emitted regex string, with `default=` and
every other FastAPI kwarg forwarded through.
- **`edify.integrations.django`** — `pattern_validator(pattern,
message=..., code=...)` returns a
`django.core.validators.RegexValidator` pinned to the pattern's regex
source, with the message default derived from the pattern.
Every integration follows the same deferred-import pattern that
`edify[regex]` uses: `import edify.integrations.pydantic` (etc.)
succeeds without the framework installed; the first helper call resolves
the framework lazily and raises `MissingIntegrationDependencyError`
(annotated summary + pointer block + `= note:` + `help:` line) telling
the caller to `pip install edify[<framework>]`.
## Extras + optional-dependencies
- `[project.optional-dependencies]` gains `pydantic =
["pydantic>=2.0"]`, `fastapi = ["fastapi>=0.100"]`, `django =
["django>=4.2"]`, and `all = [everything]`.
- The `dev` group installs all three frameworks so local + CI runs cover
the integrations without gating on the extras.
## CI install-per-extra verification
- New matrix job `install-with-integration-extra` runs one entry per
extra (`pydantic`, `fastapi`, `django`, `all`).
- Each entry installs into a fresh venv, imports the integration module,
and drives a small probe script that verifies the helper accepts a
matching value and rejects a non-matching value.
- Same shape as the existing `install: edify[regex]` verification — any
drift in the `[project.optional-dependencies]` declarations fails
loudly.
## Sphinx autodoc
- New `docs/integrations/index.rst` page with `.. automodule::` blocks
for each of the three integration modules.
- Wired into `docs/index.rst` toctree.
- `.readthedocs.yml` installs `.[all]` so autodoc always has every
framework annotation available to resolve.
Closes #220, closes #221, closes #222, closes #223, closes #224, closes
#225, closes #226, closes #227.
Diffstat (limited to 'tests/pattern/composition.test.py')
0 files changed, 0 insertions, 0 deletions
