
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
napari-console
Advanced tools
A plugin that adds a console to napari
This napari plugin was generated with Cookiecutter using with @napari's cookiecutter-napari-plugin template.
In napari-console 0.0.8 and earlier, the console locals() namespace only
contained a reference to the napari viewer that enclosed the console.
Since version 0.0.9, it instead contains everything in the enclosing frame that called napari. That is, if your Python code is:
import napari
import numpy as np
from scipy import ndimage as ndi
image = np.random.random((500, 500))
labels = ndi.label(image > 0.7)[0]
viewer, image_layer = napari.imshow(image)
labels_layer = viewer.add_labels(labels)
napari.run()
Then the napari console will have the variables np, napari, ndi, image,
labels, viewer, image_layer, and labels_layer in its namespace.
This is implemented by inspecting the Python stack when the console is first
instantiated, finding the first frame that is outside of the napari_console,
napari, and in_n_out modules, and passing the variables in the frame's
f_locals and f_globals to the console namespace.
If you want to disable this behavior (for example, because you are embedding
napari and the console within some larger application), you can add
NAPARI_EMBED=1 to your environment variables before instantiating the
console.
You can install napari-console via pip:
pip install napari-console
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Distributed under the terms of the BSD-3 license, "napari-console" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.
FAQs
A plugin that adds a console to napari
We found that napari-console demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.