Skip to content
New issue

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

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

Already on GitHub? # to your account

chore[python]: Turn on mypy strict mode #4415

Merged
merged 4 commits into from
Aug 15, 2022
Merged
Changes from 3 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
25 changes: 10 additions & 15 deletions py-polars/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,7 @@ profile = "black"
files = ["polars", "tests"]
namespace_packages = true
show_error_codes = true

warn_unused_configs = true
disallow_subclassing_any = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_unused_ignores = true
strict_concatenate = true
# TODO: Uncomment flags below and fix mypy errors
disallow_any_generics = true
disallow_untyped_calls = true
warn_redundant_casts = true
# warn_return_any = true
no_implicit_reexport = true
strict_equality = true
# TODO: When all flags are enabled, replace by strict = true
strict = true
enable_error_code = [
"redundant-expr",
"truthy-bool",
Expand All @@ -53,6 +39,15 @@ enable_error_code = [
module = ["pyarrow.*", "polars.polars", "matplotlib.*", "fsspec.*", "connectorx", "IPython.*"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = ["polars.*", "fsspec.*", "pyarrow.*"]
# We exclude the polars module from warn_return_any, because the PyO3 api does not have Python
# type annotations. See https://github.com/PyO3/pyo3/issues/1112 for a discussion on adding
# this capability. We could add a stub file for polars.polars (the PyO3 api), but that
# amounts to duplicating almost all type annotations on our api, as the Python api itself is a
# thin wrapper around the PyO3 api to start with.
warn_return_any = false

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
Expand Down