Skip to main content

napari-console

License PyPI Python Version tests codecov

A plugin that adds a console to napari. This plugin is maintained by the @napari team.

napari-console adds an interactive console based on IPython to napari. The napari UI contains a console button to display the console. This button is enabled if you launch napari from the command line, a script, or use the napari bundled app.

napari-console in napari UI

License

Distributed under the terms of the BSD-3 license, "napari-console" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Contributing

Contributions are very welcome. Tests can be run with tox. Please ensure test coverage results remain the same or higher than before you submit a pull request.

Installation

You can install napari-console via pip:

pip install napari-console

Local variables and napari-console

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), add NAPARI_EMBED=1 to your environment variables before instantiating the console.

Metadata

Release files for napari-console 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for napari-console 0.1.5
File Size Uploaded Provenance Actions
napari_console-0.1.5.tar.gz 13.6 kB Without provenance Details for napari_console-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for napari-console 0.1.5
File Interpreter ABI Platform Actions
napari_console-0.1.5-py3-none-any.whl Python 3 none any Details for napari_console-0.1.5-py3-none-any.whl

Total release size: 23.2 kB

Release files / napari_console-0.1.5.tar.gz

Download URL napari_console-0.1.5.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c06e48709802b833a1fb3aab190454fb0211abf3dc86e1d80158c012b9aaa8d2
BLAKE2b-256 checksum
How to use checksums
4ea0e32a461b475e52962dd4f197129a0f04fc4d7819efed4180cb2f969c6f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / napari_console-0.1.5-py3-none-any.whl

Download URL napari_console-0.1.5-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9cec209fba31c80f439caff5a72c4f97007eab8d1d02ca20c88c3ab3b600caa
BLAKE2b-256 checksum
How to use checksums
b334dc928a52a7b153286b985dc2ec9d33195e2c5f9967d656d225c2680e50cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for napari-console 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page