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
[pre-commit.ci] pre-commit autoupdate #5645
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5645 +/- ##
========================================
Coverage 89.84% 89.84%
========================================
Files 608 608
Lines 51693 51876 +183
========================================
+ Hits 46441 46607 +166
- Misses 5252 5269 +17
... and 32 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
The fail comes from this rule: https://beta.ruff.rs/docs/rules/no-explicit-stacklevel/ |
Step toward napari#5645 only touching a few file to make review easier
e7f7b91
to
46fdfb4
Compare
7acad91
to
eaa28a8
Compare
napari/__init__.pyi
Outdated
Viewer = ... | ||
current_viewer = ... | ||
|
||
gui_qt = napari._qt.qt_event_loop.gui_qt | ||
run = napari._qt.qt_event_loop.run | ||
save_layers = napari.plugins.io.save_layers | ||
gui_qt = ... | ||
run = ... | ||
save_layers = ... | ||
|
||
view_image = napari.view_layers.view_image | ||
view_labels = napari.view_layers.view_labels | ||
view_path = napari.view_layers.view_path | ||
view_points = napari.view_layers.view_points | ||
view_shapes = napari.view_layers.view_shapes | ||
view_surface = napari.view_layers.view_surface | ||
view_tracks = napari.view_layers.view_tracks | ||
view_vectors = napari.view_layers.view_vectors | ||
view_image = ... | ||
view_labels = ... | ||
view_path = ... | ||
view_points = ... | ||
view_shapes = ... | ||
view_surface = ... | ||
view_tracks = ... | ||
view_vectors = ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this changes are caused by https://beta.ruff.rs/docs/rules/#flake8-pyi-pyi PYI015 that is implementation of rule Y015 form https://pypi.org/project/flake8-pyi/
At this moment I do not understand the motivation for this change. But will try to investigate this.
But in general, I think this change should be reverted, and maybe just rules skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not seem like a bad rule to me in general, I just don't understand the fix O.o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just use implicit reexport https://mypy.readthedocs.io/en/stable/config_file.html#confval-implicit_reexport that is treated as valid by mypy so do not changed by ruff
It was also mentioned here https://scientific-python.org/specs/spec-0001/#type-checkers
It was split on multiple lines because ruff configuration combine-as-imports
is set by default to false.
Step toward napari#5645 only touching a few file to make review easier
Step toward napari#5645 only touching a few file to make review easier
096af54
to
dcb4521
Compare
updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.256 → v0.0.261](astral-sh/ruff-pre-commit@v0.0.256...v0.0.261)
dcb4521
to
efa85f5
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Step toward #5645 only touching a few file to make review easier New pre-commit configuration (new version of ruff) requires warnings to have a stacklevel.
napari/__init__.pyi
Outdated
from napari.view_layers import ( | ||
view_image as view_image, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from napari.view_layers import ( | |
view_image as view_image, | |
) | |
from napari.view_layers import view_image |
??? I don't understand this at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry, I missed the above links because they related to a different kind of change. But I still don't like this...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. The currently this syntax is enforced by "PYI015" https://beta.ruff.rs/docs/rules/#flake8-pyi-pyi rule of ruff.
Unfortunately, this rule does not accept __all__
even when mypy accepts it.
But the current code was wrong as it does not contain explicit reexport or __all__
.
I'm open to disabling "PYI015". But I also see profit from enforcing this rule. It will be nice to hear from other core devs (I will merge this PR on Sunday, but if there is no feedback immediately will open a followup).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I also see profit from enforcing this rule.
Such as...? 😂 I prefer __all__
by a significant margin... As in my other reviews... Code should be obvious in what it does... I suspect I would not be the first person to be totally baffled by these lines. I also think that we should combine the import lines so that we don't have so many
from X import (
Y as Y
)
It's really quite horrible imho!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple import as comes from ruff configuration https://beta.ruff.rs/docs/settings/#combine-as-imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have combined imports. I will merge in about 12h to be before the automatic update. Then I will open the Issue for a longer discussion.
Step toward #5645 only touching a few file to make review easier New pre-commit configuration (new version of ruff) requires warnings to have a stacklevel.
<!--pre-commit.ci start--> updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.256 → v0.0.261](astral-sh/ruff-pre-commit@v0.0.256...v0.0.261) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Step toward #5645 only touching a few file to make review easier New pre-commit configuration (new version of ruff) requires warnings to have a stacklevel.
<!--pre-commit.ci start--> updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.256 → v0.0.261](astral-sh/ruff-pre-commit@v0.0.256...v0.0.261) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Step toward #5645 only touching a few file to make review easier New pre-commit configuration (new version of ruff) requires warnings to have a stacklevel.
<!--pre-commit.ci start--> updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.256 → v0.0.261](astral-sh/ruff-pre-commit@v0.0.256...v0.0.261) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Step toward #5645 only touching a few file to make review easier New pre-commit configuration (new version of ruff) requires warnings to have a stacklevel.
<!--pre-commit.ci start--> updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.256 → v0.0.261](astral-sh/ruff-pre-commit@v0.0.256...v0.0.261) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
updates: