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

Add warning about set private attr when using proxy #5209

Merged
merged 4 commits into from Oct 18, 2022

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Oct 12, 2022

Description

extracted from #5195

Type of change

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

References

How has this been tested?

  • example: the test suite for my feature covers cases x, y, and z
  • example: all tests pass with my change
  • example: I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • If I included new strings, I have used trans. to make them localizable.
    For more information see our translations guide.

@Czaki Czaki requested a review from andy-sweet October 12, 2022 16:21
@github-actions github-actions bot added the tests Something related to our tests label Oct 12, 2022
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #5209 (3cd678a) into main (7117d22) will decrease coverage by 0.00%.
The diff coverage is 96.42%.

@@            Coverage Diff             @@
##             main    #5209      +/-   ##
==========================================
- Coverage   88.82%   88.82%   -0.01%     
==========================================
  Files         574      574              
  Lines       48912    48929      +17     
==========================================
+ Hits        43446    43459      +13     
- Misses       5466     5470       +4     
Impacted Files Coverage Δ
napari/utils/_proxies.py 93.65% <95.65%> (+0.31%) ⬆️
napari/utils/_tests/test_proxies.py 100.00% <100.00%> (ø)
napari/components/experimental/chunk/_pool.py 85.71% <0.00%> (-7.94%) ⬇️
napari/utils/theme.py 89.79% <0.00%> (+0.68%) ⬆️
napari/utils/info.py 83.33% <0.00%> (+1.11%) ⬆️

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

Copy link
Member

@andy-sweet andy-sweet left a comment

Choose a reason for hiding this comment

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

Looks great! Except for the duplicated commented code.

Also, thanks for splitting this. Am happy to bring this into v0.4.17 and will probably remove #5195 from the release.

Comment on lines 103 to 110
# raise AttributeError(
# trans._(
# "Private attribute set ('{typ}.{name}') not allowed in this context.",
# deferred=True,
# name=name,
# typ=typ,
# )
# )
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why the commented code is in the original (I'd actually love to delete it), but we definitely shouldn't add a repeat of it without an explanation of why commented code is on the main branch.

Copy link
Member

Choose a reason for hiding this comment

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

I'm feeling mildly destructive today, so if you also feel like deleting the original commented code, please go ahead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I correctly remember this is just preparation on moment where we remove private access. Just remove warning and uncomment exception.

They have a little different text as first is about getting value and second about setting it.

But maybe proper solution will be prepare one text and move it to one function?

Personally I do not understand why thi text is translated as it is not connected with user action.

@Czaki
Copy link
Collaborator Author

Czaki commented Oct 13, 2022

I do not understand the perf test faliture.

@andy-sweet
Copy link
Member

I do not understand the perf test faliture.

Neither do I. I can't reproduce it locally (on macOS) either. Though I haven't tried pyside2.

Not sure why this PR would trigger that failure, though it seems suspicious that it failed on two distinct runs with different Python versions. Have you tried rerunnning?

The failing test does two things that I don't love: starts a subprocess and waits a seemingly arbitrary amount of time (100 milliseconds) for something to occur. I'd be OK temporarily disabling it.

@Czaki
Copy link
Collaborator Author

Czaki commented Oct 14, 2022

Though I haven't tried pyside2.

I know what happens in case of PySide6, and it is unrelated to this code. It is connected with a new release of PySide6.

@andy-sweet
Copy link
Member

Though I haven't tried pyside2.

I know what happens in case of PySide6, and it is unrelated to this code. It is connected with a new release of PySide6.

The failures here are associated with (ubuntu-latest, Python 3.8/3.10, pyside2), not pyside6. There has not been a recent release of pyside2, so that doesn't directly explain it.

@Czaki
Copy link
Collaborator Author

Czaki commented Oct 14, 2022

this pyside2 is also performance

  napari/_qt/perf/_tests/test_perf.py F.                                   [ 85%]

@andy-sweet
Copy link
Member

I reran the failed checks and they passed. I also pulled down this branch and tried running with NAPARI_PERFMON=1 and didn't see anything obviously wrong. It's possible that this PR makes the potentially flaky test slightly more flaky, but I think we can just merge this and disable/deflake that test on main independently.

Therefore, I will merge this after 24 hours unless there are any objections.

@andy-sweet andy-sweet merged commit 76cfcd1 into napari:main Oct 18, 2022
@Czaki Czaki deleted the refactor/setattr_warning branch October 18, 2022 19:04
@Czaki Czaki added the feature New feature or request label Dec 5, 2022
@Czaki Czaki mentioned this pull request Jun 7, 2023
@Czaki Czaki added this to the 0.4.18 milestone Jun 9, 2023
Czaki added a commit that referenced this pull request Jun 16, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Czaki added a commit that referenced this pull request Jun 17, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Czaki added a commit that referenced this pull request Jun 18, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Czaki added a commit that referenced this pull request Jun 19, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Czaki added a commit that referenced this pull request Jun 21, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Czaki added a commit that referenced this pull request Jun 21, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Czaki added a commit that referenced this pull request Jun 21, 2023
* add warning about set private attr when using proxy

* add commented exception

* extract _is_called from napari

* Move prepared raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants