Skip to main content

A CLI tool to help with maintaining OctoPrint Plugins

Project description

octoprint-plugin-tool

A CLI tool (and library) to help with maintaining OctoPrint Plugins.

Installation

pip install octoprint-plugin-tool

octoprint-plugin-tool requires Python 3.9 or later.

Usage

As a Python library

import sys

from octoprint_plugin_tool import migrate_to_pyproject

def log(message, warning: bool = False, error: bool = False):
  if warning:
    message = f"[WARNING] {message}"
  print(message, file=sys.stderr if error else sys.stdout)

if migrate_to_pyproject("/path/to/plugin", force=False, rename=True):
  print("Yay!")
else:
  print("Nay!", file=sys.stderr)

As a command line tool

$ octoprint-plugin-tool
usage: octoplugin-tool [-h] [--verbose] {to-pyproject} ...

A CLI tool to help with maintaining OctoPrint Plugins

positional arguments:
  {to-pyproject}
    to-pyproject  Migrate legacy setup.py based OctoPrint plugin to modern
                  pyproject.toml based packaging

options:
  -h, --help      show this help message and exit
  --verbose, -v   increase logging verbosity

to-pyproject

This subcommand allows you to migrate most setup.py based OctoPrint plugins generated from OctoPrint's plugin template until June 2025 (e.g. through octoprint dev plugin:new) to more modern pyproject.toml based tooling.

Current limitations include the use of any non-string values for the various plugin_ properties, the use of plugin_additional_packages or additional_setup_parameters, or non-compliant package or identifier names.

The tool will bail if it detects any issues and give you an error indicating what's wrong.

$ octoprint-plugin-tool to-pyproject --help
usage: octoplugin-tool to-pyproject [-h] [--path PATH] [--force]
                                    [--rename-package]

options:
  -h, --help        show this help message and exit
  --path PATH       Path of the local plugin development folder to migrate, if
                    other than cwd
  --force           Force migration, even if setup.py looks wrong
  --rename-package  Automatically rename package to recommended naming scheme

Example

$ octoprint-plugin-tool to-pyproject --path OctoPrint-RequestSpinner/
Attempting to migrate plugin in OctoPrint-RequestSpinner
Extracting plugin data from OctoPrint-RequestSpinner/setup.py...
Validating and migrating plugin data for plugin in OctoPrint-RequestSpinner...
Plugin still supports EOL Python 3.7 or 3.8, not enabling PEP639
Generating OctoPrint-RequestSpinner/pyproject.toml...
Generating OctoPrint-RequestSpinner/setup.py...
Generating OctoPrint-RequestSpinner/Taskfile.yml...
Updating OctoPrint-RequestSpinner/MANIFEST.in as necessary...
        Adding "recursive-include octoprint_requestspinner/templates *"...
        Adding "recursive-include octoprint_requestspinner/translations *"...
        Adding "recursive-include octoprint_requestspinner/static *"...
Cleaning up...
        Removing no longer needed OctoPrint-RequestSpinner/requirements.txt...
... done!

PLEASE REVIEW THE CHANGES THOROUGHLY AND MAKE SURE TO TEST YOUR PLUGIN AND ITS INSTALLATION!

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

octoprint_plugin_tool-0.1.1.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

octoprint_plugin_tool-0.1.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file octoprint_plugin_tool-0.1.1.tar.gz.

File metadata

  • Download URL: octoprint_plugin_tool-0.1.1.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for octoprint_plugin_tool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c65adee7fccef1cd5794e0edbf32bd290bda32b3b0b8d9c03ba45e61783e3844
MD5 bb40ad69ec9aebb26fe09633d064d8b4
BLAKE2b-256 c846414ec48a6accf12b2aa09e2fa89a42958654fb6fa3fa2609a13cdc7eac37

See more details on using hashes here.

Provenance

The following attestation bundles were made for octoprint_plugin_tool-0.1.1.tar.gz:

Publisher: ci.yml on OctoPrint/octoprint-plugin-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file octoprint_plugin_tool-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for octoprint_plugin_tool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e574893e902531bf4fac4c4efefd0d64c672a69c89ebc53a17af3384b72ceba
MD5 90f3e2f993eac59fa17b4f9c37a44f37
BLAKE2b-256 13d3d3f74caf0b42f1a931382d7407f4b84fb7a71688d9baa0d1558667016918

See more details on using hashes here.

Provenance

The following attestation bundles were made for octoprint_plugin_tool-0.1.1-py3-none-any.whl:

Publisher: ci.yml on OctoPrint/octoprint-plugin-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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