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.0.tar.gz (22.4 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.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for octoprint_plugin_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 556c76d01bc877e1361bf60d3f389490bc1bf70f54ae38add71c9edcd0f6a07a
MD5 b9362002997fcb6cd91bf12d9773e22c
BLAKE2b-256 589f7dadf9b7a269608b6007366a3a64207c12c55024901aeeb07e443d598bd9

See more details on using hashes here.

Provenance

The following attestation bundles were made for octoprint_plugin_tool-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for octoprint_plugin_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a644bceebf38c5a11a952f6308e7445ab52a3225e58b1916de3402afc728ac3
MD5 e324d0361bfcb6430b8b739dd7bda461
BLAKE2b-256 7f11286652bef1aabb6e8598e99603a91d2aebf7097e3680063ef111563a7be1

See more details on using hashes here.

Provenance

The following attestation bundles were made for octoprint_plugin_tool-0.1.0-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