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.2.tar.gz (3.0 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.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydantic_expost-0.2.tar.gz
  • Upload date:
  • Size: 3.0 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.2.tar.gz
Algorithm Hash digest
SHA256 b8e0bb9782cf55f5b4c753e0e836855acbbf883fb2ec10435d9fd499e86b34f6
MD5 0d8bf98352873c5fc5d5d3ed6a8e0821
BLAKE2b-256 cdba4323b360278e9cb6335226cfd00fc7f7c810dbef873acceb2ab4adf158c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantic_expost-0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 339df87c6b219ac695ced4331e5865e55e2b55cf4025153dcd731ad8b54ecd8a
MD5 b81b01c595d95f0380dd0e540024c008
BLAKE2b-256 608d02f037ce430bff03b18793a46f5167ffa3aa179ae2d75f7672b4e8221568

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