[packages/python3-uvicorn] - new

qboosh qboosh at pld-linux.org
Wed Jan 14 19:40:46 CET 2026


commit 21d951d4bef97f6ef5b7bbb4b1a9f2409c305c73
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jan 14 19:40:39 2026 +0100

    - new

 python3-uvicorn.spec     | 124 +++++++++++++++++++++++++++++++++++++++++++++++
 uvicorn-websockets.patch |  57 ++++++++++++++++++++++
 2 files changed, 181 insertions(+)
---
diff --git a/python3-uvicorn.spec b/python3-uvicorn.spec
new file mode 100644
index 0000000..21088d7
--- /dev/null
+++ b/python3-uvicorn.spec
@@ -0,0 +1,124 @@
+#
+# Conditional build:
+%bcond_with	doc	# mkdocs documentation (not in sdist)
+%bcond_without	tests	# unit tests
+
+Summary:	An ASGI web server, for Python
+Summary(pl.UTF-8):	Serwer WWW ASGI dla Pythona
+Name:		python3-uvicorn
+Version:	0.40.0
+Release:	1
+License:	BSD
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/uvicorn/
+Source0:	https://files.pythonhosted.org/packages/source/u/uvicorn/uvicorn-%{version}.tar.gz
+# Source0-md5:	9f7303c20d72660dc37ac54d697d0881
+Patch0:		uvicorn-websockets.patch
+URL:		https://uvicorn.dev/
+BuildRequires:	python3-build
+BuildRequires:	python3-hatchling
+BuildRequires:	python3-installer
+BuildRequires:	python3-modules >= 1:3.10
+%if %{with tests}
+BuildRequires:	python3-PyYAML >= 5.1
+BuildRequires:	python3-a2wsgi >= 1.10.8
+BuildRequires:	python3-click >= 7.0
+BuildRequires:	python3-cryptography >= 44.0.3
+BuildRequires:	python3-dotenv >= 0.13
+BuildRequires:	python3-h11 >= 0.8
+BuildRequires:	python3-httptools >= 0.6.3
+BuildRequires:	python3-httpx >= 0.28.1
+BuildRequires:	python3-psutil >= 3.0
+BuildRequires:	python3-pytest >= 8.3.5
+BuildRequires:	python3-pytest-mock >= 3.14.0
+BuildRequires:	python3-pytest-xdist >= 3.6.1
+BuildRequires:	python3-trustme >= 1.2.1
+%if "%{py3_ver}" == "3.10"
+BuildRequires:	python3-typing_extensions >= 4.0
+%endif
+BuildRequires:	python3-uvloop >= 0.15.1
+BuildRequires:	python3-watchfiles >= 0.13
+BuildRequires:	python3-websockets >= 13.1
+BuildRequires:	python3-wsproto >= 1.2.0
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 2.044
+%if %{with doc}
+BuildRequires:	python3-mkdocs >= 1.6.1
+BuildRequires:	python3-mkdocs-llmstxt >= 0.4.0
+BuildRequires:	python3-mkdocs-material >= 9.6.21
+BuildRequires:	python3-mkdocstrings-python >= 1.18.2
+%endif
+Requires:	python3-modules >= 1:3.10
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Uvicorn is an ASGI web server implementation for Python.
+
+Until recently Python has lacked a minimal low-level
+server/application interface for async frameworks. The ASGI
+specification fills this gap, and means we're now able to start
+building a common set of tooling usable across all async frameworks.
+
+Uvicorn supports HTTP/1.1 and WebSockets.
+
+%description -l pl.UTF-8
+Uvicorn to implementacja sersera WWW ASGI dla Pythona.
+
+Do niedawna Pythonowi brakowało minimalnego niskopoziomowego
+interfejsu serwera/aplikacji dla szkieletów asynchronicznych.
+Specyfikacja ASGI wypełnia tę lukę, co oznacza, że teraz można
+zacząć tworzenie wspólnego zbioru narzędzi, nadających się do użycia
+ze wszystkimi szkieletami asynchronicznymi.
+
+Uvicorn obsługuje HTTP/1.1 oraz WebSockets.
+
+%package apidocs
+Summary:	API documentation for Python uvicorn module
+Summary(pl.UTF-8):	Dokumentacja API modułu Pythona uvicorn
+Group:		Documentation
+
+%description apidocs
+API documentation for Python uvicorn module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona uvicorn.
+
+%prep
+%setup -q -n uvicorn-%{version}
+%patch -P0 -p1
+
+%build
+%py3_build_pyproject
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS=anyio.pytest_plugin,pytest_mock.plugin,xdist.plugin \
+%{__python3} -m pytest tests
+%endif
+
+%if %{with doc}
+%{__python3} -m mkdocs ...
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install_pyproject
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE.md README.md
+%attr(755,root,root) %{_bindir}/uvicorn
+%{py3_sitescriptdir}/uvicorn
+%{py3_sitescriptdir}/uvicorn-%{version}.dist-info
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/*
+%endif
diff --git a/uvicorn-websockets.patch b/uvicorn-websockets.patch
new file mode 100644
index 0000000..b18576a
--- /dev/null
+++ b/uvicorn-websockets.patch
@@ -0,0 +1,57 @@
+InvalidStatusCode is deprecated in websockets>=14
+--- uvicorn-0.40.0/tests/protocols/test_websocket.py.orig	2020-02-02 01:00:00.000000000 +0100
++++ uvicorn-0.40.0/tests/protocols/test_websocket.py	2026-01-14 19:05:01.820212062 +0100
+@@ -399,7 +399,7 @@ async def test_missing_handshake(ws_prot
+ 
+     config = Config(app=app, ws=ws_protocol_cls, http=http_protocol_cls, lifespan="off", port=unused_tcp_port)
+     async with run_server(config):
+-        with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info:
++        with pytest.raises(websockets.exceptions.InvalidHandshake) as exc_info:
+             await connect(f"ws://127.0.0.1:{unused_tcp_port}")
+         assert exc_info.value.status_code == 500
+ 
+@@ -415,7 +415,7 @@ async def test_send_before_handshake(
+ 
+     config = Config(app=app, ws=ws_protocol_cls, http=http_protocol_cls, lifespan="off", port=unused_tcp_port)
+     async with run_server(config):
+-        with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info:
++        with pytest.raises(websockets.exceptions.InvalidHandshake) as exc_info:
+             await connect(f"ws://127.0.0.1:{unused_tcp_port}")
+         assert exc_info.value.status_code == 500
+ 
+@@ -772,7 +772,7 @@ async def test_server_reject_connection(
+         disconnected_message = await receive()
+ 
+     async def websocket_session(url: str):
+-        with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info:
++        with pytest.raises(websockets.exceptions.InvalidHandshake) as exc_info:
+             async with websockets.client.connect(url):
+                 pass  # pragma: no cover
+         assert exc_info.value.status_code == 403
+@@ -945,7 +945,7 @@ async def test_server_reject_connection_
+         await send(message)
+ 
+     async def websocket_session(url: str):
+-        with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info:
++        with pytest.raises(websockets.exceptions.InvalidHandshake) as exc_info:
+             async with websockets.client.connect(url):
+                 pass  # pragma: no cover
+         assert exc_info.value.status_code == 404
+@@ -979,7 +979,7 @@ async def test_server_reject_connection_
+         # no further message
+ 
+     async def websocket_session(url: str):
+-        with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info:
++        with pytest.raises(websockets.exceptions.InvalidHandshake) as exc_info:
+             async with websockets.client.connect(url):
+                 pass  # pragma: no cover
+         assert exc_info.value.status_code == 404
+@@ -1022,7 +1022,7 @@ async def test_server_multiple_websocket
+             exception_message = str(exc)
+ 
+     async def websocket_session(url: str):
+-        with pytest.raises(websockets.exceptions.InvalidStatusCode) as exc_info:
++        with pytest.raises(websockets.exceptions.InvalidHandshake) as exc_info:
+             async with websockets.client.connect(url):
+                 pass  # pragma: no cover
+         assert exc_info.value.status_code == 404
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-uvicorn.git/commitdiff/21d951d4bef97f6ef5b7bbb4b1a9f2409c305c73



More information about the pld-cvs-commit mailing list