Skip to content

Commit 09e8fa9

Browse files
committed
Distribute and install py.typed to provide type information
Complies with PEP 561: https://www.python.org/dev/peps/pep-0561/#packaging-type-information By distributing and installing the py.typed file, mypy will use pip's type information when imported into other projects. For example, the pip-tools project can use pip's types and mypy to help verify correctness. mypy docs: https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages
1 parent b4fb710 commit 09e8fa9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def get_version(rel_path):
6868
exclude=["contrib", "docs", "tests*", "tasks"],
6969
),
7070
package_data={
71+
"pip": ["py.typed"],
7172
"pip._vendor": ["vendor.txt"],
7273
"pip._vendor.certifi": ["*.pem"],
7374
"pip._vendor.requests": ["*.pem"],

src/pip/py.typed

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pip is a command line program. While it is implemented in Python, and so is
2+
available for import, you must not use pip's internal APIs in this way. Typing
3+
information is provided as a convenience only and is not a gaurantee. Expect
4+
unannounced changes to the API and types in releases.

0 commit comments

Comments
 (0)