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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari_console-0.1.3.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_console-0.1.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file napari_console-0.1.3.tar.gz.

File metadata

  • Download URL: napari_console-0.1.3.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for napari_console-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ba4f7e1cdca65a7924631372a5e58884e2e35a2b9092c79b98acb9c2dfe1254f
MD5 0486e699e003deb80fedcde5881c05b7
BLAKE2b-256 414e9b65e4c4e9520888fe69c6307818f4f75b0113b0fab1db67424b29bed9fe

See more details on using hashes here.

File details

Details for the file napari_console-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: napari_console-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for napari_console-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29d1700b85561b8c91331821360c9cd0e989350f4a06b86239ec65bc06c7aecb
MD5 2d4244861c3f4b5def09044c66f4eb06
BLAKE2b-256 5fff1d1aad9292aeccf01f94ca150ce621737cbe7b9fabbb0bfef32b8da70e58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page