pydantic-expost
from __future__ import annotations # py 3.13-
from typing import Any, Self
from pydantic import validate_call, ConfigDict
from pydantic_expost import validate_call_expost
c = ConfigDict(arbitrary_types_allowed=True, validate_return=True)
try:
@validate_call(config=c)
def f(a: A, b: B) -> tuple[A, B]:
return a, b
except:
print('validate_call(f) --> raise')
@validate_call_expost(config=c)
def f(a: A, b: B) -> tuple[A, B]:
return a, b
print('validate_call_expost(f) --> ok')
class A:
try:
@validate_call(config=c)
def b(self: Any, b: B) -> Any:
...
except:
print('validate_call(A.b) --> raise')
@validate_call_expost(config=c)
def b(self: Any, b: B) -> Any:
...
print('validate_call_expost(A.b) --> ok')
class B:
...
f(A(), B())
print('f(A(), B()) --> ok')
try:
f(B(), A()) # raise
except:
print('f(B(), A()) --> raise')
A().b(B())
print('A().b(B()) --> ok')
A.b('A', B())
print('A.b("A", B()) --> ok !')
try:
A().b('B')
except:
print('A().b("B") --> raise')
Metadata
Release files for pydantic-expost 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydantic_expost-0.2.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_expost-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / pydantic_expost-0.2.tar.gz
| Download URL | pydantic_expost-0.2.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8e0bb9782cf55f5b4c753e0e836855acbbf883fb2ec10435d9fd499e86b34f6
|
|
BLAKE2b-256 checksum How to use checksums |
cdba4323b360278e9cb6335226cfd00fc7f7c810dbef873acceb2ab4adf158c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.0
|
Release files / pydantic_expost-0.2-py3-none-any.whl
| Download URL | pydantic_expost-0.2-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
339df87c6b219ac695ced4331e5865e55e2b55cf4025153dcd731ad8b54ecd8a
|
|
BLAKE2b-256 checksum How to use checksums |
608d02f037ce430bff03b18793a46f5167ffa3aa179ae2d75f7672b4e8221568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.0
|