-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: feat(docworker): Support plugins
- Loading branch information
1 parent
c852790
commit e11e441
Showing
8 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/dsw-document-worker/dsw/document_worker/plugins/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .host import get_plugin_manager, hookimpl | ||
|
||
__all__ = ['get_plugin_manager', 'hookimpl'] |
31 changes: 31 additions & 0 deletions
31
packages/dsw-document-worker/dsw/document_worker/plugins/hookspecs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pluggy | ||
|
||
from ..consts import PACKAGE_NAME | ||
from ..templates.steps import Step | ||
|
||
|
||
hookspec = pluggy.HookspecMarker(PACKAGE_NAME) | ||
|
||
|
||
class PluginInfo: | ||
|
||
def __init__(self, name, version): | ||
self.name = name | ||
self.version = version | ||
|
||
|
||
@hookspec | ||
def document_worker_steps() -> list[Step]: | ||
pass | ||
|
||
@hookspec | ||
def document_worker_jinja_tests() -> dict: | ||
pass | ||
|
||
@hookspec | ||
def document_worker_jinja_filters() -> dict: | ||
pass | ||
|
||
@hookspec | ||
def document_worker_plugin_info() -> PluginInfo: | ||
pass |
13 changes: 13 additions & 0 deletions
13
packages/dsw-document-worker/dsw/document_worker/plugins/host.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pluggy | ||
|
||
from ..consts import PACKAGE_NAME | ||
from . import hookspecs | ||
|
||
hookimpl = pluggy.HookimplMarker(PACKAGE_NAME) | ||
|
||
def get_plugin_manager(): | ||
pm = pluggy.PluginManager(PACKAGE_NAME) | ||
pm.add_hookspecs(hookspecs) | ||
pm.load_setuptools_entrypoints(PACKAGE_NAME) | ||
# TODO: load local plugins | ||
return pm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters