Skip to main content

napari-console (WIP, under active development)

License PyPI Python Version tests codecov

A plugin that adds a console to napari


This napari plugin was generated with Cookiecutter using with @napari's cookiecutter-napari-plugin template.

Local variables

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.

Installation

You can install napari-console via pip:

pip install napari-console

Contributing

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.

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.

Metadata

Release files for napari-console 0.1.4

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.4
File Size Uploaded
napari_console-0.1.4.tar.gz 20.2 kB Details

Built distribution (wheel)

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

Total release size: 29.9 kB

Release files / napari_console-0.1.4.tar.gz

Download URL napari_console-0.1.4.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e185e4d36d8171ae23ca383dc69c38df76592a984d6c99ad08372d188a1fbb9b
BLAKE2b-256 checksum
How to use checksums
5a036e1fcd9aa9ac4746ce2b44050ea8f7192d883f4d3da4e7ff08589ac3ad3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

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

Download URL napari_console-0.1.4-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
565df1fa15db579552af9e9d9d3883067c00191be282ad47d80f9b0d50b4e5ad
BLAKE2b-256 checksum
How to use checksums
01722067f28fd0ae87978f3b61e8ec30c1d085bbed03f64eb58e43949d526b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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