Skip to content

Plugin factory - building on PR #1524 - #1590

Closed
csoeller wants to merge 5 commits into
python-microscopy:masterfrom
csoeller:plugin-factory
Closed

Plugin factory - building on PR #1524#1590
csoeller wants to merge 5 commits into
python-microscopy:masterfrom
csoeller:plugin-factory

Conversation

@csoeller

Copy link
Copy Markdown
Contributor

This is a debugged and ever so slightly tweaked version of PR #1524.

Is this a bugfix or an enhancement?

More like enhancement although mostly a smallish bugfix of PR #1524.

The plugin factory approach presented in PR #1524 seems compelling but would not run. This version has been debugged and very slightly tweaked using argparse.BooleanOptionalAction which requires a recent Python version (3.9+ I believe) but at this stage I think we demand versions in this range with latest PYME releases in any case.

The PR could alternatively have been raised against David_Baddeley/python-microscopy which is still entirely possible if preferred, important to mention that all credits should go to @David-Baddeley for the idea and implementation. Please provide guidance in the comments if that is the preferred route.

It seems sensible to get this PR integrated into the dist ahead of the bigger task of updating the PYME build system (see also #1562) so that it can be considered during that upgrade for generating plugins compatible with the new build system.

Proposed changes:

#1524 was not running as is and with some testing everything now appears to work in this version.

Usage is

python -m PYME.util.plugin_factory output_directory package_name

with a few possible options, i.e.

usage: plugin_factory.py [-h] [--pymeimage | --no-pymeimage] [--pymevis | --no-pymevis] [--recipe | --no-recipe]
                         [--fit_factories | --no-fit_factories] [--reports | --no-reports] [--dist | --no-dist]
                         output_dir package_name

Create a template for a PYME plugin

positional arguments:
  output_dir            Directory to write the plugin template to
  package_name          Name of the package

options:
  -h, --help            show this help message and exit
  --pymeimage, --no-pymeimage
                        Create a PYMEImage plugin with the given name
  --pymevis, --no-pymevis
                        Create a PYMEVisualize plugin with the given name
  --recipe, --no-recipe
                        Create a recipe module with the given name
  --fit_factories, --no-fit_factories
                        Create a fit factory with the given name
  --reports, --no-reports
                        Create a reports module with the given name
  --dist, --no-dist     setup to install plugins in dist mode (for other users)

Checklist:

Checked with recent git versions of PYME. Seems to generate and then install plugins fine with current PYME.

@csoeller

csoeller commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

This would need revisiting with the newer build guidelines for setuptools etc so closing for now...

@csoeller csoeller closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant