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

allow use of validate_all=True on nested evented models #4551

Merged
merged 11 commits into from
Jun 13, 2022

Conversation

brisvag
Copy link
Contributor

@brisvag brisvag commented May 19, 2022

Description

During my explorations for nested evented models, I found a solution for what #4138 tried to solve, but which allows us to keep validate_all = True on evented models. On suggestion of @tlambert03, I'm splitting it out of #4522 to get it merged indepentently.

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

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.

Copy link
Contributor

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

very nice solution

@brisvag
Copy link
Contributor Author

brisvag commented May 20, 2022

Turns out runtime_checkable Protocols are not powerful enough for this application, due to type hints not being accounted for, so I'm falling back to a simple instance check.

@Czaki
Copy link
Collaborator

Czaki commented May 20, 2022

Turns out runtime_checkable Protocols are not powerful enough for this application, due to type hints not being accounted for, so I'm falling back to a simple instance check.

but you could just simple overwrite __instancecheck__

@brisvag
Copy link
Contributor Author

brisvag commented May 20, 2022

Turns out runtime_checkable Protocols are not powerful enough for this application, due to type hints not being accounted for, so I'm falling back to a simple instance check.

but you could just simple overwrite __instancecheck__

Yup, I thought about that and tried... And then I learned that instancecheck needs to be on the metaclass, and suddenly things became complicated xD If you have some ideas on how to make it work, please let me know! I really got stuck when I had to somehow change the metaclass of the decorated class...

@Czaki
Copy link
Collaborator

Czaki commented May 20, 2022

@brisvag did this code is enough: ?

from abc import ABCMeta
from napari.utils.events import EmitterGroup


class EventedMetaclass(ABCMeta):
    def __instancecheck__(self, instance):
        return (
            hasattr(instance, "events")
            and isinstance(instance.events, EmitterGroup)
        )

class Evented(metaclass=EventedMetaclass):
    events: EmitterGroup


class SampleEvented:
    def __init__(self):
        self.events = EmitterGroup(added=None, removed=None)


class SampleNonEvented:
    def __init__(self):
        self.events = 1

assert isinstance(SampleEvented(), Evented)
assert not isinstance(SampleNonEvented(), Evented)

@brisvag
Copy link
Contributor Author

brisvag commented May 20, 2022

Oh, that's cool! I was trying to build on top of Protocol, but this is a lot more straight forward. I'll play around with it!

@brisvag
Copy link
Contributor Author

brisvag commented May 22, 2022

Question: how do typical IDEs use Protocols for static typing? Can we actually just use a completely different class such as above and get the same benefits? Or should we subclass Protocols so they can use it? Or maybe is _ProtocolMeta enough?

Either way, I think this might be useful for the future, but not worth holding up this PR for. This is functional as is and pretty straight forward!

@codecov
Copy link

codecov bot commented May 22, 2022

Codecov Report

Merging #4551 (f8a2833) into main (1546f18) will increase coverage by 1.76%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4551      +/-   ##
==========================================
+ Coverage   86.05%   87.81%   +1.76%     
==========================================
  Files         585      585              
  Lines       50073    50098      +25     
==========================================
+ Hits        43089    43996     +907     
+ Misses       6984     6102     -882     
Impacted Files Coverage Δ
napari/utils/events/evented_model.py 94.03% <100.00%> (+0.33%) ⬆️
napari/plugins/pypi.py 45.61% <0.00%> (-0.82%) ⬇️
napari/utils/config.py 100.00% <0.00%> (ø)
napari/layers/utils/string_encoding.py 100.00% <0.00%> (ø)
napari/components/experimental/monitor/_api.py 0.00% <0.00%> (ø)
napari/utils/_tests/test_key_bindings.py 96.49% <0.00%> (+0.02%) ⬆️
napari/layers/utils/_color_encoding.py 93.75% <0.00%> (+0.06%) ⬆️
napari/layers/utils/style_encoding.py 96.26% <0.00%> (+0.07%) ⬆️
napari/layers/shapes/_tests/test_shapes_utils.py 97.22% <0.00%> (+0.07%) ⬆️
napari/__main__.py 54.72% <0.00%> (+0.22%) ⬆️
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1546f18...f8a2833. Read the comment docs.

@alisterburt alisterburt changed the title allow validate_all again allow for validate_all=True on nested evented models May 27, 2022
@alisterburt alisterburt changed the title allow for validate_all=True on nested evented models allow use of validate_all=True on nested evented models May 27, 2022
@brisvag brisvag mentioned this pull request May 30, 2022
11 tasks
@sofroniewn
Copy link
Contributor

Wow - just came across this from #4522 - super clever @brisvag if I understand this right.

Agreed this should go in before #4522 and might make that diff a little smaller and easier to review.

Should this PR also contain the changes related to

this also lets us stop using those very verbose Field(default_factory..., allow_mutation=False,), combined with maunally "validated" defaults because of validate_all = False, by triggering a presudo-validation after init.

that will enable us

to do Viewer.camera = new_camera without messing up viewer.events.camera and viewer.camera.events.

That can come later, but I believe will be supported effectively now.

One things is that it would be nice to have some tests for this new behaviour, something like

# Note this may not work exactly - but is meant to be illustrative
def test_events_stay_working():
    class SimpleCamera(EventedModel):
        zoom: int

    class SimpleViewer(EventedModel):
        camera: SimpleCamera

    mock_callback = Mock()

    # Create simple viewer object
    simple_viewer = SimpleViewer(camera=SimpleCamera(zoom=2))
    # Connect camera zoom to some callback function
    simple_viewer.camera.events.zoom.connect(mock_callback)
    # Create a new camera
    new_camera = SimpleCamera(zoom=3)
   # Replace original camera with new camera - update should now be in place
    simple_viewer.camera = new_camera
   # Update simple_viewer camera zoom with new value
    simple_viewer.camera.zoom = 4
    # Check that original callback still gets called with new zoom value
    mock_callback.method.assert_called_once(value=4)

If I have it right that this behaviour will be enabled by this PR

@brisvag
Copy link
Contributor Author

brisvag commented May 30, 2022

If I have it right that this behaviour will be enabled by this PR

Not quite, unfortunately. for that to work, we need the machinery from #4522 that makes inplace mutation possible.

I think it's possible to split that out of #4522... but I need to think about it :P

Copy link
Contributor

@sofroniewn sofroniewn left a comment

Choose a reason for hiding this comment

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

If I have it right that this behaviour will be enabled by this PR

Not quite, unfortunately. for that to work, we need the machinery from #4522 that makes inplace mutation possible.

I think it's possible to split that out of #4522... but I need to think about it :P

Ah ok, well I think fine to still merge this as is then with validate_all = True just being a net good thing.

I think it might be nice if you could isolate that logic from #4522 and create a new standalone PR for it with a test like i described.

I will let you or @tlambert03 merge this one when you are ready

@brisvag brisvag mentioned this pull request May 31, 2022
12 tasks
@brisvag
Copy link
Contributor Author

brisvag commented Jun 3, 2022

I just found out that this is not enough, because the field events of the children also need to be updated, so we need a recursive version of this.

In [1]: import napari

In [2]: v = napari.Viewer(ndisplay=3)

In [3]: v.camera.events.zoom.source is v.camera
Out[3]: False

@brisvag
Copy link
Contributor Author

brisvag commented Jun 3, 2022

Fixed it with a recursive methods:

In [1]: import napari

In [2]: v = napari.Viewer(ndisplay=3)

In [3]: v.camera.events.zoom.source is v.camera
Out[3]: True

@andy-sweet
Copy link
Member

@brisvag : not sure where this fits with the related open PRs, but it's relatively old and doubly-approved. Therefore, it would be good to merge this or mark it as draft/wip if it's likely to be superseded by another.

FYI, I think if you merge main most of the checks should pass, give or take some luck on the flaky tests.

