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

refactor underlying architecture of plugin for molularity and encapsulation #67

Merged
merged 8 commits into from
Aug 22, 2023

Conversation

alessandrofelder
Copy link
Member

@alessandrofelder alessandrofelder commented Aug 11, 2023

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
The atlas_viewer_widget.py file was becoming unwieldy to add functionality to, and things that were napari-independent were tested in a napari context as a consequence of the previous architecture (which made the tests slow, as well as violating separation of concerns).

What does this PR do?

This PR splits the classes more independent and have clearer responsibilities. Some things have been renamed for clarity too.
The plugin should look and behave exactly the same as before (bar also fixing #66 )
a key advantage is better modularity
* widgets can be used and tested independent of napari (and the tests seem faster to run?)
* each file and class has clear responsibilities
* easier to add new features to because the amount of context needed to worry about at once is reduced

a downside is that there is an extra layer of abstraction in the code(but I think it's worth it!)

References

Closes #8
Closes #66

How has this PR been tested?

Tests have been refactored accordingly, and pass. Also extensive manual testing for any unintentional changes in behaviour.

Is this a breaking change?

Not for the user, big change in API which is good to be done early in the development process for this plugin

Does this PR require an update to the documentation?

Will be added as part of #52. Docstrings improved and added as needed by the refactoring.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@alessandrofelder alessandrofelder force-pushed the refactor-class-structure branch 3 times, most recently from 5daa20a to 4e35311 Compare August 21, 2023 16:13
@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +5.47% 🎉

Comparison is base (76733ed) 91.85% compared to head (232371b) 97.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #67      +/-   ##
==========================================
+ Coverage   91.85%   97.32%   +5.47%     
==========================================
  Files           6        7       +1     
  Lines         270      299      +29     
==========================================
+ Hits          248      291      +43     
+ Misses         22        8      -14     
Files Changed Coverage Δ
brainrender_napari/utils/load_user_data.py 100.00% <ø> (ø)
...rainrender_napari/widgets/atlas_download_dialog.py 100.00% <ø> (ø)
brainrender_napari/__init__.py 100.00% <100.00%> (ø)
brainrender_napari/brainrender_widget.py 100.00% <100.00%> (ø)
brainrender_napari/widgets/atlas_table_view.py 100.00% <100.00%> (ø)
brainrender_napari/widgets/structure_view.py 92.92% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alessandrofelder alessandrofelder marked this pull request as ready for review August 21, 2023 17:15
@alessandrofelder
Copy link
Member Author

alessandrofelder commented Aug 21, 2023

I am going to fix the slight decrease in coverage, but in the meantime it would be great if, @adamltyson, you could check that you agree that nothing is broken for the user by this PR (it's supposed to be a pure moving-stuff-around and communicate-via-qt-signals-instead PR) with no changes in functionality for the user?

Copy link
Member

@adamltyson adamltyson left a comment

Choose a reason for hiding this comment

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

All looks good to me 🎉

brainrender_napari/__init__.py Outdated Show resolved Hide resolved
as suggested by review comment.
* signal was previously not emitted properly in table view's qmenu
* rename test atlas_viewer_widget > brainrender_widget
* add tests for model header and additional reference context menu
@alessandrofelder alessandrofelder merged commit afe6b64 into main Aug 22, 2023
11 checks passed
@alessandrofelder alessandrofelder deleted the refactor-class-structure branch August 22, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
2 participants