From e6119586a096d83985b51d6ca7fd035dd850fb46 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Wed, 13 Nov 2024 20:20:29 +0800 Subject: [PATCH 1/3] python3Packages.baize: init at 0.22.2 (cherry picked from commit 67075b4269b3c730345d458ef0fe950c342079fb) --- .../python-modules/baize/default.nix | 60 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 62 insertions(+) create mode 100644 pkgs/development/python-modules/baize/default.nix diff --git a/pkgs/development/python-modules/baize/default.nix b/pkgs/development/python-modules/baize/default.nix new file mode 100644 index 000000000000..d0fec79bc5a6 --- /dev/null +++ b/pkgs/development/python-modules/baize/default.nix @@ -0,0 +1,60 @@ +{ + buildPythonPackage, + lib, + fetchPypi, + pytestCheckHook, + pdm-pep517, + pytest-httpx, + setuptools, + starlette, + anyio, + pytest-asyncio, + pytest-tornasync, + pytest-trio, + pytest-twisted, + twisted, +}: + +buildPythonPackage rec { + pname = "baize"; + version = "0.22.2"; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-J+l8NsSTpCh7Uws+Zp45LXkLEBBurqOsOr8Iik/9smY="; + }; + + build-system = [ + pdm-pep517 + setuptools + ]; + + dependencies = [ + starlette + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-httpx + anyio + pytest-asyncio + pytest-tornasync + pytest-trio + pytest-twisted + twisted + ]; + + disabledTests = [ + # https://github.com/abersheeran/baize/issues/67 + "test_files" + "test_request_response" + ]; + + meta = { + description = "Powerful and exquisite WSGI/ASGI framework/toolkit"; + maintainers = with lib.maintainers; [ bot-wxt1221 ]; + homepage = "https://baize.aber.sh/"; + license = lib.licenses.asl20; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 75fd5b3333f6..5ce524a950f3 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1452,6 +1452,8 @@ self: super: with self; { bagit = callPackage ../development/python-modules/bagit { }; + baize = callPackage ../development/python-modules/baize { }; + banal = callPackage ../development/python-modules/banal { }; bandcamp-api = callPackage ../development/python-modules/bandcamp-api { }; From 38409c6245bd781fa53a9600eb16498ff3b8a044 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Wed, 13 Nov 2024 20:21:13 +0800 Subject: [PATCH 2/3] python3Packages.a2wsgi: fix build (cherry picked from commit 12d536207f37c5552374ea94c064b506915999ff) --- pkgs/development/python-modules/a2wsgi/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/a2wsgi/default.nix b/pkgs/development/python-modules/a2wsgi/default.nix index 99c6253d0977..e9a90937760d 100644 --- a/pkgs/development/python-modules/a2wsgi/default.nix +++ b/pkgs/development/python-modules/a2wsgi/default.nix @@ -7,6 +7,8 @@ pdm-backend, pytest-asyncio, pytestCheckHook, + starlette, + baize, }: buildPythonPackage rec { @@ -28,10 +30,15 @@ buildPythonPackage rec { pytestCheckHook ]; - meta = with lib; { + dependencies = [ + starlette + baize + ]; + + meta = { description = "Convert WSGI app to ASGI app or ASGI app to WSGI app"; homepage = "https://github.com/abersheeran/a2wsgi"; - license = licenses.asl20; - maintainers = with maintainers; [ SuperSandro2000 ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ SuperSandro2000 ]; }; } From c16019e54dd3f239d18845f3efb14352966bb857 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Thu, 14 Nov 2024 16:21:23 +0800 Subject: [PATCH 3/3] python3Packages.connexion: fix build (cherry picked from commit e8f8fd16e9849b0e2c60b5d8d83c645046dab17e) --- .../connexion/0001-Part-of-1992.patch | 25 +++++++++++ .../python-modules/connexion/default.nix | 43 ++++++++++++------- 2 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 pkgs/development/python-modules/connexion/0001-Part-of-1992.patch diff --git a/pkgs/development/python-modules/connexion/0001-Part-of-1992.patch b/pkgs/development/python-modules/connexion/0001-Part-of-1992.patch new file mode 100644 index 000000000000..2f1386314cdf --- /dev/null +++ b/pkgs/development/python-modules/connexion/0001-Part-of-1992.patch @@ -0,0 +1,25 @@ +From 10c3d787cc9c7fb31c6cc7074e9ce00dfeb6bb85 Mon Sep 17 00:00:00 2001 +From: wxt <3264117476@qq.com> +Date: Thu, 14 Nov 2024 16:16:17 +0800 +Subject: [PATCH] Part of 1992 + +--- + tests/decorators/test_validation.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/decorators/test_validation.py b/tests/decorators/test_validation.py +index bece403..d7e0984 100644 +--- a/tests/decorators/test_validation.py ++++ b/tests/decorators/test_validation.py +@@ -78,7 +78,7 @@ def test_invalid_type(monkeypatch): + logger = MagicMock() + monkeypatch.setattr("connexion.validators.parameter.logger", logger) + result = ParameterValidator.validate_parameter( +- "formdata", 20, {"type": "string", "name": "foo"} ++ "formdata", 20, {"name": "foo", "type": "string"} + ) + expected_result = """20 is not of type 'string' + +-- +2.47.0 + diff --git a/pkgs/development/python-modules/connexion/default.nix b/pkgs/development/python-modules/connexion/default.nix index bd19ae31caa2..b56c8acb2258 100644 --- a/pkgs/development/python-modules/connexion/default.nix +++ b/pkgs/development/python-modules/connexion/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, fetchFromGitHub, buildPythonPackage, pythonOlder, @@ -46,6 +47,11 @@ buildPythonPackage rec { hash = "sha256-rngQDU9kXw/Z+Al0SCVnWN8xnphueTtZ0+xPBR5MbEM="; }; + patches = [ + # A really small Part of https://github.com/spec-first/connexion/pull/1992 Will fix check on newest dependencies + ./0001-Part-of-1992.patch + ]; + build-system = [ poetry-core ]; dependencies = [ @@ -79,26 +85,31 @@ buildPythonPackage rec { pythonImportsCheck = [ "connexion" ]; - disabledTests = [ - "test_build_example" - "test_mock_resolver_no_example" - # Tests require network access - "test_remote_api" - # AssertionError - "test_headers" - # waiter.acquire() deadlock - "test_cors_server_error" - "test_get_bad_default_response" - "test_schema_response" - "test_writeonly" - ]; + disabledTests = + [ + "test_build_example" + "test_mock_resolver_no_example" + # Tests require network access + "test_remote_api" + # AssertionError + "test_headers" + # waiter.acquire() deadlock + "test_cors_server_error" + "test_get_bad_default_response" + "test_schema_response" + "test_writeonly" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # ImportError: Error while finding loader for '/private/tmp/nix-build-python3.12-connexion-3.1.0.drv-0/source' (: No module named '/private/tmp/nix-build-python3') + "test_lifespan" + ]; - meta = with lib; { + meta = { description = "Swagger/OpenAPI First framework on top of Flask"; homepage = "https://github.com/spec-first/connexion"; changelog = "https://github.com/spec-first/connexion/releases/tag/${version}"; - license = licenses.asl20; - maintainers = [ ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bot-wxt1221 ]; mainProgram = "connexion"; }; }