Metadata-Version: 2.4
Name: napari-console
Version: 0.1.5
Summary: A plugin that adds a console to napari
Author-email: napari team <napari-steering-council@googlegroups.com>
License: BSD-3-Clause
Project-URL: Homepage, https://github.com/napari/napari-console
Project-URL: Bug Tracker, https://github.com/napari/napari-console/issues
Project-URL: Source Code, https://github.com/napari/napari-console
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: napari
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: IPython>=7.7.0
Requires-Dist: ipykernel>=7.1
Requires-Dist: qtconsole!=4.7.6,!=5.4.2,>=4.5.1
Requires-Dist: qtpy>=1.7.0
Provides-Extra: pyside6
Requires-Dist: PySide6>6.7; extra == "pyside6"
Provides-Extra: pyqt6
Requires-Dist: PyQt6>6.5; extra == "pyqt6"
Requires-Dist: PyQt6!=6.6.1; platform_system == "Darwin" and extra == "pyqt6"
Provides-Extra: pyside
Requires-Dist: napari-console[pyside6]; extra == "pyside"
Provides-Extra: pyqt5
Requires-Dist: PyQt5!=5.15.0,>=5.13.2; extra == "pyqt5"
Provides-Extra: pyqt
Requires-Dist: napari-console[pyqt6]; extra == "pyqt"
Provides-Extra: qt
Requires-Dist: napari-console[pyqt]; extra == "qt"
Provides-Extra: testing
Requires-Dist: napari[pyqt]; extra == "testing"
Dynamic: license-file

# napari-console

[![License](https://img.shields.io/pypi/l/napari-console.svg?color=green)](https://github.com/napari/napari-console/raw/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-console.svg?color=green)](https://pypi.org/project/napari-console)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-console.svg?color=green)](https://python.org)
[![tests](https://github.com/napari/napari-console/workflows/tests/badge.svg)](https://github.com/napari/napari-console/actions)
[![codecov](https://codecov.io/gh/napari/napari-console/branch/main/graph/badge.svg)](https://codecov.io/gh/napari/napari-console)

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](https://napari.org/dev/getting_started/viewer.html#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](https://github.com/napari/docs/blob/main/docs/_static/images/console.png)

## 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:

```python
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.

[napari]: https://github.com/napari/napari
[@napari]: https://github.com/napari
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[napari]: https://github.com/napari/napari
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
