Open elevans opened 8 months ago
Attention: Patch coverage is 78.39506%
with 35 lines
in your changes missing coverage. Please review.
Project coverage is 77.48%. Comparing base (
a173d5a
) to head (a833767
). Report is 14 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
src/imagej/__init__.py | 43.33% | 17 Missing :warning: |
tests/test_legacy.py | 68.57% | 11 Missing :warning: |
tests/test_fiji.py | 12.50% | 7 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Just fyi all PyImageJ builds will fail for python 3.12
until labeling=0.1.14
no longer pins pillow <10
in the conda-feedstock recipe. See this issue.
Edit: This is no longer an issue with labeling 0.1.14
's release.
Thanks @gselzer for your review! It made it sooo much better! I addressed all your comments. Ready to merge?
Update
Update I wanted to preserve the original text (below) for this PR as its relevant to the goals (i.e. create a better experience for macOS users). With the awesome work that @ctrueden has done with
jaunch
we now have a way to actually supportinteractive
mode on macOS. This PR introduces the following new elements and also paves the way for interactive mode on macOS viajaunch
.This PR adds:
when_imagej_starts()
. This can enable some GUI related workflows on macOS (a kind of limited psuedo-interactive mode). See notebook 5 section5.2
for the relevant documentation. This callback mechanism is not compatible with napari.override
flag to the maininit
method. This flag will enable users/developers to bypass initialization checks/blocks we've put in place to stop unsupported/application breaking behavior -- mainlyinteractive
mode on macOS. To test interactive mode on macOS:jaunch
'sfiji.py
file. Add theoverride=True
flag toij = imagej.init(app_dir, mode="interactive")
on line 72../fiji-macos-universal -i --python
.Some other relevant information: Based on what I now understand about Python's threading system and some experimentation on macOS/Linux with
jaunch
, Python will always think its in a main thread. There is no way (from what I gather) to know if a particular Python instance was started with/in apthread
. Instead, threads that are spawned from an already running instance, say in a function that creates threads, are identified as "non-main" thread. This is obvious, but it would have been cool if there was a way to know about how the current instance was started.Original text
Until we can find a true interactive mode for macOS (see https://github.com/imagej/pyimagej/issues/298) this callback mechanism gives macOS users the ability to run their desired Python functions before the REPL is locked by the
AppHelper.runConsoleEventLoop()
.Here's how you register a callback with PyImageJ:
Unfortunately this callback strategy doesn't work with
napari
. Registering the callbacklambda: napari.Viewer()
results in this segfault: