-
Notifications
You must be signed in to change notification settings - Fork 19
Allow types-foo to depend on foo #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,17 +5,17 @@ | |||||||||||||||||||||
import os | ||||||||||||||||||||||
import re | ||||||||||||||||||||||
import tarfile | ||||||||||||||||||||||
import tempfile | ||||||||||||||||||||||
import urllib.parse | ||||||||||||||||||||||
from collections.abc import Generator, Iterable | ||||||||||||||||||||||
from glob import glob | ||||||||||||||||||||||
from pathlib import Path | ||||||||||||||||||||||
import tempfile | ||||||||||||||||||||||
from typing import Any, Optional | ||||||||||||||||||||||
|
||||||||||||||||||||||
import requests | ||||||||||||||||||||||
import tomli | ||||||||||||||||||||||
from packaging.requirements import Requirement | ||||||||||||||||||||||
from packaging.specifiers import Specifier, InvalidSpecifier | ||||||||||||||||||||||
from packaging.specifiers import InvalidSpecifier, Specifier | ||||||||||||||||||||||
|
||||||||||||||||||||||
from .const import META, THIRD_PARTY_NAMESPACE, TYPES_PREFIX, UPLOADED_PATH | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -350,9 +350,11 @@ def verify_external_req_stubs_require_its_runtime( | |||||||||||||||||||||
|
||||||||||||||||||||||
runtime_req_name = EXTERNAL_RUNTIME_REQ_MAP.get(req.name, req.name) | ||||||||||||||||||||||
|
||||||||||||||||||||||
if not runtime_in_upstream_requires( | ||||||||||||||||||||||
req, data | ||||||||||||||||||||||
) and not runtime_in_upstream_sdist_requires(req, data): | ||||||||||||||||||||||
if ( | ||||||||||||||||||||||
runtime_req_name != upstream_distribution # Allow `types-foo` to require `foo` | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the bug that I alluded to when I wrote the refactoring PR. But wouldn't it be clearer to just check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we don't mind not validating that But let's say someone adds a new stubs, mistyped the distribution's name, and makes it reference on itself. It's quite the edge case, but to be considered. Hmm, I guess stubtest and maybe other tools as well would fail. So probably fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not sure which side the the Edit: I think it doesn't really matter because we wouldn't self reference, let's say |
||||||||||||||||||||||
and not runtime_in_upstream_requires(req, data) | ||||||||||||||||||||||
and not runtime_in_upstream_sdist_requires(req, data) | ||||||||||||||||||||||
): | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternative syntax:
Suggested change
|
||||||||||||||||||||||
raise InvalidRequires( | ||||||||||||||||||||||
f"Expected dependency {runtime_req_name} to be listed in {upstream_distribution}'s " | ||||||||||||||||||||||
+ "requires_dist or the sdist's *.egg-info/requires.txt" | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want me to hide this check behind a function for consistency, I'd call it
runtime_is_upstream
.