devel/py-eval-type-backport: Add py-eval-type-backport 0.2.2

eval_type_backport is a tiny package providing a replacement for
typing._eval_type to support newer typing features in older Python versions.

Yes, that's very specific, and yes, typing._eval_type is a protected function
that you shouldn't normally be using. Really this package is specifically made
for pydantic/pydantic#7873.

Specifically, this transforms X | Y into typing.Union[X, Y] and list[X] into
typing.List[X] etc. (for all the types made generic in PEP 585) if the original
syntax is not supported in the current Python version.
This commit is contained in:
Po-Chuan Hsieh 2025-05-18 11:14:42 +08:00
parent 8c0998547e
commit 72e50977a6
No known key found for this signature in database
GPG Key ID: 9A4BD10F002DD04B
4 changed files with 38 additions and 0 deletions

View File

@ -4853,6 +4853,7 @@
SUBDIR += py-etcd3gw
SUBDIR += py-etils
SUBDIR += py-etuples
SUBDIR += py-eval-type-backport
SUBDIR += py-evdev
SUBDIR += py-eventlib
SUBDIR += py-ewah-bool-utils

View File

@ -0,0 +1,24 @@
PORTNAME= eval-type-backport
PORTVERSION= 0.2.2
CATEGORIES= devel python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
DISTNAME= eval_type_backport-${PORTVERSION}
MAINTAINER= sunpoet@FreeBSD.org
COMMENT= Like typing._eval_type, but lets older Python versions use newer typing features
WWW= https://github.com/alexmojaki/eval_type_backport
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}setuptools-scm>=0:devel/py-setuptools-scm@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
USES= python
USE_PYTHON= autoplist concurrent pep517
NO_ARCH= yes
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1745936006
SHA256 (eval_type_backport-0.2.2.tar.gz) = f0576b4cf01ebb5bd358d02314d31846af5e07678387486e2c798af0e7d849c1
SIZE (eval_type_backport-0.2.2.tar.gz) = 9079

View File

@ -0,0 +1,10 @@
eval_type_backport is a tiny package providing a replacement for
typing._eval_type to support newer typing features in older Python versions.
Yes, that's very specific, and yes, typing._eval_type is a protected function
that you shouldn't normally be using. Really this package is specifically made
for pydantic/pydantic#7873.
Specifically, this transforms X | Y into typing.Union[X, Y] and list[X] into
typing.List[X] etc. (for all the types made generic in PEP 585) if the original
syntax is not supported in the current Python version.