Skip to content

Conversation

@twoertwein
Copy link
Member

Ruff has many "unsafe" autofixes for simple return types.

I hope to enable --unsafe-fixes (for only the type annotations) after a few PRs.

@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Dec 19, 2023
@mroeschke mroeschke added this to the 2.2 milestone Dec 19, 2023
@mroeschke mroeschke merged commit 854012c into pandas-dev:main Dec 19, 2023
@mroeschke
Copy link
Member

Thanks @twoertwein

@jorisvandenbossche
Copy link
Member

Is it needed to add -> None to test functions? (generally our test_.. test functions don't have any type annotations at all, I think?)

@twoertwein
Copy link
Member Author

Is it needed to add -> None to test functions? (generally our test_.. test functions don't have any type annotations at all, I think?)

I think it would be good to exclude pandas/tests (and scripts/tests - happy to revert that) from these ruff fixes! I don't think it would add value for the tests (unless people prefer it for consistency).

However, manually adding annotations for tests can be valuable to selectively allow mypy to run on some tests to help with #45252. I believe most test files are completely ignored and unannotated functions are anyways skipped: so we could use -> None to run mypy on a subset of tests within a file.

cbpygit pushed a commit to cbpygit/pandas that referenced this pull request Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Typing type annotations, mypy/pyright type checking

3 participants