From 9d88f32dc55b670c62d52521fc51cd8e01751070 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 2 Oct 2024 11:48:41 +0200 Subject: [PATCH 1/4] Add backports.zoneinfo to allowed dependencies Also improve error message when dependency is missing --- stub_uploader/metadata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stub_uploader/metadata.py b/stub_uploader/metadata.py index 84e4d6a4..64b206d9 100644 --- a/stub_uploader/metadata.py +++ b/stub_uploader/metadata.py @@ -214,6 +214,7 @@ def verify_typeshed_req(req: Requirement) -> None: "Pillow", "Werkzeug", "arrow", + "backports.zoneinfo", "click", "cryptography", "django-stubs", @@ -289,7 +290,7 @@ def verify_external_req( if req.name not in EXTERNAL_REQ_ALLOWLIST and not _unsafe_ignore_allowlist: raise InvalidRequires( - f"Expected dependency {req} to be present in the allowlist" + f"Expected dependency {req.name} to be present in the allowlist" ) resp = requests.get(f"https://pypi.org/pypi/{upstream_distribution}/json") From 93dace31252224ab8a4b487c8e9e0b1e9e3bc37d Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 2 Oct 2024 11:51:20 +0200 Subject: [PATCH 2/4] Add a comment about eventual removal --- stub_uploader/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stub_uploader/metadata.py b/stub_uploader/metadata.py index 64b206d9..cb024869 100644 --- a/stub_uploader/metadata.py +++ b/stub_uploader/metadata.py @@ -214,7 +214,7 @@ def verify_typeshed_req(req: Requirement) -> None: "Pillow", "Werkzeug", "arrow", - "backports.zoneinfo", + "backports.zoneinfo", # Remove after we drop Python 3.8 support. "click", "cryptography", "django-stubs", From 58c580b5785222372bae6f19e3f618d50d0a9b51 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 2 Oct 2024 12:32:26 +0200 Subject: [PATCH 3/4] Update stub_uploader/metadata.py Co-authored-by: Alex Waygood --- stub_uploader/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stub_uploader/metadata.py b/stub_uploader/metadata.py index cb024869..71b8de7e 100644 --- a/stub_uploader/metadata.py +++ b/stub_uploader/metadata.py @@ -290,7 +290,7 @@ def verify_external_req( if req.name not in EXTERNAL_REQ_ALLOWLIST and not _unsafe_ignore_allowlist: raise InvalidRequires( - f"Expected dependency {req.name} to be present in the allowlist" + f"Expected dependency {req.name} to be present in the stub_uploader allowlist" ) resp = requests.get(f"https://pypi.org/pypi/{upstream_distribution}/json") From a3ff495a378d1e1191613b812eb2e9b60ef195aa Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 2 Oct 2024 12:45:36 +0200 Subject: [PATCH 4/4] Fix a test --- tests/test_integration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_integration.py b/tests/test_integration.py index 68cbda15..916163f3 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -83,7 +83,9 @@ def test_verify_external_req() -> None: Requirement("mypy-extensions"), "mypy", _unsafe_ignore_allowlist=True ) - with pytest.raises(InvalidRequires, match="to be present in the allowlist"): + with pytest.raises( + InvalidRequires, match="to be present in the stub_uploader allowlist" + ): verify_external_req(Requirement("typing-extensions"), "mypy") m = Metadata("pandas", {"version": "0.1", "requires": ["numpy"]})