From 72badb5bef437ab8adcdaea2be3fba85ef07f013 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 Jan 2024 08:59:34 +0100 Subject: [PATCH 1/6] python311Packages.betterproto: refactor --- .../python-modules/betterproto/default.nix | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/betterproto/default.nix b/pkgs/development/python-modules/betterproto/default.nix index f17fabec994f..38d69c6f8326 100644 --- a/pkgs/development/python-modules/betterproto/default.nix +++ b/pkgs/development/python-modules/betterproto/default.nix @@ -13,6 +13,7 @@ , pytestCheckHook , pytest-asyncio , pytest-mock +, typing-extensions , tomlkit , grpcio-tools }: @@ -20,21 +21,25 @@ buildPythonPackage rec { pname = "betterproto"; version = "2.0.0b6"; - format = "pyproject"; - disabled = pythonOlder "3.7"; + pyproject = true; + + disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "danielgtaylor"; repo = "python-betterproto"; - rev = "v.${version}"; + rev = "refs/tags/v.${version}"; hash = "sha256-ZuVq4WERXsRFUPNNTNp/eisWX1MyI7UtwqEI8X93wYI="; }; - nativeBuildInputs = [ poetry-core ]; + nativeBuildInputs = [ + poetry-core + ]; propagatedBuildInputs = [ grpclib python-dateutil + typing-extensions ]; passthru.optional-dependencies.compiler = [ @@ -43,16 +48,18 @@ buildPythonPackage rec { isort ]; - pythonImportsCheck = [ "betterproto" ]; - nativeCheckInputs = [ + grpcio-tools pydantic - pytestCheckHook pytest-asyncio pytest-mock + pytestCheckHook tomlkit - grpcio-tools - ] ++ passthru.optional-dependencies.compiler; + ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + + pythonImportsCheck = [ + "betterproto" + ]; # The tests require the generation of code before execution. This requires # the protoc-gen-python_betterproto script from the package to be on PATH. @@ -63,13 +70,14 @@ buildPythonPackage rec { ''; meta = with lib; { - description = "Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC"; + description = "Code generator & library for Protobuf 3 and async gRPC"; longDescription = '' This project aims to provide an improved experience when using Protobuf / gRPC in a modern Python environment by making use of modern language features and generating readable, understandable, idiomatic Python code. ''; homepage = "https://github.com/danielgtaylor/python-betterproto"; + changelog = "https://github.com/danielgtaylor/python-betterproto/blob/v.${version}/CHANGELOG.md"; license = licenses.mit; maintainers = with maintainers; [ nikstur ]; }; From 87937015847b6ec9052e29eda1bdaeefdfd1f815 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 Jan 2024 09:00:20 +0100 Subject: [PATCH 2/6] python311Packages.betterproto: disable failing pydantic tests --- pkgs/development/python-modules/betterproto/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/betterproto/default.nix b/pkgs/development/python-modules/betterproto/default.nix index 38d69c6f8326..f5cc7d9253ea 100644 --- a/pkgs/development/python-modules/betterproto/default.nix +++ b/pkgs/development/python-modules/betterproto/default.nix @@ -69,6 +69,15 @@ buildPythonPackage rec { ${python.interpreter} -m tests.generate ''; + disabledTestPaths = [ + # https://github.com/danielgtaylor/python-betterproto/issues/530 + "tests/inputs/oneof/test_oneof.py" + ]; + + disabledTests = [ + "test_pydantic_no_value" + ]; + meta = with lib; { description = "Code generator & library for Protobuf 3 and async gRPC"; longDescription = '' From 9e3c863a43d05de134824d947aeb4e50c15dcac7 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 Jan 2024 09:13:45 +0100 Subject: [PATCH 3/6] python311Packages.sigstore: refactor --- .../python-modules/sigstore/default.nix | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/sigstore/default.nix b/pkgs/development/python-modules/sigstore/default.nix index ae64e1eb057b..cb58ac7eaeb8 100644 --- a/pkgs/development/python-modules/sigstore/default.nix +++ b/pkgs/development/python-modules/sigstore/default.nix @@ -1,27 +1,21 @@ { lib -, buildPythonPackage -, fetchFromGitHub - -# build-system -, flit-core - -# dependencies , appdirs +, buildPythonPackage , cryptography +, fetchFromGitHub +, flit-core , id , importlib-resources , pydantic , pyjwt , pyopenssl +, pytestCheckHook , requests , rich , securesystemslib , sigstore-protobuf-specs , sigstore-rekor-types , tuf - -# tests -, pytestCheckHook }: buildPythonPackage rec { @@ -32,7 +26,7 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "sigstore"; repo = "sigstore-python"; - rev = "v${version}"; + rev = "refs/tags/v${version}"; hash = "sha256-WH6Pme8ZbfW5xqBT056eVJ3HZP1D/lAULtyN6k0uMaA="; }; @@ -67,7 +61,7 @@ buildPythonPackage rec { meta = with lib; { description = "A codesigning tool for Python packages"; homepage = "https://github.com/sigstore/sigstore-python"; - changelog = "https://github.com/sigstore/sigstore-python/blob/${src.rev}/CHANGELOG.md"; + changelog = "https://github.com/sigstore/sigstore-python/blob/${version}/CHANGELOG.md"; license = licenses.asl20; maintainers = with maintainers; [ ]; }; From df25e98ea6359d32d3287a5022fa1578ef906e76 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 Jan 2024 09:29:29 +0100 Subject: [PATCH 4/6] python311Packages.sigstore: disable failing tests --- .../python-modules/sigstore/default.nix | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pkgs/development/python-modules/sigstore/default.nix b/pkgs/development/python-modules/sigstore/default.nix index cb58ac7eaeb8..24322a18723e 100644 --- a/pkgs/development/python-modules/sigstore/default.nix +++ b/pkgs/development/python-modules/sigstore/default.nix @@ -6,6 +6,7 @@ , flit-core , id , importlib-resources +, pretend , pydantic , pyjwt , pyopenssl @@ -16,6 +17,7 @@ , sigstore-protobuf-specs , sigstore-rekor-types , tuf +, pythonOlder }: buildPythonPackage rec { @@ -23,6 +25,8 @@ buildPythonPackage rec { version = "2.1.0"; pyproject = true; + disabled = pythonOlder "3.8"; + src = fetchFromGitHub { owner = "sigstore"; repo = "sigstore-python"; @@ -51,13 +55,31 @@ buildPythonPackage rec { ]; nativeCheckInputs = [ + pretend pytestCheckHook ]; + preCheck = '' + export HOME=$(mktemp -d) + ''; + pythonImportsCheck = [ "sigstore" ]; + disabledTests = [ + # Tests require network access + "test_fail_init_url" + "test_get_identity_token_bad_code" + "test_identity_proof_claim_lookup" + "test_init_url" + "test_production" + "test_sct_verify_keyring" + "test_sign_rekor_entry_consistent" + "test_verification_materials_retrieves_rekor_entry" + "test_verifier" + ]; + meta = with lib; { description = "A codesigning tool for Python packages"; homepage = "https://github.com/sigstore/sigstore-python"; From 38f34c95cbec82aaf4471731ff926b624f096d2f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 Jan 2024 09:41:13 +0100 Subject: [PATCH 5/6] python312Packages.aiogithubapi: disable failing tests --- .../python-modules/aiogithubapi/default.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/aiogithubapi/default.nix b/pkgs/development/python-modules/aiogithubapi/default.nix index 3eb23c4a6641..94d2e9042c0d 100644 --- a/pkgs/development/python-modules/aiogithubapi/default.nix +++ b/pkgs/development/python-modules/aiogithubapi/default.nix @@ -15,13 +15,13 @@ buildPythonPackage rec { pname = "aiogithubapi"; version = "23.11.0"; - format = "pyproject"; + pyproject = true; disabled = pythonOlder "3.8"; src = fetchFromGitHub { owner = "ludeeus"; - repo = pname; + repo = "aiogithubapi"; rev = "refs/tags/${version}"; hash = "sha256-SbpfHKD4QJuCe3QG0GTvsffkuFiGPLEUXOVW9f1gyTI="; }; @@ -31,7 +31,8 @@ buildPythonPackage rec { # are not in their focus substituteInPlace pyproject.toml \ --replace 'version = "0"' 'version = "${version}"' \ - --replace 'backoff = "^1.10.0"' 'backoff = "*"' + --replace 'backoff = "^1.10.0"' 'backoff = "*"' \ + --replace 'sigstore = "<2"' 'sigstore = "*"' ''; nativeBuildInputs = [ @@ -55,10 +56,19 @@ buildPythonPackage rec { "--asyncio-mode=auto" ]; + preCheck = '' + export HOME=$(mktemp -d) + ''; + pythonImportsCheck = [ "aiogithubapi" ]; + disabledTests = [ + # sigstore.errors.TUFError: Failed to refresh TUF metadata + "test_sigstore" + ]; + meta = with lib; { description = "Python client for the GitHub API"; homepage = "https://github.com/ludeeus/aiogithubapi"; From 5499bfeea5a0979cadf9e04154297a240d66f2a9 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 Jan 2024 10:18:51 +0100 Subject: [PATCH 6/6] python312Packages.aiogithubapi: enable darwin build --- pkgs/development/python-modules/aiogithubapi/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/python-modules/aiogithubapi/default.nix b/pkgs/development/python-modules/aiogithubapi/default.nix index 94d2e9042c0d..59367acb041a 100644 --- a/pkgs/development/python-modules/aiogithubapi/default.nix +++ b/pkgs/development/python-modules/aiogithubapi/default.nix @@ -26,6 +26,8 @@ buildPythonPackage rec { hash = "sha256-SbpfHKD4QJuCe3QG0GTvsffkuFiGPLEUXOVW9f1gyTI="; }; + __darwinAllowLocalNetworking = true; + postPatch = '' # Upstream is releasing with the help of a CI to PyPI, GitHub releases # are not in their focus