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: Add explicit level to warn. #5649

Merged
merged 1 commit into from
Apr 13, 2023
Merged

MAINT: Add explicit level to warn. #5649

merged 1 commit into from
Apr 13, 2023

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Mar 21, 2023

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.

@Carreau Carreau changed the title Add explicit level to warn. MAINT: Add explicit level to warn. Mar 21, 2023
@Carreau Carreau marked this pull request as ready for review March 21, 2023 10:45
@Czaki
Copy link
Collaborator

Czaki commented Mar 21, 2023

It is not all warnings pointed by pre-commit. Is it intentional?

@Carreau
Copy link
Contributor Author

Carreau commented Mar 21, 2023

Yes. It's to make review and merging easier, and decrease the chances of conflict with other PRs and make the chances of it getting merge a bit higher.

I don't think many reviewers want to have a PR that touch 35 files and have 70+ updates like this.

@@ -58,7 +58,7 @@
deferred=True,
version=QtCore.__version__,
)
warn(message=warn_message)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why stacklevel=1 when it is executed on import so it will be nice to have information where import happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding was that stacklevel does not work on import and ends up in the CPython import machinery.

I'm also unsure the error message would be useful as it would not point to an actual error the user is doing on the line of the import, but I can still put 2.

Comment on lines +509 to +518
stacklevel=1,
)
self._console = None
except ImportError:
traceback.print_exc()
warnings.warn(
trans._(
'error importing napari-console. See console for full error.'
)
),
stacklevel=1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe stacklevel=2? But I'm not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put 1 as it's property and pointing at the line with the property might be unclear. But sure.

@github-actions github-actions bot added qt Relates to qt tests Something related to our tests labels Mar 21, 2023
@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Merging #5649 (ba691ab) into main (f9e7324) will increase coverage by 1.37%.
The diff coverage is 33.33%.

❗ Current head ba691ab differs from pull request most recent head 655b44a. Consider uploading reports for the commit 655b44a to get more accurate results

@@            Coverage Diff             @@
##             main    #5649      +/-   ##
==========================================
+ Coverage   88.37%   89.75%   +1.37%     
==========================================
  Files         611      611              
  Lines       51685    51558     -127     
==========================================
+ Hits        45679    46275     +596     
+ Misses       6006     5283     -723     
Impacted Files Coverage Δ
napari/__main__.py 44.76% <0.00%> (+0.27%) ⬆️
napari/_qt/__init__.py 56.66% <0.00%> (+6.66%) ⬆️
napari/_qt/qt_event_loop.py 80.27% <ø> (+0.68%) ⬆️
napari/_qt/qt_viewer.py 79.69% <ø> (+0.37%) ⬆️
napari/_qt/_tests/test_qt_notifications.py 96.02% <100.00%> (ø)

... and 93 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.

napari/_qt/__init__.py Show resolved Hide resolved
Comment on lines +509 to +518
stacklevel=1,
)
self._console = None
except ImportError:
traceback.print_exc()
warnings.warn(
trans._(
'error importing napari-console. See console for full error.'
)
),
stacklevel=1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put 1 as it's property and pointing at the line with the property might be unclear. But sure.

napari/_qt/qt_viewer.py Show resolved Hide resolved
@Czaki
Copy link
Collaborator

Czaki commented Apr 4, 2023

Maybe merge main branch to pr to remove changes not related to PR?

@github-actions github-actions bot added the preferences Issues relating to the creation of new preference fields/panels label Apr 4, 2023
Step toward napari#5645 only touching a few file to make review easier
@Carreau
Copy link
Contributor Author

Carreau commented Apr 4, 2023

Maybe merge main branch to pr to remove changes not related to PR?

Yeah, github's update with rebase button is broken. I had to re-rebase manually a bunch of branches.

@jni jni added the ready to merge Last chance for comments! Will be merged in ~24h label Apr 5, 2023
@Carreau Carreau removed the preferences Issues relating to the creation of new preference fields/panels label Apr 5, 2023
@Czaki Czaki merged commit 5a4e0a8 into napari:main Apr 13, 2023
@Czaki Czaki removed the ready to merge Last chance for comments! Will be merged in ~24h label Apr 13, 2023
@Carreau
Copy link
Contributor Author

Carreau commented Apr 17, 2023

Thanks !

@Czaki Czaki added the maintenance PR with maintance changes, label Apr 17, 2023
@Czaki Czaki mentioned this pull request Jun 7, 2023
@Czaki Czaki added this to the 0.4.18 milestone Jun 16, 2023
Czaki pushed a commit that referenced this pull request Jun 19, 2023
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.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
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.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
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.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance PR with maintance changes, qt Relates to qt tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants