Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ supported:
When the stubs are updated to a newer version
of the library, the version of the stub should be bumped (note that
previous versions are still available on PyPI).
* `requires` (optional): A list of other stub packages or packages with type
* `dependencies` (optional): A list of other stub packages or packages with type
information that are imported by the stubs in this package. Only packages
generated by typeshed or required by the upstream package are allowed to
be listed here, for security reasons. See
Expand Down Expand Up @@ -202,9 +202,9 @@ This has the following keys:
`--ignore_missing_stub` option to the stubtest call. See
[tests/README.md](./tests/README.md) for more information. In most cases,
this field should be identical to `partial_stub`.
* `stubtest_requirements` (default: `[]`): A list of Python packages that need
* `stubtest_dependencies` (default: `[]`): A list of Python packages that need
to be installed for stubtest to run successfully. These packages are installed
in addition to the requirements in the `requires` field.
in addition to the dependencies in the `dependencies` field.
* `apt_dependencies` (default: `[]`): A list of Ubuntu APT packages
that need to be installed for stubtest to run successfully.
* `brew_dependencies` (default: `[]`): A list of MacOS Homebrew packages
Expand Down
28 changes: 14 additions & 14 deletions lib/ts_utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class StubtestSettings:
ignore_missing_stub: bool
supported_platforms: list[str] | None # None means all platforms
ci_platforms: list[str]
stubtest_requirements: list[str]
stubtest_dependencies: list[str]
mypy_plugins: list[str]
mypy_plugins_config: dict[str, dict[str, Any]]

Expand All @@ -109,7 +109,7 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
ignore_missing_stub: object = data.get("ignore_missing_stub", False)
supported_platforms: object = data.get("supported_platforms")
ci_platforms: object = data.get("ci_platforms", DEFAULT_STUBTEST_PLATFORMS)
stubtest_requirements: object = data.get("stubtest_requirements", [])
stubtest_dependencies: object = data.get("stubtest_dependencies", [])
mypy_plugins: object = data.get("mypy_plugins", [])
mypy_plugins_config: object = data.get("mypy_plugins_config", {})

Expand All @@ -123,7 +123,7 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
assert _is_list_of_strings(brew_dependencies)
assert _is_list_of_strings(choco_dependencies)
assert _is_list_of_strings(extras)
assert _is_list_of_strings(stubtest_requirements)
assert _is_list_of_strings(stubtest_dependencies)
assert _is_list_of_strings(mypy_plugins)
assert _is_nested_dict(mypy_plugins_config)

Expand Down Expand Up @@ -151,7 +151,7 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
ignore_missing_stub=ignore_missing_stub,
supported_platforms=supported_platforms,
ci_platforms=ci_platforms,
stubtest_requirements=stubtest_requirements,
stubtest_dependencies=stubtest_dependencies,
mypy_plugins=mypy_plugins,
mypy_plugins_config=mypy_plugins_config,
)
Expand All @@ -174,7 +174,7 @@ class StubMetadata:

distribution: Annotated[str, "The name of the distribution on PyPI"]
version_spec: Annotated[Specifier, "Upstream versions that the stubs are compatible with"]
requires: Annotated[list[Requirement], "The parsed requirements as listed in METADATA.toml"]
dependencies: Annotated[list[Requirement], "The parsed dependencies as listed in METADATA.toml"]
extra_description: str | None
stub_distribution: Annotated[str, "The name under which the distribution is uploaded to PyPI"]
upstream_repository: Annotated[str, "The URL of the upstream repository"] | None
Expand All @@ -193,7 +193,7 @@ def is_obsolete(self) -> bool:
_KNOWN_METADATA_FIELDS: Final = frozenset(
{
"version",
"requires",
"dependencies",
"extra_description",
"stub_distribution",
"upstream_repository",
Expand All @@ -216,7 +216,7 @@ def is_obsolete(self) -> bool:
"ignore_missing_stub",
"supported_platforms",
"ci_platforms",
"stubtest_requirements",
"stubtest_dependencies",
"mypy_plugins",
"mypy_plugins_config",
}
Expand All @@ -235,7 +235,7 @@ def read_metadata(distribution: str) -> StubMetadata:
This function does some basic validation,
but does no parsing, transforming or normalization of the metadata.
Use `read_dependencies` if you need to parse the dependencies
given in the `requires` field, for example.
given in the `dependencies` field, for example.
"""
try:
with metadata_path(distribution).open("rb") as f:
Expand All @@ -255,9 +255,9 @@ def read_metadata(distribution: str) -> StubMetadata:
version_spec = Specifier(version)
assert version_spec.operator in {"==", "~="}, f"Invalid 'version' field in METADATA.toml for {distribution!r}"

requires_s: object = data.get("requires", []) # pyright: ignore[reportUnknownMemberType]
assert isinstance(requires_s, list)
requires = [parse_requires(distribution, req) for req in requires_s]
dependencies_s: object = data.get("dependencies", []) # pyright: ignore[reportUnknownMemberType]
assert isinstance(dependencies_s, list)
dependencies = [parse_dependencies(distribution, dep) for dep in dependencies_s]

extra_description: object = data.get("extra_description") # pyright: ignore[reportUnknownMemberType]
assert isinstance(extra_description, (str, type(None)))
Expand Down Expand Up @@ -336,7 +336,7 @@ def read_metadata(distribution: str) -> StubMetadata:
return StubMetadata(
distribution=distribution,
version_spec=version_spec,
requires=requires,
dependencies=dependencies,
extra_description=extra_description,
stub_distribution=stub_distribution,
upstream_repository=upstream_repository,
Expand Down Expand Up @@ -366,7 +366,7 @@ def update_metadata(distribution: str, **new_values: object) -> tomlkit.TOMLDocu
return data


def parse_requires(distribution: str, req: object) -> Requirement:
def parse_dependencies(distribution: str, req: object) -> Requirement:
assert isinstance(req, str), f"Invalid requirement {req!r} for {distribution!r}"
return Requirement(req)

Expand Down Expand Up @@ -398,7 +398,7 @@ def read_dependencies(distribution: str) -> PackageDependencies:
pypi_name_to_typeshed_name_mapping = get_pypi_name_to_typeshed_name_mapping()
typeshed: list[Requirement] = []
external: list[Requirement] = []
for dependency in read_metadata(distribution).requires:
for dependency in read_metadata(distribution).dependencies:
if dependency.name in pypi_name_to_typeshed_name_mapping:
req = Requirement(str(dependency)) # copy the requirement
req.name = pypi_name_to_typeshed_name_mapping[dependency.name]
Expand Down
2 changes: 1 addition & 1 deletion stubs/Authlib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.6.9"
upstream_repository = "https://github.com/authlib/authlib"
requires = ["cryptography"]
dependencies = ["cryptography"]
2 changes: 1 addition & 1 deletion stubs/Deprecated/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "~=1.3.1"
upstream_repository = "https://github.com/laurent-laporte-pro/deprecated"
requires = []
dependencies = []
2 changes: 1 addition & 1 deletion stubs/Flask-Cors/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "6.0.*"
upstream_repository = "https://github.com/corydolphin/flask-cors"
# Requires a version of flask with a `py.typed` file
requires = ["Flask>=2.0.0"]
dependencies = ["Flask>=2.0.0"]
2 changes: 1 addition & 1 deletion stubs/Flask-Migrate/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "4.1.*"
upstream_repository = "https://github.com/miguelgrinberg/Flask-Migrate"
# Requires versions of flask and Flask-SQLAlchemy with `py.typed` files
requires = ["Flask-SQLAlchemy>=3.0.1", "Flask>=2.0.0"]
dependencies = ["Flask-SQLAlchemy>=3.0.1", "Flask>=2.0.0"]
2 changes: 1 addition & 1 deletion stubs/Flask-SocketIO/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "5.6.*"
requires = ["Flask>=0.9"]
dependencies = ["Flask>=0.9"]
upstream_repository = "https://github.com/miguelgrinberg/flask-socketio"
2 changes: 1 addition & 1 deletion stubs/JACK-Client/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = "0.5.*"
upstream_repository = "https://github.com/spatialaudio/jackclient-python"
# Requires a version of numpy with a `py.typed` file
requires = ["numpy>=1.20", "types-cffi"]
dependencies = ["numpy>=1.20", "types-cffi"]

[tool.stubtest]
# darwin and win32 are equivalent
Expand Down
2 changes: 1 addition & 1 deletion stubs/PyAutoGUI/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "0.9.*"
upstream_repository = "https://github.com/asweigart/pyautogui"
requires = ["types-PyScreeze"]
dependencies = ["types-PyScreeze"]
4 changes: 2 additions & 2 deletions stubs/PyScreeze/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version = "1.0.1"
upstream_repository = "https://github.com/asweigart/pyscreeze"
requires = ["Pillow>=10.3.0"]
dependencies = ["Pillow>=10.3.0"]

[tool.stubtest]
# Linux has extra constants, win32 has different definitions
ci_platforms = ["linux", "win32"]
# PyScreeze has an odd setup.py file
# that doesn't list Pillow as a dependency for py312+ yet:
# https://github.com/asweigart/pyscreeze/blob/eeca245a135cf171c163b3691300138518efa64e/setup.py#L38-L46
stubtest_requirements = ["Pillow"]
stubtest_dependencies = ["Pillow"]
4 changes: 2 additions & 2 deletions stubs/Pygments/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = "2.19.*"
upstream_repository = "https://github.com/pygments/pygments"
requires = ["types-docutils"]
dependencies = ["types-docutils"]
partial_stub = true

[tool.stubtest]
stubtest_requirements = ["sphinx"]
stubtest_dependencies = ["sphinx"]
ignore_missing_stub = true
2 changes: 1 addition & 1 deletion stubs/WTForms/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "~= 3.2.1"
upstream_repository = "https://github.com/pallets-eco/wtforms"
requires = ["MarkupSafe"]
dependencies = ["MarkupSafe"]
2 changes: 1 addition & 1 deletion stubs/auth0-python/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "4.10.*"
upstream_repository = "https://github.com/auth0/auth0-python"
requires = ["cryptography", "types-requests"]
dependencies = ["cryptography", "types-requests"]
2 changes: 1 addition & 1 deletion stubs/bleach/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = "6.3.*"
requires = ["types-html5lib"]
dependencies = ["types-html5lib"]
upstream_repository = "https://github.com/mozilla/bleach"

[tool.stubtest]
Expand Down
2 changes: 1 addition & 1 deletion stubs/cffi/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "2.0.*"
upstream_repository = "https://github.com/python-cffi/cffi/"
requires = ["types-setuptools"]
dependencies = ["types-setuptools"]

[tool.stubtest]
# linux and darwin are mostly equivalent, except for a single `RTLD_DEEPBIND` variable
Expand Down
4 changes: 2 additions & 2 deletions stubs/channels/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = "4.3.*"
upstream_repository = "https://github.com/django/channels"
requires = ["django-stubs>=4.2", "asgiref"]
dependencies = ["django-stubs>=4.2", "asgiref"]

[tool.stubtest]
mypy_plugins = ['mypy_django_plugin.main']
mypy_plugins_config = {"django-stubs" = {"django_settings_module" = "@tests.django_settings"}}
stubtest_requirements = ["daphne"]
stubtest_dependencies = ["daphne"]
2 changes: 1 addition & 1 deletion stubs/click-default-group/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.2.*"
upstream_repository = "https://github.com/click-contrib/click-default-group"
# requires a version of click with a py.typed
requires = ["click>=8.0.0"]
dependencies = ["click>=8.0.0"]
2 changes: 1 addition & 1 deletion stubs/click-log/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "0.4.*"
requires = ["click>=8.0.0"]
dependencies = ["click>=8.0.0"]
upstream_repository = "https://github.com/click-contrib/click-log"
2 changes: 1 addition & 1 deletion stubs/click-shell/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "2.1"
upstream_repository = "https://github.com/clarkperkins/click-shell"
requires = ["click>=8.0.0"]
dependencies = ["click>=8.0.0"]
2 changes: 1 addition & 1 deletion stubs/click-web/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "0.8.*"
requires = ["click>=8.0.0", "Flask>=2.3.2"]
dependencies = ["click>=8.0.0", "Flask>=2.3.2"]
upstream_repository = "https://github.com/fredrik-corneliusson/click-web"
2 changes: 1 addition & 1 deletion stubs/defusedxml/METADATA.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ version = "0.7.*"
upstream_repository = "https://github.com/tiran/defusedxml"

[tool.stubtest]
stubtest_requirements = ["lxml"]
stubtest_dependencies = ["lxml"]
2 changes: 1 addition & 1 deletion stubs/django-filter/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "25.2.*"
upstream_repository = "https://github.com/carltongibson/django-filter/"
requires = ["django-stubs"]
dependencies = ["django-stubs"]

[tool.stubtest]
mypy_plugins = ["mypy_django_plugin.main"]
Expand Down
2 changes: 1 addition & 1 deletion stubs/django-import-export/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "4.4.*"
upstream_repository = "https://github.com/django-import-export/django-import-export"
requires = ["django-stubs"] # Add tablib when typed, and update _Incomplete aliases in stubs
dependencies = ["django-stubs"] # Add tablib when typed, and update _Incomplete aliases in stubs

[tool.stubtest]
skip = true # Django requires configured settings at runtime
2 changes: 1 addition & 1 deletion stubs/docker/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "7.1.*"
upstream_repository = "https://github.com/docker/docker-py"
requires = ["types-paramiko", "types-requests", "urllib3>=2"]
dependencies = ["types-paramiko", "types-requests", "urllib3>=2"]
2 changes: 1 addition & 1 deletion stubs/fanstatic/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.7.*"
upstream_repository = "https://github.com/zopefoundation/fanstatic"
requires = ["types-setuptools", "types-WebOb"]
dependencies = ["types-setuptools", "types-WebOb"]
2 changes: 1 addition & 1 deletion stubs/flake8-builtins/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "3.1.*"
upstream_repository = "https://github.com/gforcada/flake8-builtins"
requires = ["types-flake8"]
dependencies = ["types-flake8"]
2 changes: 1 addition & 1 deletion stubs/flake8-docstrings/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.7.*"
upstream_repository = "https://github.com/pycqa/flake8-docstrings"
requires = ["types-flake8"]
dependencies = ["types-flake8"]
2 changes: 1 addition & 1 deletion stubs/flake8/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "7.3.*"
upstream_repository = "https://github.com/pycqa/flake8"
requires = ["types-pyflakes"]
dependencies = ["types-pyflakes"]
4 changes: 2 additions & 2 deletions stubs/fpdf2/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = "2.8.4"
upstream_repository = "https://github.com/py-pdf/fpdf2"
requires = ["Pillow>=10.3.0"]
dependencies = ["Pillow>=10.3.0"]
obsolete_since = "2.8.6" # Released on 2026-02-19

[tool.stubtest]
stubtest_requirements = ["cryptography"]
stubtest_dependencies = ["cryptography"]
2 changes: 1 addition & 1 deletion stubs/geopandas/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "1.1.3"
# Requires a version of numpy with a `py.typed` file
requires = ["numpy>=1.20", "pandas-stubs", "types-shapely", "pyproj"]
dependencies = ["numpy>=1.20", "pandas-stubs", "types-shapely", "pyproj"]
upstream_repository = "https://github.com/geopandas/geopandas"

[tool.stubtest]
Expand Down
4 changes: 2 additions & 2 deletions stubs/gevent/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version = "25.9.*"
upstream_repository = "https://github.com/gevent/gevent"
requires = ["types-greenlet", "types-psutil>=7.2.0"]
dependencies = ["types-greenlet", "types-psutil>=7.2.0"]

[tool.stubtest]
# Run stubtest on all platforms, since there is some platform specific stuff
# especially in the stdlib module replacement
ci_platforms = ["linux", "darwin", "win32"]
# for testing the ffi loop implementations on all platforms
stubtest_requirements = ["cffi", "dnspython"]
stubtest_dependencies = ["cffi", "dnspython"]
apt_dependencies = ["libev4", "libev-dev", "libuv1", "libuv1-dev"]
brew_dependencies = ["libev", "libuv"]
2 changes: 1 addition & 1 deletion stubs/grpcio-channelz/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.*"
upstream_repository = "https://github.com/grpc/grpc"
requires = ["types-grpcio", "types-protobuf"]
dependencies = ["types-grpcio", "types-protobuf"]
2 changes: 1 addition & 1 deletion stubs/grpcio-health-checking/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.*"
upstream_repository = "https://github.com/grpc/grpc"
requires = ["types-grpcio", "types-protobuf"]
dependencies = ["types-grpcio", "types-protobuf"]
2 changes: 1 addition & 1 deletion stubs/grpcio-reflection/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.*"
upstream_repository = "https://github.com/grpc/grpc"
requires = ["types-grpcio", "types-protobuf"]
dependencies = ["types-grpcio", "types-protobuf"]
2 changes: 1 addition & 1 deletion stubs/grpcio-status/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.*"
upstream_repository = "https://github.com/grpc/grpc"
requires = ["types-grpcio"]
dependencies = ["types-grpcio"]
4 changes: 2 additions & 2 deletions stubs/gunicorn/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = "25.3.0"
upstream_repository = "https://github.com/benoitc/gunicorn"
requires = ["types-gevent"]
dependencies = ["types-gevent"]

[tool.stubtest]
supported_platforms = ["linux", "darwin"]
ci_platforms = ["linux", "darwin"]
stubtest_requirements = ["gevent>=1.4.0", "eventlet>=0.24.1,!=0.36.0", "tornado>=0.2", "setproctitle", "PasteDeploy", "inotify"]
stubtest_dependencies = ["gevent>=1.4.0", "eventlet>=0.24.1,!=0.36.0", "tornado>=0.2", "setproctitle", "PasteDeploy", "inotify"]
2 changes: 1 addition & 1 deletion stubs/hnswlib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "0.8.*"
# Requires a version of numpy with a `py.typed` file
requires = ["numpy>=1.21"]
dependencies = ["numpy>=1.21"]
upstream_repository = "https://github.com/nmslib/hnswlib"
2 changes: 1 addition & 1 deletion stubs/html5lib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "1.1.*"
upstream_repository = "https://github.com/html5lib/html5lib-python"
requires = ["types-webencodings"]
dependencies = ["types-webencodings"]

[tool.stubtest]
extras = ["all"]
2 changes: 1 addition & 1 deletion stubs/hvac/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "2.4.*"
upstream_repository = "https://github.com/hvac/hvac"
requires = ["types-requests"]
dependencies = ["types-requests"]
4 changes: 2 additions & 2 deletions stubs/icalendar/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = "6.3.2"
upstream_repository = "https://github.com/collective/icalendar"
requires = ["types-python-dateutil", "types-pytz"]
dependencies = ["types-python-dateutil", "types-pytz"]
obsolete_since = "7.0.0" # Released on 2026-02-11

[tool.stubtest]
stubtest_requirements = ["pytz"]
stubtest_dependencies = ["pytz"]
Loading
Loading