8000 DOC: local py.typed for users by twoertwein · Pull Request #44228 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DOC: local py.typed for users #44228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
DOC: local py.typed for development and users
  • Loading branch information
twoertwein committed Dec 11, 2021
commit 40cb8ae2cf043c404d2e668400a65c09e560699e
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ dist
*.egg-info
.eggs
.pypirc
# type checkers
pandas/py.typed

# tox testing tool
.tox
Expand Down
13 changes: 13 additions & 0 deletions doc/source/development/contributing_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,16 @@ should already exist.
# Build and install pandas
python setup.py build_ext -j 4
python -m pip install -e . --no-build-isolation --no-use-pep517


VSCode Integration
------------------

Since pandas is not a py.typed library, pyright ships with its own type annotations for pandas.
This break "Go to definition" in VSCode for the pandas code base. You can create an empty py.typed
file to claim that pandas is a py.typed library to make type checkers (including pyright) prioritize
pandas's own type annotations. This makes "Go to definition" work as expected in VSCode.

.. code-block:: none

python -c "import pathlib; pathlib.Path('pandas/py.typed').touch()"
13 changes: 13 additions & 0 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,16 @@ qtpy Clipboard I/O
xclip Clipboard I/O on linux
xsel Clipboard I/O on linux
========================= ================== =============================================================

Type annotations
----------------

.. warning::

* Pandas is not yet a py.typed library (see `PEP 561 <https://www.python.org/dev/peps/pep-0561/>`)!

To make type checkers aware of pandas's own type annotations, you can create an empty py.typed.

.. code-block:: none

python -c "import pandas; import pathlib; (pathlib.Path(pandas.__path__[0]) / 'py.typed').touch()"
0