Skip to content

CI/TYP: run pyright at manual stage in pre-commit #43799

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 5 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
with:
fetch-depth: 0

- name: numpy>=1.21.0 for type checkers
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm this is very fragile if we change this

Copy link
Member

Choose a reason for hiding this comment

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

Adding on to this. Can we just make two conda envs in the CI, one for typing and one for everything else?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, we don't need this to force numpy>1.21.0 because pip/conda already pick numpy 1.21.*.

We could simply remove this change. If at some point the CI picks a too old numpy, we will know very quickly.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is probably best to decouple the CI-change from the pre-commit change. I will remove the CI-changes from this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

if you saw #43804 numpy gets installed <1.21 since that is a numba requirement when resolving dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

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

if you saw #43804 numpy gets installed <1.21 since that is a numba requirement when resolving dependencies.

Yes, that is why I tried to add this line, but it seems the CI prefers an older numba in favor of a newer numpy :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Just to be clear, the goal of this PR has changed from "having numpy>1.21. on the CI and for pre-commit" to "not having pyright as a mandatory part of pre-commit".

run: sed -i "s/numpy>=1.18.5/numpy>=1.21.0/g" ${{ env.ENV_FILE }}

- name: Cache conda
uses: actions/cache@v2
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
concurrency:
group: ${{ github.ref }}-pre-commit
cancel-in-progress: ${{github.event_name == 'pull_request'}}
env:
SKIP: pyright
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ repos:
language: node
pass_filenames: false
types: [python]
stages: [manual]
# note: keep version in sync with .github/workflows/ci.yml
additional_dependencies: ['[email protected]']
- repo: local
Expand Down
4 changes: 3 additions & 1 deletion doc/source/development/contributing_codebase.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,12 @@ pandas uses `mypy <http://mypy-lang.org>`_ and `pyright <https://github.com/micr
mypy pandas

# let pre-commit setup and run pyright
pre-commit run --all-files pyright
pre-commit run --hook-stage manual --all-files pyright
# or if pyright is installed (requires node.js)
pyright

Please make sure to have ``numpy>=1.21.0`` installed when validating types, since this is the first version that provides ``numpy.typing``.

.. _contributing.ci:

Testing with continuous integration
Expand Down