Extendable Pydantic
This addons provides a new type used to declare Pydantic model as Extendable class.
From release 1.0.0 it only supports Pydantic >= 2.0.0.
from pydantic import BaseModel
from extendable_pydantic import ExtendableModelMeta
from extendable import context, registry
class Location(BaseModel, metaclass=ExtendableModelMeta):
lat = 0.1
lng = 10.1
class ExtendedLocation(Location, extends=Location):
name: str
_registry = registry.ExtendableClassesRegistry()
context.extendable_registry.set(_registry)
_registry.init_registry()
loc = Location(**{"lat": 12.3, "lng": 13.2, "name": "My Loc"})
loc.model_dump() == {"lat": 12.3, "lng": 13.2, "name": "My Loc"}
#> True
loc.model_json_schema()
#> {'title': 'Location', 'type': 'object', 'properties': {'lat': {'title': 'Lat', 'default': 0.1, 'type': 'number'}, 'lng': {'title': 'Lng', 'default': 10.1, 'type': 'number'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['name']}
Usage with FastAPI
Extendable models can be used as request and response models or as dependencies
of FastAPI routes. Any reference to an extendable model is resolved to the final
class of the current registry when pydantic builds the schema. Therefore, the
routes must be added to the application (app.include_router(...)) once the
registry is initialized.
Requires FastAPI >= 0.138.
Development
pip install -e .
Release
The version of the package is computed from the git tags (hatch-vcs) and the changelog is built from the news fragments (towncrier).
- Each change worth mentioning into the changelog comes with a news fragment
into the
newsdirectory:news/<issue number>.<type>, ornews/+<name>.<type>for a change without issue, where<type>is one offeature,bugfix,doc,removalormisc. - To release a new version, run the
releaseworkflow from the GitHub "Actions" tab and choose the part of the version to increase (patch,minorormajor). Once the run is approved (required reviewers of therelease-approvalenvironment), the workflow updatesHISTORY.rst, tags the release, publishes the package to PyPI and creates the GitHub release.
Metadata
Release files for extendable-pydantic 1.5.0
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 | |
|---|---|---|---|---|
| extendable_pydantic-1.5.0.tar.gz | 7.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| extendable_pydantic-1.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / extendable_pydantic-1.5.0.tar.gz
| Download URL | extendable_pydantic-1.5.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39bd1d484deb932f381dc5468ba95ba190e5fe3a3a30d90411335536e9f0cb12
|
|
BLAKE2b-256 checksum How to use checksums |
ce89fe9baee852af57ac430c4f12f6671ea03725f6c01ebd01f1cbfe115aede9
|
| 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 23, 2026.
Transparency logRelease files / extendable_pydantic-1.5.0-py3-none-any.whl
| Download URL | extendable_pydantic-1.5.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28002c187b83ea561896e4ccc30fecba7439f754c5f9d344777fb5a732d19e93
|
|
BLAKE2b-256 checksum How to use checksums |
7a26ca30c0f70c6605676e178e658c00479c119095f871eef42f388a4a958400
|
| 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 23, 2026.
Transparency logSecurity for extendable-pydantic 1.5.0
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 extendable_pydantic-1.5.0.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 23, 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.