Skip to content

Commit 23f4e90

Browse files
committed
Make stubs installable from github
1 parent 53334cc commit 23f4e90

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ bld/
3030
[Oo]bj/
3131
[Ll]og/
3232
[Ll]ogs/
33+
[Bb]uild/
3334

3435
# JetBrains
3536
.idea

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ We recognize that there may be cases where type stubs are more appropriate, such
3030
- Package authors who do not want to include type annotations, and
3131
- Large, complex packages where adding type annotations can take time, and stubs may be an appropriate intermediate step.
3232

33+
## Installing our stubs
34+
35+
Whilst these stubs come bundled with Pylance, we recognize it can be beneficial to install them
36+
so that type-checkers such as [Pyright](https://github.com/microsoft/pyright) and [mypy](https://github.com/python/mypy) pick up on them.
37+
The stubs are not currently published on PyPI, but you can install them all at once with:
38+
39+
```shell
40+
pip install git+https://github.com/microsoft/python-type-stubs.git
41+
```
42+
3343
## Upstreamed libraries
3444

3545
Stubs for the following libraries now exist in typeshed or the libraries themselves and are no longer maintained here:
@@ -52,7 +62,7 @@ Stubs for the following libraries now exist in typeshed or the libraries themsel
5262
- pygame
5363
- pywin32 (pythonwin, win32 and win32com packages)
5464
- retry
55-
- scipy (see https://github.com/jorenham/scipy-stubs)
65+
- scipy (see <https://github.com/jorenham/scipy-stubs>)
5666
- slugify
5767
- SQLAlchemy (see <https://pypi.org/project/types-SQLAlchemy/> for SQLAlchemy 1.4; 2.0.0 and above include type annotations)
5868
- tenacity

pyproject.toml

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
[build-system]
2+
requires = ["setuptools >= 69.0"] # v69 includes type information by default
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name="microsoft-python-type-stubs"
7+
dynamic = ["version"]
8+
9+
# Allow these stubs to be installed from GitHub
10+
# We need an explicit mapping instead of just
11+
# [tool.setuptools]
12+
# package-dir = {"" = "stubs"}
13+
# because the folder names don't all match "*-stubs"
14+
# see https://github.com/microsoft/python-type-stubs/issues/315
15+
[tool.setuptools.package-dir]
16+
# See README.md as to why matplotlib is not included
17+
"networkx-stubs" = "stubs/networkx"
18+
"skimage-stubs" = "stubs/skimage"
19+
"sklearn-stubs" = "stubs/sklearn"
20+
"sympy-stubs" = "stubs/sympy-stubs"
21+
"transformers-stubs" = "stubs/transformers-stubs"
22+
"vispy-stubs" = "stubs/vispy"
23+
124
[tool.ruff]
225
line-length = 130
326
# Target oldest supported Python version

0 commit comments

Comments
 (0)