From c6a39f7e35d2e0ff8d1766019e8112cfe7f7a6726ec66617da6f80dbf2e840ea Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 19 Jul 2022 09:33:14 +0000 Subject: [PATCH 1/3] Accepting request 990058 from home:bnavigator:branches:devel:languages:python - Update to version 0.18.2 * Add default `log_config` on `uvicorn.run()` (#1541) * Revert `logging` file name modification (#1543) - Release 0.18.1 * Use `DEFAULT_MAX_INCOMPLETE_EVENT_SIZE` as default to `h11_max_incomplete_event_size` on the CLI (#1534) - Release 0.18.0 * The `reload` flag prioritizes `watchfiles` instead of the deprecated `watchgod` (#1437) * Annotate `uvicorn.run()` function (#1423) * Allow configuring `max_incomplete_event_size` for `h11` implementation (#1514) * Remove `asgiref` dependency (#1532) * Turn `raw_path` into bytes on both websockets implementations (#1487) * Revert log exception traceback in case of invalid HTTP request (#1518) * Set `asyncio.WindowsSelectorEventLoopPolicy()` when using multiple workers to avoid "WinError 87" (#1454) - Release 0.17.5 * Fix case where url is fragmented in httptools protocol (#1263) 2/16/22 * Fix WSGI middleware not to explode quadratically in the case of a larger body (#1329) * Send HTTP 400 response for invalid request (#1352) - Release 0.17.4 * Replace `create_server` by `create_unix_server` (#1362) - Release 0.17.3 * Drop wsproto version checking. (#1359) - Release 0.17.2 OBS-URL: https://build.opensuse.org/request/show/990058 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-uvicorn?expand=0&rev=10 --- python-uvicorn.changes | 47 +++++++++++++ python-uvicorn.spec | 22 ++++--- uvicorn-0.17.0.tar.gz | 3 - uvicorn-0.18.2.tar.gz | 3 + uvicorn-pr1537-no-watchgod-tests.patch | 91 ++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 13 deletions(-) delete mode 100644 uvicorn-0.17.0.tar.gz create mode 100644 uvicorn-0.18.2.tar.gz create mode 100644 uvicorn-pr1537-no-watchgod-tests.patch diff --git a/python-uvicorn.changes b/python-uvicorn.changes index 322a318..d448406 100644 --- a/python-uvicorn.changes +++ b/python-uvicorn.changes @@ -1,3 +1,50 @@ +------------------------------------------------------------------- +Mon Jul 18 20:17:15 UTC 2022 - Ben Greiner + +- Update to version 0.18.2 + * Add default `log_config` on `uvicorn.run()` (#1541) + * Revert `logging` file name modification (#1543) +- Release 0.18.1 + * Use `DEFAULT_MAX_INCOMPLETE_EVENT_SIZE` as default to + `h11_max_incomplete_event_size` on the CLI (#1534) +- Release 0.18.0 + * The `reload` flag prioritizes `watchfiles` instead of the + deprecated `watchgod` (#1437) + * Annotate `uvicorn.run()` function (#1423) + * Allow configuring `max_incomplete_event_size` for `h11` + implementation (#1514) + * Remove `asgiref` dependency (#1532) + * Turn `raw_path` into bytes on both websockets implementations + (#1487) + * Revert log exception traceback in case of invalid HTTP request + (#1518) + * Set `asyncio.WindowsSelectorEventLoopPolicy()` when using + multiple workers to avoid "WinError 87" (#1454) +- Release 0.17.5 + * Fix case where url is fragmented in httptools protocol (#1263) + 2/16/22 + * Fix WSGI middleware not to explode quadratically in the case of + a larger body (#1329) + * Send HTTP 400 response for invalid request (#1352) +- Release 0.17.4 + * Replace `create_server` by `create_unix_server` (#1362) +- Release 0.17.3 + * Drop wsproto version checking. (#1359) +- Release 0.17.2 + * Revert #1332. While trying to solve the memory leak, it + introduced an issue (#1345) when the server receives big chunks + of data using the `httptools` implementation. (#1354) + * Revert stream interface changes. This was introduced on 0.14.0, + and caused an issue (#1226), which caused a memory leak when + sending TCP pings. (#1355) + * Fix wsproto version check expression (#1342) +- Release 0.17.1 + * Move all data handling logic to protocol and ensure connection + is closed. (#1332) + * Change `spec_version` field from "2.1" to "2.3", as Uvicorn is + compliant with that version of the ASGI specifications. (#1337) +- Add uvicorn-pr1537-no-watchgod-tests.patch gh#encode/uvicorn#1537 + ------------------------------------------------------------------- Tue Feb 1 05:38:09 UTC 2022 - Steve Kowalik diff --git a/python-uvicorn.spec b/python-uvicorn.spec index e0de5ba..f457d02 100644 --- a/python-uvicorn.spec +++ b/python-uvicorn.spec @@ -16,27 +16,29 @@ # -%{?!python_module:%define python_module() python3-%{**}} -%define skip_python2 1 Name: python-uvicorn -Version: 0.17.0 +Version: 0.18.2 Release: 0 Summary: An Asynchronous Server Gateway Interface server License: BSD-3-Clause URL: https://github.com/encode/uvicorn Source: https://github.com/encode/uvicorn/archive/%{version}.tar.gz#/uvicorn-%{version}.tar.gz +# PATCH-FIX-UPSTREAM uvicorn-pr1537-no-watchgod-tests.patch gh#encode/uvicorn#1537 +Patch1: https://github.com/encode/uvicorn/pull/1537#/uvicorn-pr1537-no-watchgod-tests.patch +BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-asgiref >= 3.4 Requires: python-click >= 7.0 Requires: python-h11 >= 0.8.0 -Requires: python-httptools >= 0.1.0 +%if 0%{python_version_nodots} < 38 Requires: python-typing_extensions -Requires: python-websockets >= 8.0 +%endif Recommends: python-PyYAML >= 5.1 +Recommends: python-httptools >= 0.4.0 +Recommends: python-websockets >= 8.0 Suggests: python-uvloop >= 0.14.0 -Suggests: python-watchgod >= 0.6 +Suggests: python-watchfiles >= 0.13 Suggests: python-wsproto >= 0.15.0 Requires(post): update-alternatives Requires(postun):update-alternatives @@ -46,7 +48,7 @@ BuildRequires: %{python_module PyYAML >= 5.1} BuildRequires: %{python_module asgiref >= 3.4} BuildRequires: %{python_module click >= 7.0} BuildRequires: %{python_module h11 >= 0.8.0} -BuildRequires: %{python_module httptools >= 0.1.0} +BuildRequires: %{python_module httptools >= 0.4.0} BuildRequires: %{python_module httpx >= 0.18} BuildRequires: %{python_module pytest-asyncio} BuildRequires: %{python_module pytest-mock} @@ -54,9 +56,9 @@ BuildRequires: %{python_module pytest} BuildRequires: %{python_module python-dotenv} BuildRequires: %{python_module requests} BuildRequires: %{python_module trustme} -BuildRequires: %{python_module typing_extensions} +BuildRequires: %{python_module typing_extensions if %python-base < 3.8} BuildRequires: %{python_module uvloop >= 0.14.0} -BuildRequires: %{python_module watchgod >= 0.6} +BuildRequires: %{python_module watchfiles >= 0.13} BuildRequires: %{python_module websockets >= 8.0} BuildRequires: %{python_module wsproto >= 0.15.0} # /SECTION diff --git a/uvicorn-0.17.0.tar.gz b/uvicorn-0.17.0.tar.gz deleted file mode 100644 index f438ce0..0000000 --- a/uvicorn-0.17.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a55743b07c3614dac0803dece49f406145e101905fa750d9e496cafd91f016d7 -size 708241 diff --git a/uvicorn-0.18.2.tar.gz b/uvicorn-0.18.2.tar.gz new file mode 100644 index 0000000..6612403 --- /dev/null +++ b/uvicorn-0.18.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa30bcc7ef65b09bd30fe0afbc0cc8d79945c1f4a105dd0e1ea57f51ee6b8400 +size 712706 diff --git a/uvicorn-pr1537-no-watchgod-tests.patch b/uvicorn-pr1537-no-watchgod-tests.patch new file mode 100644 index 0000000..0eb3735 --- /dev/null +++ b/uvicorn-pr1537-no-watchgod-tests.patch @@ -0,0 +1,91 @@ +From 5bd9a221116458b0922baeadc0a51ff02ac0b56b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Fri, 24 Jun 2022 07:43:33 +0200 +Subject: [PATCH] Handle missing watchfiles and watchgod gracefully in tests + +Skip the tests relying on watchfiles and watchgod reloaders when +the required dependencies are not available rather than causing +an ImportError. Since these packages are optional and watchfiles +does not support all the platforms that uvicorn used to work on so far, +it is useful to be able to run at least part of the test suite there. +--- + tests/supervisors/test_reload.py | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/tests/supervisors/test_reload.py b/tests/supervisors/test_reload.py +index 04bfb41cf..6010d703b 100644 +--- a/tests/supervisors/test_reload.py ++++ b/tests/supervisors/test_reload.py +@@ -2,7 +2,7 @@ + import signal + from pathlib import Path + from time import sleep +-from typing import Type ++from typing import Optional, Type + + import pytest + +@@ -10,8 +10,16 @@ + from uvicorn.config import Config + from uvicorn.supervisors.basereload import BaseReload, _display_path + from uvicorn.supervisors.statreload import StatReload +-from uvicorn.supervisors.watchfilesreload import WatchFilesReload +-from uvicorn.supervisors.watchgodreload import WatchGodReload ++ ++try: ++ from uvicorn.supervisors.watchfilesreload import WatchFilesReload ++except ImportError: # pragma: no cover ++ WatchFilesReload = None ++ ++try: ++ from uvicorn.supervisors.watchgodreload import WatchGodReload ++except ImportError: # pragma: no cover ++ WatchGodReload = None + + + def run(sockets): +@@ -23,8 +31,10 @@ class TestBaseReload: + def setup( + self, + reload_directory_structure: Path, +- reloader_class: Type[BaseReload], ++ reloader_class: Optional[Type[BaseReload]], + ): ++ if reloader_class is None: # pragma: no cover ++ pytest.skip("Needed dependency not installed") + self.reload_path = reload_directory_structure + self.reloader_class = reloader_class + +@@ -43,7 +53,7 @@ def _setup_reloader(self, config: Config) -> BaseReload: + + def _reload_tester(self, touch_soon, reloader: BaseReload, *files: Path) -> bool: + reloader.restart() +- if isinstance(reloader, WatchFilesReload): ++ if WatchFilesReload is not None and isinstance(reloader, WatchFilesReload): + touch_soon(*files) + else: + assert not next(reloader) +@@ -240,6 +250,7 @@ def test_override_defaults(self, touch_soon) -> None: + + reloader.shutdown() + ++ @pytest.mark.skipif(WatchFilesReload is None, reason="watchfiles not available") + @pytest.mark.parametrize("reloader_class", [WatchFilesReload]) + def test_watchfiles_no_changes(self) -> None: + sub_dir = self.reload_path / "app" / "sub" +@@ -296,6 +307,7 @@ def test_should_detect_new_reload_dirs( + reloader.shutdown() + + ++@pytest.mark.skipif(WatchFilesReload is None, reason="watchfiles not available") + def test_should_watch_one_dir_cwd(mocker, reload_directory_structure): + mock_watch = mocker.patch("uvicorn.supervisors.watchfilesreload.watch") + app_dir = reload_directory_structure / "app" +@@ -312,6 +324,7 @@ def test_should_watch_one_dir_cwd(mocker, reload_directory_structure): + assert mock_watch.call_args[0] == (Path.cwd(),) + + ++@pytest.mark.skipif(WatchFilesReload is None, reason="watchfiles not available") + def test_should_watch_separate_dirs_outside_cwd(mocker, reload_directory_structure): + mock_watch = mocker.patch("uvicorn.supervisors.watchfilesreload.watch") + app_dir = reload_directory_structure / "app" From e90d9646e9d0791c7e1edb5957405e38ac9042ed601d6157c6dcbae3c98f4d50 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 20 Jul 2022 10:11:36 +0000 Subject: [PATCH 2/3] Accepting request 990364 from home:bnavigator:branches:devel:languages:python - Disable testing with watchfiles * We don't want it in Ring1-MinimalX Having slept over it, I think it is best to not BuildRequire it at all. See https://build.opensuse.org/request/show/990107 OBS-URL: https://build.opensuse.org/request/show/990364 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-uvicorn?expand=0&rev=11 --- python-uvicorn.changes | 6 ++++++ python-uvicorn.spec | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/python-uvicorn.changes b/python-uvicorn.changes index d448406..5082af5 100644 --- a/python-uvicorn.changes +++ b/python-uvicorn.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jul 19 20:59:25 UTC 2022 - Ben Greiner + +- Disable testing with watchfiles + * We don't want it in Ring1-MinimalX + ------------------------------------------------------------------- Mon Jul 18 20:17:15 UTC 2022 - Ben Greiner diff --git a/python-uvicorn.spec b/python-uvicorn.spec index f457d02..f67b504 100644 --- a/python-uvicorn.spec +++ b/python-uvicorn.spec @@ -58,9 +58,10 @@ BuildRequires: %{python_module requests} BuildRequires: %{python_module trustme} BuildRequires: %{python_module typing_extensions if %python-base < 3.8} BuildRequires: %{python_module uvloop >= 0.14.0} -BuildRequires: %{python_module watchfiles >= 0.13} BuildRequires: %{python_module websockets >= 8.0} BuildRequires: %{python_module wsproto >= 0.15.0} +# We don't want watchfiles in Ring1 +#BuildRequires: #{python_module watchfiles >= 0.13} # /SECTION %python_subpackages @@ -89,14 +90,13 @@ rm setup.cfg %check # Required for reporting bugs %python_exec -m uvicorn --version -# Three wsproto upgrade related tests -# https://github.com/encode/uvicorn/issues/868 -%pytest -rs -k 'not (test_supported_upgrade_request or test_invalid_upgrade)' +%pytest %files %{python_files} %doc README.md %license LICENSE.md %python_alternative %{_bindir}/uvicorn -%{python_sitelib}/* +%{python_sitelib}/uvicorn +%{python_sitelib}/uvicorn-%{version}*-info %changelog From 4c0b433ea3b257d56c82a43e348c253a7fcb545b5dd2940589a170ed7a8ef88e Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 5 Aug 2022 12:31:22 +0000 Subject: [PATCH 3/3] Accepting request 993271 from home:dimstar:Factory - Fix URL to 1537.patch: add ".patch" to the gh Pr to reference the raw patch, not the gh webui. OBS-URL: https://build.opensuse.org/request/show/993271 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-uvicorn?expand=0&rev=12 --- python-uvicorn.changes | 6 ++++++ python-uvicorn.spec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python-uvicorn.changes b/python-uvicorn.changes index 5082af5..655000e 100644 --- a/python-uvicorn.changes +++ b/python-uvicorn.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Aug 5 09:51:32 UTC 2022 - Dominique Leuenberger + +- Fix URL to 1537.patch: add ".patch" to the gh Pr to reference the + raw patch, not the gh webui. + ------------------------------------------------------------------- Tue Jul 19 20:59:25 UTC 2022 - Ben Greiner diff --git a/python-uvicorn.spec b/python-uvicorn.spec index f67b504..e78d2cf 100644 --- a/python-uvicorn.spec +++ b/python-uvicorn.spec @@ -24,7 +24,7 @@ License: BSD-3-Clause URL: https://github.com/encode/uvicorn Source: https://github.com/encode/uvicorn/archive/%{version}.tar.gz#/uvicorn-%{version}.tar.gz # PATCH-FIX-UPSTREAM uvicorn-pr1537-no-watchgod-tests.patch gh#encode/uvicorn#1537 -Patch1: https://github.com/encode/uvicorn/pull/1537#/uvicorn-pr1537-no-watchgod-tests.patch +Patch1: https://github.com/encode/uvicorn/pull/1537.patch#/uvicorn-pr1537-no-watchgod-tests.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module setuptools} BuildRequires: fdupes