Skip to content
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

Maint: Typing and ImportError -> ModuleNotFoundError. #5431

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Dec 21, 2022

Module not found is more specific than Import Error, and allows to bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional import, as it may hide errors in Python install, using a explicit compare with sys.version_info, can allow some tools (like pyupgrade) to detect dead branches.

Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
@codecov
Copy link

codecov bot commented Dec 21, 2022

Codecov Report

Merging #5431 (4e07ad4) into main (6cd7f78) will decrease coverage by 0.06%.
The diff coverage is 88.88%.

@@            Coverage Diff             @@
##             main    #5431      +/-   ##
==========================================
- Coverage   89.16%   89.10%   -0.07%     
==========================================
  Files         584      597      +13     
  Lines       49515    50624    +1109     
==========================================
+ Hits        44151    45107     +956     
- Misses       5364     5517     +153     
Impacted Files Coverage Δ
napari/utils/_testsupport.py 63.84% <ø> (+0.28%) ⬆️
napari/utils/translations.py 94.54% <50.00%> (-1.73%) ⬇️
napari/utils/key_bindings.py 95.94% <100.00%> (+0.05%) ⬆️
napari/utils/naming.py 100.00% <100.00%> (ø)
napari/layers/tracks/_track_utils.py 88.06% <0.00%> (-3.41%) ⬇️
napari/utils/events/containers/_evented_dict.py 97.72% <0.00%> (-2.28%) ⬇️
napari/_qt/menus/file_menu.py 89.36% <0.00%> (-1.65%) ⬇️
napari/_qt/widgets/_tests/test_qt_play.py 96.38% <0.00%> (-1.21%) ⬇️
napari/utils/info.py 81.44% <0.00%> (-0.78%) ⬇️
... and 89 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Carreau Carreau marked this pull request as ready for review December 21, 2022 14:58
Copy link
Contributor

@liu-ziyang liu-ziyang left a comment

Choose a reason for hiding this comment

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

LGTM, curious what other core devs think

(I also see some harmless improvement in typing changes not captured in the PR description)

@liu-ziyang liu-ziyang merged commit 54ad969 into napari:main Dec 22, 2022
melissawm pushed a commit to melissawm/napari that referenced this pull request Jan 11, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
@Czaki Czaki mentioned this pull request Jun 7, 2023
@Czaki Czaki added this to the 0.4.18 milestone Jun 15, 2023
@Czaki Czaki added the maintenance PR with maintance changes, label Jun 15, 2023
Czaki pushed a commit that referenced this pull request Jun 16, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
Czaki pushed a commit that referenced this pull request Jun 17, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
Czaki pushed a commit that referenced this pull request Jun 18, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
Czaki pushed a commit that referenced this pull request Jun 19, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
Module not found is more specific than Import Error, and allows to
bubble errors when the issue is not that the module is not installed.

In the same vein it is an anti pattern to use try/except for conditional
import, as it may hide errors in Python install, using a explicit
compare with sys.version_info, can allow some tools (like pyupgrade) to
detect dead branches.
@Carreau Carreau deleted the main-typing branch October 2, 2023 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance PR with maintance changes,
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants