# Contributor: Steven Guikal <void@fluix.one>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=py3-fastapi
pkgver=0.115.12
pkgrel=0
pkgdesc="Modern, high-performance, web framework for building APIs based on standard Python type hints"
url="https://github.com/tiangolo/fastapi"
arch="noarch"
license="MIT"
depends="
	py3-pydantic
	py3-starlette
	"
makedepends="
	py3-gpep517
	py3-installer
	py3-pdm-backend
	"
checkdepends="
	py3-aiosqlite
	py3-anyio
	py3-databases
	py3-dirty-equals
	py3-email-validator
	py3-flask
	py3-httpx
	py3-inline-snapshot
	py3-jwt
	py3-orjson
	py3-passlib
	py3-pytest
	py3-pydantic-settings
	py3-python-jose
	py3-python-multipart
	py3-sqlalchemy
	py3-trio
	py3-ujson
	py3-yaml
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tiangolo/fastapi/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/fastapi-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages testenv
	testenv/bin/python3 -m installer .dist/*.whl

	# The deselected test wants to run fastapi cli from $PATH or depend on sqlmodel which itself checkdepends on fastapi. That would cause a cyclic dependency.
	testenv/bin/python3 -m pytest \
		--deselect tests/test_fastapi_cli.py::test_fastapi_cli \
		--ignore tests/test_tutorial/test_sql_databases/test_tutorial001.py \
		--ignore tests/test_tutorial/test_sql_databases/test_tutorial002.py \
		--ignore tests/test_tutorial/test_custom_request_and_route/test_tutorial002.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
bf98bd6e20207fbcba0ab823de7d7416acf631a2661c8fadbe9da73baf7b3751f45044eea3fe6ef393b00f9d6a7b1462b44560ef99ae328919cd78234ee13197  py3-fastapi-0.115.12.tar.gz
"
