AcademySoftwareFoundation / AcademySoftwareFoundation/rez
Subclassing default rezplugins instead of replacing
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 374
- Avg merge
- 9d 12h
- Merged PRs (30d)
- 5
Description
Hi all,
We sometimes need to override official rezplugins for some reasons and keep the default name (local build_process, ...) to avoid specifying a different plugins in each command call.
Since 2.40.3 with #677 feature, we are able to replace completely a default plugin by our custom one and this is really great.
But a complete replace could be hard to maintain with the HEAD of official rezplugins and a subclassing should be better. It's also useful to give info only about what have been modified from the default plugin.
So a custom build_process/local.py should only contain:
```python
from rezplugins.build_process.local import LocalBuildProcess
class MyCustomLocalBuildProcess(LocalBuildProcess):
def release(self, release_message=None, variants=None):
"""MyCustom LocalBuildProcess release override."""
self._print_header("Custom releasing %s..." % self.package.qualified_name)
def register_plugin():
return MyCustomLocalBuildProcess
```
instead of a full copy (~300 lines) with a similar modification than above.
Currently this is not possible to import the official `local` module when we are using the custom `local` plugin, the plugin_manager skips import of similar plugins (to avoid reload ?).
What do you think about this possible way to do ?
Jordi
Contributor guide
Research direction
Start with the plugin_manager behavior that skips importing a similarly named plugin, then compare it with the custom build_process/local.py and official rezplugins.build_process.local example in the issue. Done means a custom plugin can subclass the official LocalBuildProcess while retaining the default plugin name and replacement behavior; check existing plugin-loading tests if present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100