Skip to main content

No project description provided

Project description

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')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_expost-0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_expost-0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_expost-0.1.tar.gz.

File metadata

  • Download URL: pydantic_expost-0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for pydantic_expost-0.1.tar.gz
Algorithm Hash digest
SHA256 2103222ddc9d7da4fed77665d97d1787d3504225a0b91e7255d0a0c76a1d39e4
MD5 b00dfc09e9056fb65f325ccb2d4dbad3
BLAKE2b-256 cfddc18252ee4ce59eff931e7ccaa169e735298e8ce0fd23e12ae35528067d1a

See more details on using hashes here.

File details

Details for the file pydantic_expost-0.1-py3-none-any.whl.

File metadata

  • Download URL: pydantic_expost-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for pydantic_expost-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54d12c2a27337ce93f9be6fa25605ecc42a080beb6d6ce2cac66731b519d51f7
MD5 7de0322bd970bfc19aa5c236e65aa0c5
BLAKE2b-256 997f49b7045ec7ef9528f0c9d4d9bdab21bab14428d730bf32780b5b24ef0699

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page