Skip to content

Commit 1fa4986

Browse files
authored
Move common utility functions to a common library (#12773)
1 parent 407eeaa commit 1fa4986

21 files changed

+31
-31
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ __pycache__/
88
# Distribution / packaging
99
.Python
1010
/env/
11-
/build/
11+
/lib/build/
1212
/develop-eggs/
1313
/dist/
1414
/downloads/
1515
/eggs/
16-
/lib/
1716
/lib64/
1817
/parts/
1918
/sdist/

lib/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Utilities for typeshed infrastructure scripts.

lib/ts_utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Utilities for typeshed infrastructure scripts."""

tests/_metadata.py renamed to lib/ts_utils/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from packaging.specifiers import Specifier
2020
from packaging.version import Version
2121

22-
from _utils import cache
22+
from .utils import cache
2323

2424
__all__ = [
2525
"NoSuchStubError",

lib/ts_utils/py.typed

Whitespace-only changes.
File renamed without changes.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ extra-standard-library = [
162162
"pyexpat",
163163
"zoneinfo",
164164
]
165-
known-first-party = ["_metadata", "_utils"]
165+
known-first-party = ["ts_utils", "_utils"]
166166

167167
[tool.typeshed]
168168
oldest_supported_python = "3.8"

pyrightconfig.scripts_and_tests.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
33
"typeshedPath": ".",
44
"include": [
5+
"lib",
56
"scripts",
67
"tests",
78
],
9+
"extraPaths": [
10+
"lib",
11+
],
812
"typeCheckingMode": "strict",
913
// More of a lint. Unwanted for typeshed's own code.
1014
"reportImplicitStringConcatenation": "none",

requirements-tests.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ tomli==2.0.2
2222
tomlkit==0.13.2
2323
typing_extensions>=4.12.0rc1
2424
uv==0.4.18
25+
26+
# Utilities for typeshed infrastructure scripts.
27+
ts_utils @ file:lib

scripts/stubsabot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ async def get_github_repo_info(session: aiohttp.ClientSession, stub_info: StubIn
312312
Else, return None.
313313
"""
314314
if stub_info.upstream_repository:
315-
# We have various sanity checks for the upstream_repository field in tests/_metadata.py,
315+
# We have various sanity checks for the upstream_repository field in ts_utils.metadata,
316316
# so no need to repeat all of them here
317317
split_url = urllib.parse.urlsplit(stub_info.upstream_repository)
318318
if split_url.netloc == "github.com":

0 commit comments

Comments
 (0)