Skip to main content

Command line utilities for inspecting and validating plugins for the napari hub

Project description

napari-hub-cli

This package is not being updated or maintained with the latest napari hub metadata. To view a preview of your plugin listing for the napari hub, we recommend using the napari hub preview page service.

Command line utilities for inspecting and validating plugins for the napari hub.

Installation

From your console, you can install the napari hub CLI through pip

$ pip install napari-hub-cli

Usage (Not Maintained)

Metadata

This package provides two utilities for previewing and validating the metadata we will inspect from your plugin and display on the napari hub.

Previewing Metadata

$ napari-hub-cli preview-metadata /tmp/example-plugin

or

# display one field at a time and wait for input
$ napari-hub-cli preview-metadata /tmp/example-plugin -i

This utility will inspect the plugin at the given path for metadata and display it for preview.

Each field of metadata is accompanied by the file and attribute where it was found. When fields are missing, they are accompanied instead by a suggested source. When a field is sourced from setup.py, it is always an argument to the setup method.

Version - Depending on how you manage versioning for your package, we may not be able to parse its latest version. The version of your package displayed on the napari hub will always be the latest version released on PyPI.

Project Site - If your url or Project Site metadata is a GitHub url, it will be displayed as the Source Code field instead.

Example output:

--------------------------------------------------------------------------------
Authors
--------------------------------------------------------------------------------
Draga Doncila Pop
        ------
        Source
        ------
        /setup.cfg: metadata, author

--------------------------------------------------------------------------------
Description
--------------------------------------------------------------------------------
This is my napari-hub specific description. It is detailed, and comprehensive.
        ------
        Source
        ------
        /.napari/DESCRIPTION.md

--------------------------------------------------------------------------------
Source Code
--------------------------------------------------------------------------------
https://github.com/DragaDoncila/example-plugin
        ------
        Source
        ------
        /.napari/config.yml: project_urls, Source Code

--------------------------------------------------------------------------------
Summary
--------------------------------------------------------------------------------
~~Not Found~~
        ------
        Suggested Source
        ------
        /setup.cfg: metadata, summary

--------------------------------------------------------------------------------
User Support
--------------------------------------------------------------------------------
https://github.com/DragaDoncila/example-plugin/issues
        ------
        Source
        ------
        /.napari/config.yml: project_urls, User Support

You can then use check-missing to get a display of just the missing metadata. See Customizing Your Plugin Listing for a detailed guide on how you can add this metadata to your project.

Checking Missing Metadata

$ napari-hub-cli check-missing /tmp/example-plugin

or

# display one field at a time and wait for input
$ napari-hub-cli check-missing /tmp/example-plugin -i

This utility will only display the metadata missing from your plugin, and will also suggest where you can add it. All metadata listed here will be displayed on your plugin's napari hub page. When this metadata might also be used for sorting, filtering or searching for plugins, this information is also displayed.

Example output:

--------------------------------------------------------------------------------
MISSING: Twitter
--------------------------------------------------------------------------------
        SUGGESTED SOURCE:       /.napari/config.yml: project_urls, Twitter

--------------------------------------------------------------------------------
MISSING: Summary
--------------------------------------------------------------------------------
        SUGGESTED SOURCE:       /setup.cfg: metadata, summary
        ------
        Used For
        ------
        Searching

For more information on how you can add metadata to your package, and how we use it on the napari hub, check out Customizing Your Plugin Listing.

Development Information

The main logic of metadata loading proceeds from the load_meta function, and each filetype has its own parsing function. In addition, we use a parse_complex_metadata function to handle edge case parsing of certain fields that may be found in setup.py and setup.cfg.

Where do we look for metadata?

The source of truth for both reading metadata and suggesting its source locations is found in metadata_sources.csv.

Metadata can be found in the following files, with paths given from the root directory, and these files are preferentially searched in order:

  • .napari/config.yml - Author information, project URLs
  • .napari/DESCRIPTION.md - Long description
  • setup.cfg - All packaging metadata and potentially long description (could also be a pointer to README.md)
  • setup.py - All packaging metadata and potentially long description. Only used if setup.cfg is not present, or not complete.

In addition to these files, we may also search module __init__.py files and any _version.py files we find for the version number.

Why so complex?

The main source of complexity for loading this metadata arises from the requirements:

  • metadata needs to be parsed before the package is released, so we cannot rely on PyPI
  • we prefer not to install the package into the active environment to read the metadata
  • we would like to show users where their metadata is being read from, and where they can go to change it

These requirements mean we cannot just build a wheel/inspect package metadata from its distribution, because its source file will then be irretrievable. As a result, we rely on inspecting the contents of files individually, and parse config.yml, setup.py and setup.cfg independently.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to opensource@chanzuckerberg.com.

Project details


Download files

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

Source Distribution

napari-hub-cli-0.0.4.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

napari_hub_cli-0.0.4-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file napari-hub-cli-0.0.4.tar.gz.

File metadata

  • Download URL: napari-hub-cli-0.0.4.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for napari-hub-cli-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f3308c5c5bcdb41824a7c781ad52940657f56056526a1cd2ee7cdcb3b402e864
MD5 b94f370c0dc6366eeca77d521448d872
BLAKE2b-256 486ccc98751bc54323f8abbfd3d25aa52d59c77b8e1d2801627a2edd2e458859

See more details on using hashes here.

Provenance

File details

Details for the file napari_hub_cli-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: napari_hub_cli-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for napari_hub_cli-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fc43dd619f76537e6d17ea4edc5f4b999ee67276c3622defda62f5c505423424
MD5 417eadb496c60b0d96ccc23bcf39c4bb
BLAKE2b-256 0052ddc679d60221052f430fb095acf1bf3578ac485d1c5e77e0cc3274ae4a30

See more details on using hashes here.

Provenance

Supported by

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