PKGBUILDs/extra/python-pydantic/PKGBUILD
2023-12-02 00:25:55 +00:00

86 lines
2.8 KiB
Bash

# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# remove when bumped upstream
_name=pydantic
pkgname=python-$_name
# WARNING: upstream pins pydantic-core down to the patch-level and using other versions breaks tests! only update in lock-step with python-pydantic-core!
pkgver=2.5.2
pkgrel=1
pkgdesc='Data parsing and validation using Python type hints'
arch=(any)
url="https://github.com/pydantic/pydantic"
license=(MIT)
depends=(
python
python-annotated-types
python-pydantic-core
python-typing-extensions
)
makedepends=(
cython
python-build
python-installer
python-importlib-metadata
python-hatchling
python-hatch-fancy-pypi-readme
python-wheel
)
checkdepends=(
python-ansi2html
python-cloudpickle
python-devtools
python-dirty-equals
python-email-validator
python-faker
python-hypothesis
python-pygments
python-pytest
python-pytest-benchmark
python-pytest-examples
python-pytest-mock
python-sqlalchemy
)
optdepends=(
'mypy: for type validation with mypy'
'python-dotenv: for .env file support'
'python-email-validator: for email validation'
'python-hypothesis: for hypothesis plugin when using legacy v1'
)
source=($url/archive/v$pkgver/$_name-v$pkgver.tar.gz)
sha512sums=('e5b156387d3ac569dc61b8fc13f3996b4abd5d0fd8b5a0e5d041c2b52c5bb3ec253d74b95557ebd317da8ddc315608c839b580e2011ea180ed30020fab1204b5')
b2sums=('2f4a55870d18e5e01621a0f017b960ce1887b78adef57d0a91361c0553dbf8d64c2256f6f2ce1bb35e1592333295a7b996b077d774c8b35f299eef3ebc85d60b')
build() {
cd $_name-$pkgver
python -m build --wheel --no-isolation
}
check() {
local pytest_options=(
# disable broken tests: https://github.com/pydantic/pydantic/issues/8180
--deselect tests/benchmarks/test_north_star.py::test_north_star_validate_json
--deselect tests/benchmarks/test_north_star.py::test_north_star_validate_json_strict
--deselect tests/benchmarks/test_north_star.py::test_north_star_dump_json
--deselect tests/benchmarks/test_north_star.py::test_north_star_validate_python
--deselect tests/benchmarks/test_north_star.py::test_north_star_validate_python_strict
--deselect tests/benchmarks/test_north_star.py::test_north_star_dump_python
--deselect tests/benchmarks/test_north_star.py::test_north_star_json_loads
--deselect tests/benchmarks/test_north_star.py::test_north_star_json_dumps
-vv
)
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
cd $_name-$pkgver
# install to temporary location, as importlib is used
python -m installer --destdir=test_dir dist/*.whl
export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
pytest "${pytest_options[@]}"
}
package() {
cd $_name-$pkgver
python -m installer --destdir="$pkgdir" dist/*.whl
install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}