Skip to content

Commit

Permalink
Make stubs installable from github (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 7, 2024
1 parent 090b434 commit 97e16f0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ bld/
[Oo]bj/
[Ll]og/
[Ll]ogs/
[Bb]uild/

# JetBrains
.idea
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ We recognize that there may be cases where type stubs are more appropriate, such
- Package authors who do not want to include type annotations, and
- Large, complex packages where adding type annotations can take time, and stubs may be an appropriate intermediate step.

## Installing our stubs

Whilst these stubs come bundled with Pylance, we recognize it can be beneficial to install them
so that type-checkers such as [Pyright](https://github.com/microsoft/pyright) and [mypy](https://github.com/python/mypy) pick up on them.
The stubs are not currently published on PyPI, but you can install them all at once with:

```shell
pip install git+https://github.com/microsoft/python-type-stubs.git
```

## Upstreamed libraries

Stubs for the following libraries now exist in typeshed or the libraries themselves and are no longer maintained here:
Expand All @@ -52,7 +62,7 @@ Stubs for the following libraries now exist in typeshed or the libraries themsel
- pygame
- pywin32 (pythonwin, win32 and win32com packages)
- retry
- scipy (see https://github.com/jorenham/scipy-stubs)
- scipy (see <https://github.com/jorenham/scipy-stubs>)
- slugify
- SQLAlchemy (see <https://pypi.org/project/types-SQLAlchemy/> for SQLAlchemy 1.4; 2.0.0 and above include type annotations)
- tenacity
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
[build-system]
requires = ["setuptools >= 69.0"] # v69 includes type information by default
build-backend = "setuptools.build_meta"

[project]
name="microsoft-python-type-stubs"
dynamic = ["version"]

# Allow these stubs to be installed from GitHub
# We need an explicit mapping instead of just
# [tool.setuptools]
# package-dir = {"" = "stubs"}
# because the folder names don't all match "*-stubs"
# see https://github.com/microsoft/python-type-stubs/issues/315
[tool.setuptools.package-dir]
# See README.md as to why matplotlib is not included
"networkx-stubs" = "stubs/networkx"
"skimage-stubs" = "stubs/skimage"
"sklearn-stubs" = "stubs/sklearn"
"sympy-stubs" = "stubs/sympy-stubs"
"transformers-stubs" = "stubs/transformers-stubs"
"vispy-stubs" = "stubs/vispy"

[tool.ruff]
line-length = 130
# Target oldest supported Python version
Expand Down

0 comments on commit 97e16f0

Please sign in to comment.