Skip to main content

napari-plugin-devtools

License PyPI Python Version tests

A repo with tools and services for napari plugin developers

Installation

This tool can be installed via pip: pip install napari-plugin-devtools, you can also add it to your requirements.txt to be installed with other dependencies automatically.

Validation tool

The validation tools provides automated tests for plugin developers, these checks verify that the plugin is available for users of napari to install, and would register entry points with napari.

There are two parts to the validation tool. One part is a command line interface and the other is a pytest fixture.

Command Line Interface (CLI) Usage

The CLI can be used by continuous integration (CI) pipelines to perform a quick verification of a plugins setup without any specific input required. It serves as a quick "sanity check". (It is also accessible from python in validation.py)

The tool can be run as npd <cmd>. where currently we support cmd validate:

npd validate: validate classifiers and function hooks can be recognized by napari. The validation would run on built packages under dist folder to check if they are annotated properly with framework classifier, and validate hooks are properly annotated that they can be found by napari.

npd validate -i|--include-plugin INCLUDE_PLUGIN [INCLUDE_PLUGIN ...] run hook checks only on listed plugins, this is useful to filter out other plugins on a complicated python environment.

npd validate -e|--exclude-plugin EXCLUDE_PLUGIN [EXCLUDE_PLUGIN ...] do not run hook checks on listed plugins, this is useful to filter out other plugins on a complicated python environment.

npd validate -v|--verbose enable verbose mode, gives slightly more information on the underlying findings of validation process.

Pytest fixture usage

devtools provides a pytest fixture: napari_plugin_tester in plugin_tester.py, it extends a plugin manager used by napari and have additional assertion modes ready:

def test_pm(napari_plugin_tester):
    napari_plugin_tester.assert_plugin_name_registered("test-plugin")
    napari_plugin_tester.assert_module_registered(_test)
    napari_plugin_tester.assert_implementations_registered(
        "test-plugin", "napari_get_reader"
    )

where you can check more specifically on a module or function being registered under napari annotations, see hook specifications to find what other annotations are avaiable in addition to napari_get_reader

Release files for napari-plugin-devtools 0.4.2

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-plugin-devtools 0.4.2
File Size Uploaded
napari-plugin-devtools-0.4.2.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for napari-plugin-devtools 0.4.2
File Interpreter ABI Platform
napari_plugin_devtools-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / napari-plugin-devtools-0.4.2.tar.gz

Download URL napari-plugin-devtools-0.4.2.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7b64a5cf20b5ecf30e98014838e4f69dc231517fe4c0ec58d3eb85ac3d6ac92e
BLAKE2b-256 checksum
How to use checksums
fc3ea4ba79607afae47da69c4feb38512bedd26e8b8f4b097f43ad85cd654c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / napari_plugin_devtools-0.4.2-py3-none-any.whl

Download URL napari_plugin_devtools-0.4.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2489d74876ae0c1168d53e4e11dab7f5c77dc9e27b87f10054fc28171ee9769
BLAKE2b-256 checksum
How to use checksums
c9a6510b2c611e9dc2e1e115b95838933ae2b8c8f8b5d49d1a2ac7b71d97e9a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4

2 release files

0.2

2 release files

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