NRLMMD-GEOIPS / NRLMMD-GEOIPS/pluginify
Give YAML plugin objects a useful `__str__`
Open
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Requested Update
Description
- Printing a YAML plugin doesn't tell you much at a glance, since it falls back to the full
__repr__dump of the plugin's contents. Add a__str__toBaseYamlPluginthat gives a short readable summary for the cases where you just want to know which plugin you're looking at.
Background and Motivation
- This is the pluginify side of NRLMMD-GEOIPS/geoips#424, which covers the class-based plugins whose base class lives over in geoips. Both sides are using the same wording so the two kinds of plugin read the same way.
__repr__stays exactly as it is. The full dump is useful when you actually want to see everything in a plugin, and this is only about having a shorter option alongside it.- Leaving
familyout of the output on purpose, since it's on its way to being deprecated.
Alternative Solutions
- Only fixing the class-based side in geoips and leaving this one alone. Workable, but then
the two kinds of plugin behave differently for no good reason.
Environment
Code to demonstrate issue
What you get now:
>>> print(products.get_plugin(("abi", "Infrared")))
ProductsPlugin({'interface': 'products', 'name': 'Infrared', 'spec': {...}, ...})
What we want, with repr still available for the full picture:
>>> print(products.get_plugin(("abi", "Infrared")))
Infrared (products plugin from geoips)
Checklist for Completion
- Add
__str__toBaseYamlPlugin - Leave
__repr__alone - Make sure it degrades gracefully when a plugin is missing attributes, so it never
blows up on a half-built plugin in a debugger - Keep the wording matching what geoips#424 produces
- Add tests
- Add a release note
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.