Skip to main content

CI codecov

pydantic-ext

This addons provides a new type used to declare Pydantic model as Extendable class.

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.dict() == {"lat": 12.3, "lng": 13.2, "name": "My Loc"}
#> True

loc.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']}

Development

pip install -e .

Then, copy extendable_pydantic_patcher.pth to $VIRTUAL_ENV/lib/python3.10/site-packages.

Release

  • Tag the sources: git tag x.y.z
  • Build the package: hatch build
  • Publish to pypi: twine upload dist/*

Metadata

Release files for extendable-pydantic 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for extendable-pydantic 0.0.5
File Size Uploaded
extendable_pydantic-0.0.5.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for extendable-pydantic 0.0.5
File Interpreter ABI Platform
extendable_pydantic-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / extendable_pydantic-0.0.5.tar.gz

Download URL extendable_pydantic-0.0.5.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8c1c07caadeb270574621c713b3c219b7d737d90b0b1a2477355a20b530b9bff
BLAKE2b-256 checksum
How to use checksums
e383a9beb52de2b8c33abdf95577118cbd4e48d95469bf170d54b4842b3d07ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / extendable_pydantic-0.0.5-py3-none-any.whl

Download URL extendable_pydantic-0.0.5-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c19e03f6526158b9dc65541d6fcf3578955735b53eb6c038bb80ef176f39cb7b
BLAKE2b-256 checksum
How to use checksums
8c8599ddf7eb1a324139fec6d05ce1bca8e06f130cc2c487f16fb3a820be3017
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release history Release notifications | RSS feed

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page