Diff pydantic-1.10.13 with a pydantic-2.3.0

/usr/portage/dev-python/pydantic/pydantic-2.3.0.ebuild 2023-10-09 14:52:30.336368371 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
DISTUTILS_EXT=1
7
DISTUTILS_USE_PEP517=setuptools
8
PYTHON_COMPAT=( pypy3 python3_{10..12} )
6
DISTUTILS_USE_PEP517=hatchling
7
PYTHON_COMPAT=( python3_{10..12} )
9 8

  
10
inherit distutils-r1
9
inherit distutils-r1 pypi
11 10

  
12
MY_P=${P/_beta/b}
13 11
DESCRIPTION="Data parsing and validation using Python type hints"
14 12
HOMEPAGE="
15 13
	https://github.com/pydantic/pydantic/
16 14
	https://pypi.org/project/pydantic/
17 15
"
18
SRC_URI="
19
	https://github.com/pydantic/pydantic/archive/v${PV/_beta/b}.tar.gz
20
		-> ${MY_P}.gh.tar.gz
21
"
22
S=${WORKDIR}/${MY_P}
23 16

  
24 17
LICENSE="MIT"
25 18
SLOT="0"
26
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
27
IUSE="native-extensions"
19
KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 ~s390 ~sparc x86"
28 20

  
29 21
RDEPEND="
30
	>=dev-python/typing-extensions-4.1.0[${PYTHON_USEDEP}]
22
	>=dev-python/annotated-types-0.4.0[${PYTHON_USEDEP}]
23
	~dev-python/pydantic-core-2.6.3[${PYTHON_USEDEP}]
24
	>=dev-python/typing-extensions-4.6.1[${PYTHON_USEDEP}]
31 25
"
32 26
BDEPEND="
33
	native-extensions? (
34
		<dev-python/cython-3[${PYTHON_USEDEP}]
35
	)
27
	>=dev-python/hatch-fancy-pypi-readme-22.5.0[${PYTHON_USEDEP}]
36 28
	test? (
37
		>=dev-python/email-validator-1.2.1[${PYTHON_USEDEP}]
38
		dev-python/hypothesis[${PYTHON_USEDEP}]
29
		dev-python/dirty-equals[${PYTHON_USEDEP}]
30
		>=dev-python/email-validator-2.0.0[${PYTHON_USEDEP}]
31
		>=dev-python/Faker-18.13.0[${PYTHON_USEDEP}]
39 32
		dev-python/pytest-mock[${PYTHON_USEDEP}]
40
		dev-python/python-dotenv[${PYTHON_USEDEP}]
41 33
	)
42 34
"
43 35

  
44 36
distutils_enable_tests pytest
45 37

  
46 38
src_prepare() {
47
	sed -i -e '/CFLAGS/d' setup.py || die
39
	sed -i -e '/benchmark/d' pyproject.toml || die
48 40
	distutils-r1_src_prepare
49 41
}
50 42

  
51
python_compile() {
52
	if [[ ${EPYTHON} == pypy3 ]] || ! use native-extensions; then
53
		# do not build extensions on PyPy to workaround
54
		# https://github.com/cython/cython/issues/4763
55
		local -x SKIP_CYTHON=1
56
	fi
57
	distutils-r1_python_compile
58
}
59

  
60 43
python_test() {
61
	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
62
	local -x PYTEST_PLUGINS=pytest_mock
63

  
64
	local EPYTEST_DESELECT=(
65
		# flaky test, known upstream
66
		tests/test_hypothesis_plugin.py::test_can_construct_models_with_all_fields
67
		# mypy linting causes regressions with new mypy versions
68
		tests/mypy
44
	local EPYTEST_DESELECT=()
45
	local EPYTEST_IGNORE=(
46
		# require pytest-examples
47
		tests/test_docs.py
48
		# benchmarks
49
		tests/benchmarks
69 50
	)
70 51
	case ${EPYTHON} in
71
		pypy3)
72
			EPYTEST_DESELECT+=(
73
				tests/test_private_attributes.py::test_private_attribute
74
				tests/test_private_attributes.py::test_private_attribute_annotation
75
				tests/test_private_attributes.py::test_private_attribute_factory
76
				tests/test_private_attributes.py::test_private_attribute_multiple_inheritance
77
				tests/test_private_attributes.py::test_underscore_attrs_are_private
78
			)
79
			;;
80 52
		python3.12)
81 53
			EPYTEST_DESELECT+=(
82 54
				tests/test_abc.py::test_model_subclassing_abstract_base_classes_without_implementation_raises_exception
55
				tests/test_computed_fields.py::test_abstractmethod_missing
56
				tests/test_edge_cases.py::test_abstractmethod_missing_for_all_decorators
83 57
				tests/test_generics.py::test_partial_specification_name
84
				tests/test_generics.py::test_parse_generic_json
85
				tests/test_types.py::test_secretfield
58
				tests/test_model_signature.py::test_annotated_field
86 59
			)
87 60
			;;
88 61
	esac
89
	rm -rf pydantic || die
90
	epytest
62

  
63
	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
64
	epytest -p pytest_mock
91 65
}
Thank you!