@brisvag
Copy link
Contributor Author

brisvag commented Jun 9, 2022

I think this can be merged regardless of the rest, but I'd be more comfortable with an extra confirmation from @tlambert03 in light of #4609, just to make sure I'm not doing anything here that somehow assumes the changes there and I'm not realizing :)

Copy link
Contributor

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

Good by me! feel free to merge after tests pass

@brisvag brisvag merged commit 5985c54 into napari:main Jun 13, 2022
@Carreau Carreau added this to the 0.4.17 milestone Jun 28, 2022
tlambert03 added a commit to tlambert03/napari that referenced this pull request Jul 8, 2022
* Clean status message after leave canvas (napari#4607)

* Raise error when rgb True but data not correct dims (napari#4630)

* add ci for asv benchmark suite (napari#4554)

* add ci for asv benchmark suite

* ignore git-lfs stuff?

* split qt from non-qt

* asv: provide custom uninstall command too

* fix yml

* matrix goes under strategy!

* ugh, it's 'uninstall', not 'remove'

* disable build_command

* underscore...

* it has to be a binary in PATH?

* use a different null command

* always yes for pip

* setup qt libs

* use xvfb

* try GabrielBB/xvfb-action

* parameterize 'run'

* add asv quick checks to PR CI

* use osx for qt benchmarks?

* adjust conf path

* fix asv check

* better comment

* add asv run quick to see how long it takes

* asv machine first

* split into another job

* oops typo

* move 'asv checks' to comprehensive

* used sed -E for linux/osx compat

* fix time_on_mouse_move

* skip some tests due to OOM on CI

* handle OOM errors in Labels3DSuite too

* increase timeout

* remove None case from TextManagerSuite

* prevent out of bounds error by allowing only one run per setup in time_remove_as_batch

* configure for label-based triggers

* draft support for scheduled runs and workflow_dispatch

* typo

* fix assigned var

* add delegated workflow that enables comments on PR

* message.txt only needed in PRs

* add some more comments

Co-authored-by: andy-sweet <andy-sweet@users.noreply.github.com>

* do not indent that if

* explicit timeout

Co-authored-by: andy-sweet <andy-sweet@users.noreply.github.com>

* Speed up notebook display tests  (napari#4641)

* test: speed up notebook test by not using viewer to check alt text

* style: pre-commit

* Remove sleep and wait with default timeout instead (napari#4638)

* Update installation instruction in documentation (napari#4639)

* update information about minimal python version

* add information about conda PySide2 install

* Update docs/tutorials/fundamentals/installation.md

Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>

* fix installation command

Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>

* test: Speed up test_viewer tests, split out pyqt5/pyside2 tests again (napari#4646)

* pull out alt-text parameters from viewer

* test: speed up notebook test by not using viewer to check alt text

* style: pre-commit

* magicgui tests work with xdist

* move magicgui test

* refactor keybindings test

* split tests

* fix mac

* fix tox params, and viewer test

* cancel previous  runs

* bump codecov

* explicit backends

* fix win 3.10

* mac to 3.9

* try pip

* fix extra name

* back to tox

* back to tox

* fix env factors

* undo some changes

* remove more whitespace

* add backend to minreq

* try pyside2 on mac

* back to pyqt5 on mac

* 3.10 for mac

* try xdist

* bump maxfail

* undo xdist change

* Add tests for qt_progress_bar.py (napari#4634)

* add tests for qt_progress_bar.py

* coverage _get_value

* More updates to the ignored translations file and translation CI infrastructure (napari#4596)

* rewrite JSON, sorting keys

* Update logic to not reorder strings.

* update json removing nonexisting strings

* fix a couple of pytest fixtures

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* build: slight updates/de-dups in setupcfg (napari#4645)

* build: slight updates/de-dups in setupcfg

* unpin lxml, remove semgrep

* Restore "show all key bindings" shortcut  (napari#4628)

* cleaning code

* provide consistency in shortcut representation

* add shortcut for shortcuts show

* fix test

* add test for action

* ci: fix tox factor names in tests (napari#4660)

* ci: fix tox factor names in tests

* ci: cancel previous runs

* Limit comprehensive test concurrency to 1. (napari#4655)

Just to make sure we don't block testing PRs with main

Mitigate napari#4653

* Do not run `asv` on push (napari#4656)

* do not run asv on test_comprehensive

* report failures as issue if non-PR

* test: speed up magicgui forward ref tests (napari#4662)

* test: speed up magicgui forward ref tests

* test: fix expected layer methods

* Allow to trigger test_translation manually (napari#4652)

* do not use keyword argument for QListWidgetItem (napari#4661)

* Enable patch coverage reporting (napari#4632)

* enable patch coverage

* set target to 0% to get only information

Co-authored-by: Talley Lambert <talley.lambert@gmail.com>

* Move test examples on end of test run them in different CI job  (napari#4647)

* move test examples on end

* allow test because of test order

* skip examples by marker

* exclude examples from test run

* fix tox after merge

* fix conf

* fix failing test

* proper test order on windows

* Apply suggestions from code review

Co-authored-by: Talley Lambert <talley.lambert@gmail.com>

Co-authored-by: Talley Lambert <talley.lambert@gmail.com>

* Fix docs for shape/points layer properties (napari#4659)

* fix names of future shape/points properties

* Also fix current_opacity to opacity

* shape opacity applies to all shapes

* Update docs/howtos/layers/points.md

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* feat: add codespace (napari#4599)

* feat: add codespace

* fix: fix check manifest

* Alternate fix for alt-text issues (napari#4617)

* Alternate fix for alt-text issues

* Re-escape alt-text

* Re-remove meshzoo

* Update explanatory comments

* add dependabot for github actions (napari#4671)

* ci(dependabot): bump peter-evans/create-pull-request from 3 to 4 (napari#4675)

Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](peter-evans/create-pull-request@v3...v4)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(dependabot): bump docker/build-push-action from 2.5.0 to 3 (napari#4676)

* ci(dependabot): bump docker/build-push-action from 2.5.0 to 3

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.5.0 to 3.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@ad44023...e551b19)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update .github/workflows/docker-singularity-publish.yml

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>

* ci(dependabot): bump docker/metadata-action from 3 to 4 (napari#4679)

Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 3 to 4.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](docker/metadata-action@v3...v4)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(dependabot): bump toshimaru/auto-author-assign from 1.3.4 to 1.5.0 (napari#4678)

Bumps [toshimaru/auto-author-assign](https://github.com/toshimaru/auto-author-assign) from 1.3.4 to 1.5.0.
- [Release notes](https://github.com/toshimaru/auto-author-assign/releases)
- [Changelog](https://github.com/toshimaru/auto-author-assign/blob/main/CHANGELOG.md)
- [Commits](toshimaru/auto-author-assign@v1.3.4...v1.5.0)

---
updated-dependencies:
- dependency-name: toshimaru/auto-author-assign
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Multi-color text with color encodings (napari#4464)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Optimization: convert point slice indices to floats (napari#4648)

* ci(dependabot): bump actions/setup-python from 3 to 4 (napari#4677)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add "Processors": (generalize magicgui return type behavior outside of magicgui) (napari#4543)

* formatting

* add setter

* add test

* extend test

* add test

* make clobber False by default

* wip

* wip, converting magicgui processors

* add add_layer

* Update napari/utils/_injection.py

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* Update napari/utils/_injection.py

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* Update napari/utils/_injection.py

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* Update napari/utils/_injection.py

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* adding tests

* start on worker

* single import

* fix typing

* fix test

* rearrange

* sort lines

* minor

* docs: update docstrings

* use zeros

* get rid of thread

* rename to providers/processors, add decorator

* update docstring

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* fix: fix manifest reader extensions, ensure that all builtins go through npe2 (napari#4668)

* fix: fix manifest reader extensions

* test: fix tests

* add warning

* add warning

* remove mistake file

* update another test

* fix another test

* revert napari#4575

* some more, but not all, fixed

* remove comment

* change napari builtins display name

* simplify get_potential_readers

* fix one more test

* skip some tests

* fix typecheck

* fix qt tests

* fix another qt test

* remove breakpoint

* remove napari hook implementation

* fix test_get_writer

* sort writer extensions

* remove initialize stuff

* fix cli show test

* bump svg

* allow use of validate_all=True on nested evented models (napari#4551)

* allow validate_all again

* rename to _protocols

* oops

* fix protocol more general

* use normal instance check

* reset source for all fields, not just mutable ones

* recursive source reset

* fix status of nap1 (napari#4685)

* [pre-commit.ci] pre-commit autoupdate (napari#4687)

updates:
- [github.com/asottile/pyupgrade: v2.32.1 → v2.34.0](asottile/pyupgrade@v2.32.1...v2.34.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Add new core devs to docs (napari#4691)

* Remove unused points _color state (napari#4666)

* Remove unused function and state

* Also remove unneeded addition

* Add function back

* Clean up PR

* Define different shortcuts for different screenshot actions in file menu (napari#4636)

* test: Cleanup usage of npe2 plugin manager in tests (napari#4669)

* fix: fix manifest reader extensions

* test: fix tests

* add warning

* add warning

* remove mistake file

* update another test

* fix another test

* revert napari#4575

* some more, but not all, fixed

* remove comment

* change napari builtins display name

* simplify get_potential_readers

* fix one more test

* skip some tests

* fix typecheck

* fix qt tests

* fix another qt test

* starting on new pm fixtures.  working sample hook

* update save layers and test reader plugins

* plugins module working

* remove tmp_reader

* more reduction

* finish viewer model

* update qt dialogs

* finish qt_extension2reader

* fix file menu

* add comments

* remove breakpoint

* fix layers

* fix components

* add builtins to examples test

* remove napari hook implementation

* fix test_get_writer

* sort writer extensions

* remove initialize stuff

* fix cli show test

* bump svg

* fix test

* use npe2 0.4.0

* more simplifications

* Update napari/conftest.py

Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>

* remove xfail

* add comment

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Remove unnecessary uses of make_napari_viewer (replace with ViewerModel) (napari#4690)

* remove from experimental chunk

* two more in qt

* bunch more

* remove more

* add back one

* bump npe2, use new features (napari#4686)

* Remove `restore_settings_on_exit` test util (napari#4673)

* fix: fix manifest reader extensions

* test: fix tests

* add warning

* add warning

* remove mistake file

* update another test

* fix another test

* revert napari#4575

* some more, but not all, fixed

* remove comment

* change napari builtins display name

* simplify get_potential_readers

* fix one more test

* skip some tests

* fix typecheck

* fix qt tests

* fix another qt test

* starting on new pm fixtures.  working sample hook

* update save layers and test reader plugins

* plugins module working

* remove tmp_reader

* more reduction

* finish viewer model

* update qt dialogs

* finish qt_extension2reader

* fix file menu

* add comments

* remove breakpoint

* fix layers

* fix components

* add builtins to examples test

* remove restore_settings_on_exit

* add comment

* remove napari hook implementation

* fix test_get_writer

* sort writer extensions

* remove initialize stuff

* fix cli show test

* bump svg

* fix test

* remove unneeded line

* fix test

* Add modal dialogs for window/application closure (napari#4637)

Co-authored-by: alisterburt <alisterburt@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>

* Design issue template assignees (napari#4701)

Issue template for design-related issues now should auto-assign any created issues to Lisa and Isabela (formerly it assigned to Lia)

* Keep order of layers when select to save multiple selected layers (napari#4689)

* honor confirm close settings when quitting (napari#4700)

* honor confirm close settings on quit

* update string

* Update napari/settings/_application.py

Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>

* Update napari/settings/_application.py

Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>

Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>

* Add option to use npe2 shim/adaptor for npe1 plugins (napari#4564)

* add opt-in npe2 shim

* add comment

* show shims in plugin installer

* don't use mock

* fix: fix manifest reader extensions

* test: fix tests

* add warning

* add warning

* remove mistake file

* update another test

* fix another test

* revert napari#4575

* some more, but not all, fixed

* remove comment

* change napari builtins display name

* simplify get_potential_readers

* fix one more test

* skip some tests

* fix typecheck

* fix qt tests

* fix another qt test

* remove breakpoint

* remove napari hook implementation

* fix test_get_writer

* update docs

* add trans

* add requires restart

* use requires_restart

* Use python 3.9 for mac tests until numcodecs 3.10 wheels are available (napari#4707)

* Apply shown mask to points._view_size_scale (napari#4699)

* Apply shown mask to points._view_size_scale

* Added two tests for points related to the view_size and shown

* Add test case for view_size if no point is shown

* Update test to check for the actual dimension as well

* Put a comment explaining the 3 if statements

* Merge two tests into one for view_size

Co-authored-by: Markus Stabrin <markus.stabrin@gmail.com>

* remove print (napari#4718)

* Use `cache: pip` from actions setup-python (napari#4672)

* try pip cache

* more cache

* tox vv

* use cache in comprehensive too

* remove verbose

* use same coverage report like in pull requests (napari#4722)

* fix presentation and enablement of npe1 plugins (napari#4721)

* Improvements on scale bar (napari#4511)

* Background box under scale bar to improve legibility

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Now possible to change the color of scale bar and surrounding box

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated test and clean up for box visibility

* scale bar color now managing all allowed color formats. Tests updated

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removed unused import of Union

* Simplify logic and add docs

* Make colors non-optional

* Fix initial box color

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>
Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>

* napari.viewer.current_viewer fallback ancestor (napari#4715)

* napari.viewer.current_viewer fallback ancestor

The use case is modal dialogs from magicgui.request_values, who have no parent. If they wish to use a layer, they must get that layer from the current viewer.

* Fix test_magicgui_get_viewer

This was broken as it now returns current_viewer where it did not
before. Now, we ensure that a parent-less widget returns current_viewer,
  and a child widget returns its parent viewer

* Test current_viewer behavior

At the request of @ctrueden

* Add NAP-3: Spaces (napari#4684)

* nap 3

* finish up first draft of nap3

* address comments and fix grammar

* incorporate some comments

* Color edit without tooltip fix (napari#4717)

* Fix typo in QColorSwatchEdit

* Add a new test for QColorSwatch

* Use some features from npe2 v0.5.0 (napari#4719)

* bump version

* use npe2pm

* Update translation documentation link in pull request template (napari#4728)

* Refactor label painting by moving code from mouse bindings onto layer, adding staged history and paint event (napari#4702)

* Fix bug in deepcopy of utils.context.Expr (napari#4730)

* add tests for deepcopy of Expr

* fix repr test on 3.8

* fix test again

* Update napari/utils/context/_expressions.py

* try to fix typing

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>

* Tracks tail update fix beyond _max_length (napari#4688)

* Auto-update _max_length upon setting tail_length

* Remove tail_length clipping by _max_length upon update

* Move track display limits to constructor

* - Auto-update _max_length upon setting head_length
- Remove head_length clipping by _max_length upon update

* Add test cases for length change

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* split Image `interpolation` on two properties, `interpoltion2d` and `interpolation3d`  (napari#4725)

* add name migration mechanism

* split interpolation on 2 properties

fix tests

* make interpolation event deprecated

* add remove version to `rename_argument` decorator

* verify if only one name of argument is used

* change to deprecation warnings

* make interpolation getter deprecated

* move intepolation event to new setters

* add type annotation for better refactor support

* fix test

* fix tox file

* fix tox 2

* fix tox 3

* Fix Image parameter docs (napari#4750)

* Fix `_get_state` for empty Vectors and Points layers (napari#4748)

* Add a public API for the setGeometry method of _qt_window (napari#4729)

Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Do not inform about coverage untill all CI jobs are done (napari#4751)

* do not inform about coverage untill all jobs are done

* fix codecov.yaml

* reduce number

* Allow pandas.Series as properties values (napari#4755)

* Allow pandas.Series as properties values

* Add numpy array to the tests and mixed cases

* Add series property tests to points layer

* Adjust according to reviews

* Remove debug prints

* ci(dependabot): bump docker/login-action from 1.9.0 to 2 (napari#4774)

Bumps [docker/login-action](https://github.com/docker/login-action) from 1.9.0 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@28218f9...49ed152)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(dependabot): bump bruceadams/get-release from 1.2.2 to 1.2.3 (napari#4773)

Bumps [bruceadams/get-release](https://github.com/bruceadams/get-release) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/bruceadams/get-release/releases)
- [Commits](bruceadams/get-release@v1.2.2...v1.2.3)

---
updated-dependencies:
- dependency-name: bruceadams/get-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(dependabot): bump actions/github-script from 5 to 6 (napari#4772)

Bumps [actions/github-script](https://github.com/actions/github-script) from 5 to 6.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](actions/github-script@v5...v6)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(dependabot): bump actions/download-artifact from 2 to 3 (napari#4771)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(dependabot): bump styfle/cancel-workflow-action from 0.9.1 to 0.10.0 (napari#4770)

Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.9.1 to 0.10.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](styfle/cancel-workflow-action@0.9.1...0.10.0)

---
updated-dependencies:
- dependency-name: styfle/cancel-workflow-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Make references to examples link there (napari#4767)

* docs/index: fix references to main branch

* Make references to examples folder link there

* fix clim init for dask arrays (napari#4724)

* fix clim init for dask arrays

* fix tensorstore

* avid double-calculation

* add test for clim

* move test to dask and make sync only

* use normalize_dtype

* Set focus on `QtViewer` object after creating main window (napari#4768)

* Add missed call of `running_as_bundled_app` in `__main__` (napari#4777)

* Add public API for dims transpose (napari#4727)

* Update dims.py

Add public API for dims transpose

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove _transpose usage, deprecate it and fix typos

* Fix typo

* Update napari/components/dims.py

Co-authored-by: Kevin Yamauchi <kevin.yamauchi@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dims.py

Remove old _transpose private method

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: Kevin Yamauchi <kevin.yamauchi@gmail.com>

* Use `npe2 list` to show plugin info (napari#4739)

* use npe2 list for plugin info

* bump npe2

* fix test

* fix test

* Fix source of copied layer events by use `layer.as_layer_data_tuple` (napari#4681)

* Fixing readme typo (napari#4791)

* readd ensure_unique

Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Co-authored-by: Lucy Liu <jliu176@gmail.com>
Co-authored-by: Jaime Rodríguez-Guerra <jaimergp@users.noreply.github.com>
Co-authored-by: andy-sweet <andy-sweet@users.noreply.github.com>
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>
Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Guillaume Witz <guiwitz@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: alisterburt <alisterburt@gmail.com>
Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Co-authored-by: Lia Prins <53277128+liaprins-czi@users.noreply.github.com>
Co-authored-by: Markus Stabrin <markus.stabrin@mpi-dortmund.mpg.de>
Co-authored-by: Markus Stabrin <markus.stabrin@gmail.com>
Co-authored-by: Pierre Thibault <pierrethibault@users.noreply.github.com>
Co-authored-by: Gabriel Selzer <gjselzer@wisc.edu>
Co-authored-by: cnstt <104427648+cnstt@users.noreply.github.com>
Co-authored-by: Kushaan Gupta <gkushaan@rediffmail.com>
Co-authored-by: David Stansby <dstansby@gmail.com>
Co-authored-by: Curtis Rueden <ctrueden@wisc.edu>
Co-authored-by: Kevin Yamauchi <kevin.yamauchi@gmail.com>
Co-authored-by: Jordão Bragantini <jordao.bragantini@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants