commit
27eba54973
@ -0,0 +1 @@
|
|||||||
|
SOURCES/uvicorn-0.29.0.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
1c38932605b22dd5fbf0a164302b6520450b7743 SOURCES/uvicorn-0.29.0.tar.gz
|
@ -0,0 +1,169 @@
|
|||||||
|
From 95fa1ac6180baab692bdb77ef66a0c18ce394272 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
|
Date: Sat, 13 Apr 2024 10:19:09 +0200
|
||||||
|
Subject: [PATCH] Bump httpx to 0.27.0 (#2288)
|
||||||
|
|
||||||
|
* Stop using deprecated app shortcut in httpx.AsyncClient
|
||||||
|
|
||||||
|
This keyword parameter has been deprecated with httpx 0.27
|
||||||
|
|
||||||
|
* Bump httpx to 0.27.0
|
||||||
|
|
||||||
|
* Reformat with newest ruff
|
||||||
|
---
|
||||||
|
requirements.txt | 2 +-
|
||||||
|
tests/middleware/test_message_logger.py | 8 ++++----
|
||||||
|
tests/middleware/test_proxy_headers.py | 9 ++++++---
|
||||||
|
tests/middleware/test_wsgi.py | 23 ++++++++---------------
|
||||||
|
tools/cli_usage.py | 4 +---
|
||||||
|
5 files changed, 20 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/requirements.txt b/requirements.txt
|
||||||
|
index 316167f4c..58e2542ad 100644
|
||||||
|
--- a/requirements.txt
|
||||||
|
+++ b/requirements.txt
|
||||||
|
@@ -24,7 +24,7 @@ trustme==1.1.0
|
||||||
|
cryptography==42.0.4
|
||||||
|
coverage==7.4.1
|
||||||
|
coverage-conditional-plugin==0.9.0
|
||||||
|
-httpx==0.26.0
|
||||||
|
+httpx==0.27.0
|
||||||
|
watchgod==0.8.2
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
diff --git a/tests/middleware/test_message_logger.py b/tests/middleware/test_message_logger.py
|
||||||
|
index 3f5c3af2d..db307b326 100644
|
||||||
|
--- a/tests/middleware/test_message_logger.py
|
||||||
|
+++ b/tests/middleware/test_message_logger.py
|
||||||
|
@@ -17,8 +17,8 @@ async def app(scope, receive, send):
|
||||||
|
caplog.set_level(TRACE_LOG_LEVEL, logger="uvicorn.asgi")
|
||||||
|
caplog.set_level(TRACE_LOG_LEVEL)
|
||||||
|
|
||||||
|
- app = MessageLoggerMiddleware(app)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(MessageLoggerMiddleware(app)) # type: ignore
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
response = await client.get("/")
|
||||||
|
assert response.status_code == 200
|
||||||
|
messages = [record.msg % record.args for record in caplog.records]
|
||||||
|
@@ -37,8 +37,8 @@ async def app(scope, receive, send):
|
||||||
|
with caplog_for_logger(caplog, "uvicorn.asgi"):
|
||||||
|
caplog.set_level(TRACE_LOG_LEVEL, logger="uvicorn.asgi")
|
||||||
|
caplog.set_level(TRACE_LOG_LEVEL)
|
||||||
|
- app = MessageLoggerMiddleware(app)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(MessageLoggerMiddleware(app)) # type: ignore
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
with pytest.raises(RuntimeError):
|
||||||
|
await client.get("/")
|
||||||
|
messages = [record.msg % record.args for record in caplog.records]
|
||||||
|
diff --git a/tests/middleware/test_proxy_headers.py b/tests/middleware/test_proxy_headers.py
|
||||||
|
index 6d7fc8c23..81e559944 100644
|
||||||
|
--- a/tests/middleware/test_proxy_headers.py
|
||||||
|
+++ b/tests/middleware/test_proxy_headers.py
|
||||||
|
@@ -49,7 +49,8 @@ async def app(
|
||||||
|
)
|
||||||
|
async def test_proxy_headers_trusted_hosts(trusted_hosts: list[str] | str, response_text: str) -> None:
|
||||||
|
app_with_middleware = ProxyHeadersMiddleware(app, trusted_hosts=trusted_hosts)
|
||||||
|
- async with httpx.AsyncClient(app=app_with_middleware, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(app=app_with_middleware) # type: ignore
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
headers = {"X-Forwarded-Proto": "https", "X-Forwarded-For": "1.2.3.4"}
|
||||||
|
response = await client.get("/", headers=headers)
|
||||||
|
|
||||||
|
@@ -79,7 +80,8 @@ async def test_proxy_headers_trusted_hosts(trusted_hosts: list[str] | str, respo
|
||||||
|
)
|
||||||
|
async def test_proxy_headers_multiple_proxies(trusted_hosts: list[str] | str, response_text: str) -> None:
|
||||||
|
app_with_middleware = ProxyHeadersMiddleware(app, trusted_hosts=trusted_hosts)
|
||||||
|
- async with httpx.AsyncClient(app=app_with_middleware, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(app=app_with_middleware) # type: ignore
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
headers = {
|
||||||
|
"X-Forwarded-Proto": "https",
|
||||||
|
"X-Forwarded-For": "1.2.3.4, 10.0.2.1, 192.168.0.2",
|
||||||
|
@@ -93,7 +95,8 @@ async def test_proxy_headers_multiple_proxies(trusted_hosts: list[str] | str, re
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_proxy_headers_invalid_x_forwarded_for() -> None:
|
||||||
|
app_with_middleware = ProxyHeadersMiddleware(app, trusted_hosts="*")
|
||||||
|
- async with httpx.AsyncClient(app=app_with_middleware, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(app=app_with_middleware) # type: ignore
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
headers = httpx.Headers(
|
||||||
|
{
|
||||||
|
"X-Forwarded-Proto": "https",
|
||||||
|
diff --git a/tests/middleware/test_wsgi.py b/tests/middleware/test_wsgi.py
|
||||||
|
index adc8e241a..478dd84b3 100644
|
||||||
|
--- a/tests/middleware/test_wsgi.py
|
||||||
|
+++ b/tests/middleware/test_wsgi.py
|
||||||
|
@@ -59,8 +59,8 @@ def wsgi_middleware(request: pytest.FixtureRequest) -> Callable:
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_wsgi_get(wsgi_middleware: Callable) -> None:
|
||||||
|
- app = wsgi_middleware(hello_world)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(wsgi_middleware(hello_world))
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
response = await client.get("/")
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.text == "Hello World!\n"
|
||||||
|
@@ -68,8 +68,8 @@ async def test_wsgi_get(wsgi_middleware: Callable) -> None:
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_wsgi_post(wsgi_middleware: Callable) -> None:
|
||||||
|
- app = wsgi_middleware(echo_body)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(wsgi_middleware(echo_body))
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
response = await client.post("/", json={"example": 123})
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.text == '{"example": 123}'
|
||||||
|
@@ -81,8 +81,8 @@ async def generate_body() -> AsyncGenerator[bytes, None]:
|
||||||
|
for _ in range(1024):
|
||||||
|
yield b"123456789abcdef\n" * 64
|
||||||
|
|
||||||
|
- app = wsgi_middleware(echo_body)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(wsgi_middleware(echo_body))
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
response = await client.put("/", content=generate_body())
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.text == "123456789abcdef\n" * 64 * 1024
|
||||||
|
@@ -92,21 +92,14 @@ async def generate_body() -> AsyncGenerator[bytes, None]:
|
||||||
|
async def test_wsgi_exception(wsgi_middleware: Callable) -> None:
|
||||||
|
# Note that we're testing the WSGI app directly here.
|
||||||
|
# The HTTP protocol implementations would catch this error and return 500.
|
||||||
|
- app = wsgi_middleware(raise_exception)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
+ transport = httpx.ASGITransport(wsgi_middleware(raise_exception))
|
||||||
|
+ async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
|
||||||
|
with pytest.raises(RuntimeError):
|
||||||
|
await client.get("/")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_wsgi_exc_info(wsgi_middleware: Callable) -> None:
|
||||||
|
- # Note that we're testing the WSGI app directly here.
|
||||||
|
- # The HTTP protocol implementations would catch this error and return 500.
|
||||||
|
- app = wsgi_middleware(return_exc_info)
|
||||||
|
- async with httpx.AsyncClient(app=app, base_url="http://testserver") as client:
|
||||||
|
- with pytest.raises(RuntimeError):
|
||||||
|
- response = await client.get("/")
|
||||||
|
-
|
||||||
|
app = wsgi_middleware(return_exc_info)
|
||||||
|
transport = httpx.ASGITransport(
|
||||||
|
app=app,
|
||||||
|
diff --git a/tools/cli_usage.py b/tools/cli_usage.py
|
||||||
|
index 09ed69a6c..5a9115710 100644
|
||||||
|
--- a/tools/cli_usage.py
|
||||||
|
+++ b/tools/cli_usage.py
|
||||||
|
@@ -16,9 +16,7 @@ def _get_usage_lines() -> typing.List[str]:
|
||||||
|
|
||||||
|
|
||||||
|
def _find_next_codefence_lineno(lines: typing.List[str], after: int) -> int:
|
||||||
|
- return next(
|
||||||
|
- lineno for lineno, line in enumerate(lines[after:], after) if line == "```"
|
||||||
|
- )
|
||||||
|
+ return next(lineno for lineno, line in enumerate(lines[after:], after) if line == "```")
|
||||||
|
|
||||||
|
|
||||||
|
def _get_insert_location(lines: typing.List[str]) -> typing.Tuple[int, int]:
|
@ -0,0 +1,158 @@
|
|||||||
|
## START: Set by rpmautospec
|
||||||
|
## (rpmautospec version 0.6.5)
|
||||||
|
## RPMAUTOSPEC: autorelease, autochangelog
|
||||||
|
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
|
||||||
|
release_number = 3;
|
||||||
|
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
|
||||||
|
print(release_number + base_release_number - 1);
|
||||||
|
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
|
||||||
|
## END: Set by rpmautospec
|
||||||
|
|
||||||
|
Name: python-uvicorn
|
||||||
|
Version: 0.29.0
|
||||||
|
Release: %autorelease
|
||||||
|
Summary: The lightning-fast ASGI server
|
||||||
|
License: BSD-3-Clause
|
||||||
|
URL: https://www.uvicorn.org
|
||||||
|
# PyPI tarball doesn't have tests
|
||||||
|
Source: https://github.com/encode/uvicorn/archive/%{version}/uvicorn-%{version}.tar.gz
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
# Compatibility with httpx 0.27.0
|
||||||
|
Patch: https://github.com/encode/uvicorn/commit/95fa1a.patch
|
||||||
|
|
||||||
|
%global common_description %{expand:
|
||||||
|
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 are now able
|
||||||
|
to start building a common set of tooling usable across all async frameworks.
|
||||||
|
Uvicorn supports HTTP/1.1 and WebSockets.}
|
||||||
|
|
||||||
|
|
||||||
|
%description %{common_description}
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python3-uvicorn
|
||||||
|
Summary: %{summary}
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-pytest
|
||||||
|
BuildRequires: python3-pytest-mock
|
||||||
|
BuildRequires: python3-a2wsgi
|
||||||
|
BuildRequires: python3-cryptography
|
||||||
|
BuildRequires: python3-httpx
|
||||||
|
BuildRequires: python3-trustme
|
||||||
|
BuildRequires: python3-watchgod
|
||||||
|
BuildRequires: python3-wsproto
|
||||||
|
|
||||||
|
|
||||||
|
%description -n python3-uvicorn %{common_description}
|
||||||
|
|
||||||
|
|
||||||
|
%pyproject_extras_subpkg -n python3-uvicorn standard
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p 1 -n uvicorn-%{version}
|
||||||
|
|
||||||
|
|
||||||
|
%generate_buildrequires
|
||||||
|
%pyproject_buildrequires -x standard
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
%pyproject_wheel
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
%pyproject_install
|
||||||
|
%pyproject_save_files uvicorn
|
||||||
|
|
||||||
|
|
||||||
|
%check
|
||||||
|
%pytest --verbose \
|
||||||
|
-k 'not test_run_startup_failure and not test_fragmentation and not test_send_binary_data_to_server_bigger_than_default_on_websockets'
|
||||||
|
|
||||||
|
|
||||||
|
%files -n python3-uvicorn -f %{pyproject_files}
|
||||||
|
%doc README.md
|
||||||
|
%{_bindir}/uvicorn
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Jan 04 2025 Arkady L. Shane <tigro@msvsphere-os.ru> - 0.29.0-3
|
||||||
|
- Rebuilt for MSVSphere 10
|
||||||
|
|
||||||
|
## START: Generated by rpmautospec
|
||||||
|
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.29.0-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 0.29.0-2
|
||||||
|
- Rebuilt for Python 3.13
|
||||||
|
|
||||||
|
* Mon Apr 15 2024 Lumir Balhar <lbalhar@redhat.com> - 0.29.0-1
|
||||||
|
- Update to 0.29.0 (rhbz#2247942)
|
||||||
|
|
||||||
|
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.2-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.2-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Sep 26 2023 Carl George <carlwgeorge@fedoraproject.org> - 0.23.2-1
|
||||||
|
- Update to version 0.23.2, resolves rhbz#2030302
|
||||||
|
- Convert to pyproject macros
|
||||||
|
- Switch license field to SPDX identifier
|
||||||
|
- Skip tests that fail on Python 3.12
|
||||||
|
|
||||||
|
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.0-6
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.0-5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.0-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 14 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.15.0-3
|
||||||
|
- Do not treat a DeprecationWarning in the tests as an error (fix RHBZ#2099139)
|
||||||
|
|
||||||
|
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.0-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Sep 10 2021 Tomas Hrnciar - 0.15.0-1
|
||||||
|
- Update to 0.15.0
|
||||||
|
- Fixes: rhbz#1966531
|
||||||
|
|
||||||
|
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.13.4-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 23 2021 Lumír Balhar <lbalhar@redhat.com> - 0.14.0-1
|
||||||
|
- Update to 0.14.0
|
||||||
|
|
||||||
|
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.13.4-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.13.4-2
|
||||||
|
- Rebuilt for Python 3.10
|
||||||
|
|
||||||
|
* Sat Mar 20 2021 Carl George <carl@george.computer> - 0.13.4-1
|
||||||
|
- Latest upstream
|
||||||
|
- Fixes: rhbz#1940231
|
||||||
|
|
||||||
|
* Fri Feb 05 2021 Carl George <carl@george.computer> - 0.13.3-1
|
||||||
|
- Latest upstream
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.2-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Nov 09 2020 Carl George <carl@george.computer> - 0.12.2-1
|
||||||
|
- Latest upstream
|
||||||
|
- Add uvicorn[standard] subpackage
|
||||||
|
|
||||||
|
* Tue Aug 18 2020 Carl George <carl@george.computer> - 0.11.8-1
|
||||||
|
- Latest upstream
|
||||||
|
|
||||||
|
* Thu Jun 04 2020 Carl George <carl@george.computer> - 0.11.5-1
|
||||||
|
- Initial package
|
||||||
|
|
||||||
|
## END: Generated by rpmautospec
|
Loading…
Reference in new issue