Command Line¶
Installing Plushy installs one command, plushy, with one subcommand.
plushy index¶
Scan source directories for plugins and write an index file that IndexFileSource reads at runtime (Discovery Modes).
| Option | Default | Meaning |
|---|---|---|
--scan PATH |
scan from [tool.plushy], else src |
A directory to scan. Repeatable. |
--output PATH |
index from [tool.plushy], else plushy_index.json |
Where to write the index. |
--keep-going |
off | Skip modules that fail to import, with a warning for each. |
The command imports every module under the scanned directories, except __init__.py files, and collects the Plugin subclasses that declare a namespace and a name, and the @plugin functions. It writes them as JSON, grouped by namespace:
Module names are derived from paths relative to the scanned directory's parent: scanning src/acme makes src/acme/charts.py the module acme.charts.
A module that fails to import makes the command fail: it names the module and the error, writes nothing, and exits with status 1, since the plugins of that module would otherwise be missing from the index without anyone noticing. Fix the module, leave it out with exclude, or pass --keep-going to skip it with a warning.
[tool.plushy]¶
Read from pyproject.toml in the current directory.
[tool.plushy]
scan = ["src/acme"] # directories to scan
index = "src/acme/_plushy_index.json" # output file
include = ["acme/plugins/*"] # only modules matching one of these
exclude = ["acme/tests/*"] # skip modules matching one of these
include and exclude are shell-style patterns (fnmatch) matched against each module's path relative to the scanned directory's parent, such as acme/plugins/charts.py. Options given on the command line take precedence over scan and index.