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
27 changes: 8 additions & 19 deletions stub_uploader/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
Basic script to generate a wheel for a third-party distribution in typeshed.
This generates a PEP 561 types stub package using METADATA.toml file for a given
distribution in typeshed stubs. Such package
can be used by type-checking tools like
[mypy](https://github.com/python/mypy/),
[pyright](https://github.com/microsoft/pyright),
[pytype](https://github.com/google/pytype/),
PyCharm, etc. to check code that uses
the corresponding runtime Python package.
distribution in typeshed stubs. Such package can be used by type checkers
to check code that uses the corresponding runtime Python package.
The generated wheel includes all type stubs (*.pyi files) and the METADATA.toml
itself, no other files can be included.
Expand Down Expand Up @@ -102,14 +97,9 @@
DESCRIPTION_INTRO_TEMPLATE = """
## Typing stubs for {distribution}
This is a [PEP 561](https://peps.python.org/pep-0561/)
type stub package for the {formatted_distribution} package.
It can be used by type-checking tools like
[mypy](https://github.com/python/mypy/),
[pyright](https://github.com/microsoft/pyright),
[pytype](https://github.com/google/pytype/),
[Pyre](https://pyre-check.org/),
PyCharm, etc. to check code that uses `{distribution}`. This version of
This is a [PEP 561](https://peps.python.org/pep-0561/) type stub package for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of linking to the spec (https://typing.python.org/en/latest/spec/distributing.html#type-information-in-libraries) instead of PEP 561? PEPs are not ongoing documentation after all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a link to "partial" that needs to be replaced. But let me do that in a followup PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the {formatted_distribution} package. It can be used by type checkers
to check code that uses `{distribution}`. This version of
`{stub_distribution}` aims to provide accurate annotations for
`{distribution}{typeshed_version_spec}`.
""".strip()
Expand All @@ -122,10 +112,9 @@
[`stubs/{distribution}`](https://github.com/python/typeshed/tree/main/stubs/{distribution})
directory.
This package was tested with
mypy {ts_data.mypy_version},
pyright {ts_data.pyright_version},
and pytype {ts_data.pytype_version}.
This package was tested with the following type checkers:
* [mypy](https://github.com/python/mypy/) {ts_data.mypy_version}
* [pyright](https://github.com/microsoft/pyright) {ts_data.pyright_version}
It was generated from typeshed commit
[`{commit}`](https://github.com/python/typeshed/commit/{commit}).
""".strip()
Expand Down
2 changes: 0 additions & 2 deletions stub_uploader/ts_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class TypeshedData:
typeshed_path: Path
mypy_version: Version
pyright_version: Version
pytype_version: Version
oldest_supported_python: str

def read_current_commit(self) -> str:
Expand All @@ -48,7 +47,6 @@ def read_typeshed_data(typeshed_path: Path) -> TypeshedData:
typeshed_path=typeshed_path,
mypy_version=Version(requirements["mypy"]),
pyright_version=Version(requirements["pyright"]),
pytype_version=Version(requirements["pytype"]),
oldest_supported_python=typeshed_table["oldest_supported_python"],
)

Expand Down
5 changes: 0 additions & 5 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,12 @@ def _build_requirements(
*,
mypy: str | None = "1.11.1",
pyright: str | None = "1.1.381",
pytype: (
str | None
) = '2024.9.13; platform_system != "Windows" and python_version < "3.13"',
) -> str:
req = _REQUIREMENTS_TXT
if mypy is not None:
req += f"\nmypy=={mypy}"
if pyright is not None:
req += f"\npyright=={pyright}"
if pytype is not None:
req += f"\npytype=={pytype}"
return req


Expand Down