Manifest Reference#
Important
Plugin manifests are a feature of the second generation napari plugin engine
(“npe2”).  If you are still using the first generation napari-plugin-engine
(i.e. the  napari.plugin entrypoint, along with @napari_hook_implementation
decorators) then this page does not apply to your plugin.
Every napari plugin needs to ship a manifest file with their package. By
convention, this file is called napari.yaml and it is placed in the top level
module of the package, but it can be named anything and placed anywhere.
You tell napari where to find your manifest by adding a napari.manifest entry
point to
your package metadata:
# tell napari where to find to your manifest
[options.entry_points]
napari.manifest =
    example-plugin = example_plugin:napari.yaml
# make sure it gets included in your package
[options.package_data]
example-plugin = napari.yaml
Fields#
All fields are optional except those in bold.
Name  | 
Details  | 
|---|---|
  | 
The name of the plugin. Though this field is mandatory, it must match the package   | 
  | 
User-facing text to display as the name of this plugin. Must be 3-90 characters long and must not begin or end with an underscore, white space, or non-word character. If not provided, the manifest   | 
  | 
Whether this plugin should be searchable and visible in the built-in plugin installer and the napari hub. By default (  | 
  | 
The path to a square PNG icon of at least 128x128 pixels (256x256 for Retina screens). May be one of: 
  | 
  | 
A list of categories that this plugin belongs to. This is used to help users discover your plugin. Allowed values:   | 
  | 
A SemVer compatible version string matching the napari plugin schema version that the plugin is compatible with.  | 
  | 
Fully qualified python path to a function that will be called upon plugin activation (e.g.   | 
  | 
Fully qualified python path to a function that will be called when a user deactivates a plugin (e.g.   | 
  | 
An object describing the plugin’s contributions  | 
Note
Standard python
package metadata
from your setup.cfg file will also be parsed for version, license, and other info.
Example#
Here is a complete example of what the manifest of a plugin providing all contributions might look like. (Note: a plugin needn’t implement more than a single contribution type).
Tip
Both YAML and TOML are supported manifest formats, though YAML is the “default” and more common format.
name: example-plugin
display_name: Example Plugin
schema_version: 0.2.1
contributions:
  commands:
  - id: example-plugin.hello_world
    title: Hello World
  - id: example-plugin.read_xyz
    title: Read ".xyz" files
    python_name: example_plugin.some_module:get_reader
  - id: example-plugin.write_points
    title: Save points layer to csv
    python_name: example_plugin.some_module:write_points
  - id: example-plugin.my_widget
    title: Open my widget
    python_name: example_plugin.some_module:MyWidget
  - id: example-plugin.do_threshold
    title: Perform threshold on image, return new image
    python_name: example_plugin.some_module:threshold
  - id: example-plugin.threshold_otsu
    title: Threshold using Otsu's method
    python_name: example_plugin.some_module:threshold_otsu
  - id: example-plugin.threshold_li
    title: Threshold using Li's method
    python_name: example_plugin.some_module:threshold_li
  - id: example-plugin.all_thresholds
    title: All thresholds
    python_name: example_plugin.some_module:all_thresholds
  - id: example-plugin.threshold_widget
    title: Make threshold widget with magic_factory
    python_name: example_plugin.some_module:widget_factory
  - id: example-plugin.data.fractal
    title: Create fractal image
    python_name: example_plugin.some_module:create_fractal
  readers:
  - command: example-plugin.read_xyz
    filename_patterns:
    - '*.xyz'
    accepts_directories: false
  writers:
  - command: example-plugin.write_points
    layer_types:
    - points
    filename_extensions:
    - .csv
  widgets:
  - command: example-plugin.my_widget
    display_name: Wizard
  - command: example-plugin.threshold_widget
    display_name: Threshold
  - command: example-plugin.do_threshold
    display_name: Threshold
    autogenerate: true
  sample_data:
  - command: example-plugin.data.fractal
    key: fractal
    display_name: Fractal
  - key: napari
    display_name: Tabueran Kiribati
    uri: https://en.wikipedia.org/wiki/Napari#/media/File:Tabuaeran_Kiribati.jpg
  themes:
  - id: monokai
    label: Monokai
    type: dark
    syntax_style: monokai
    colors:
      canvas: black
      console: black
      background: '#272822'
      foreground: '#75715e'
      primary: '#cfcfc2'
      secondary: '#f8f8f2'
      highlight: '#e6db74'
      text: '#a1ef34'
      icon: '#a1ef34'
      warning: '#f92672'
      current: '#66d9ef'
  menus:
    napari/layers/segment:
    - submenu: threshold
    - command: example-plugin.all_thresholds
    threshold:
    - command: example-plugin.threshold_otsu
    - command: example-plugin.threshold_li
  submenus:
  - id: threshold
    label: Thresholding
name = "example-plugin"
display_name = "Example Plugin"
schema_version = "0.2.1"
[contributions]
widgets = [
    { command = "example-plugin.my_widget", display_name = "Wizard" },
    { command = "example-plugin.threshold_widget", display_name = "Threshold" },
    { command = "example-plugin.do_threshold", display_name = "Threshold", autogenerate = true },
]
submenus = [
    { id = "threshold", label = "Thresholding" },
]
[[contributions.commands]]
id = "example-plugin.hello_world"
title = "Hello World"
[[contributions.commands]]
id = "example-plugin.read_xyz"
title = "Read \".xyz\" files"
python_name = "example_plugin.some_module:get_reader"
[[contributions.commands]]
id = "example-plugin.write_points"
title = "Save points layer to csv"
python_name = "example_plugin.some_module:write_points"
[[contributions.commands]]
id = "example-plugin.my_widget"
title = "Open my widget"
python_name = "example_plugin.some_module:MyWidget"
[[contributions.commands]]
id = "example-plugin.do_threshold"
title = "Perform threshold on image, return new image"
python_name = "example_plugin.some_module:threshold"
[[contributions.commands]]
id = "example-plugin.threshold_otsu"
title = "Threshold using Otsu's method"
python_name = "example_plugin.some_module:threshold_otsu"
[[contributions.commands]]
id = "example-plugin.threshold_li"
title = "Threshold using Li's method"
python_name = "example_plugin.some_module:threshold_li"
[[contributions.commands]]
id = "example-plugin.all_thresholds"
title = "All thresholds"
python_name = "example_plugin.some_module:all_thresholds"
[[contributions.commands]]
id = "example-plugin.threshold_widget"
title = "Make threshold widget with magic_factory"
python_name = "example_plugin.some_module:widget_factory"
[[contributions.commands]]
id = "example-plugin.data.fractal"
title = "Create fractal image"
python_name = "example_plugin.some_module:create_fractal"
[[contributions.readers]]
command = "example-plugin.read_xyz"
filename_patterns = [
    "*.xyz",
]
accepts_directories = false
[[contributions.writers]]
command = "example-plugin.write_points"
layer_types = [
    "points",
]
filename_extensions = [
    ".csv",
]
[[contributions.sample_data]]
command = "example-plugin.data.fractal"
key = "fractal"
display_name = "Fractal"
[[contributions.sample_data]]
key = "napari"
display_name = "Tabueran Kiribati"
uri = "https://en.wikipedia.org/wiki/Napari#/media/File:Tabuaeran_Kiribati.jpg"
[[contributions.themes]]
id = "monokai"
label = "Monokai"
type = "dark"
syntax_style = "monokai"
[contributions.themes.colors]
canvas = "black"
console = "black"
background = "#272822"
foreground = "#75715e"
primary = "#cfcfc2"
secondary = "#f8f8f2"
highlight = "#e6db74"
text = "#a1ef34"
icon = "#a1ef34"
warning = "#f92672"
current = "#66d9ef"
[contributions.menus]
"napari/layers/segment" = [
    { submenu = "threshold" },
    { command = "example-plugin.all_thresholds" },
]
threshold = [
    { command = "example-plugin.threshold_otsu" },
    { command = "example-plugin.threshold_li" },
]