Skip to content

Commit 20b5956

Browse files
committed
Allow non-types dependencies
Remove the check in check_consistency that ensures that only other type packages from typeshed are being depended on. Instead, add an explanation to CONTRIBUTING that spells out the requirements. This adds a higher, but reasonable burden on maintainers to check the dependencies manually. Part of python#5768
1 parent 80f61d2 commit 20b5956

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ supported:
9494
unknown and needs to be updated.
9595
* `python2` (default: `false`): If set to `true`, the top-level stubs
9696
support both Python 2 and Python 3.
97-
* `requires` (optional): A list of other stub packages that this package uses.
97+
* `requires` (optional): A list of other stub packages or packages with type
98+
information that are imported by the stubs in this package. Only packages
99+
generated by typeshed or required by the upstream package are allowed to
100+
be listed here, for security reasons.
98101
* `extra_description` (optional): Can be used to add a custom description to
99102
the package's long description. It should be a multi-line string in
100103
Markdown format.

tests/check_consistent.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def _strip_dep_version(dependency):
163163

164164

165165
def check_metadata():
166-
known_distributions = set(os.listdir("stubs"))
167166
for distribution in os.listdir("stubs"):
168167
with open(os.path.join("stubs", distribution, "METADATA.toml")) as f:
169168
data = toml.loads(f.read())
@@ -179,13 +178,10 @@ def check_metadata():
179178
assert isinstance(data.get("requires", []), list), f"Invalid requires value for {distribution}"
180179
for dep in data.get("requires", []):
181180
assert isinstance(dep, str), f"Invalid dependency {dep} for {distribution}"
182-
assert dep.startswith("types-"), f"Only stub dependencies supported, got {dep}"
183-
dep = dep[len("types-"):]
184181
for space in " \t\n":
185182
assert space not in dep, f"For consistency dependency should not have whitespace: {dep}"
186183
assert ";" not in dep, f"Semicolons in dependencies are not supported, got {dep}"
187184
stripped, relation, dep_version = _strip_dep_version(dep)
188-
assert stripped in known_distributions, f"Only dependencies from typeshed are supported, got {stripped}"
189185
if relation:
190186
msg = f"Bad version in dependency {dep}"
191187
assert relation in {"==", ">", ">=", "<", "<="}, msg

0 commit comments

Comments
 (0)