rename plugins dirs

This commit is contained in:
Nick Sweeting 2024-09-24 01:34:27 -07:00
parent 8713091e73
commit e8f1264954
No known key found for this signature in database
28 changed files with 31 additions and 31 deletions

View file

@ -11,11 +11,11 @@ class BaseAdminDataView(BaseHook):
# verbose_name: str = 'Data View'
# route: str = '/npm/installed/'
# view: str = 'pkg_plugins.npm.admin.installed_list_view'
# view: str = 'plugins_pkg.npm.admin.installed_list_view'
# items: Dict[str, str] = {
# "name": "installed_npm_pkg",
# 'route': '<str:key>/',
# 'view': 'pkg_plugins.npm.admin.installed_detail_view',
# 'view': 'plugins_pkg.npm.admin.installed_detail_view',
# }
def register(self, settings, parent_plugin=None):

View file

@ -26,11 +26,11 @@ class BaseHook(BaseModel):
# django imports AppConfig, models, migrations, admins, etc. for all installed apps
# django then calls AppConfig.ready() on each installed app...
pkg_plugins.npm.NpmPlugin().AppConfig.ready() # called by django
pkg_plugins.npm.NpmPlugin().register(settings) ->
pkg_plugins.npm.NpmConfigSet().register(settings)
plugins_pkg.npm.NpmPlugin().AppConfig.ready() # called by django
plugins_pkg.npm.NpmPlugin().register(settings) ->
plugins_pkg.npm.NpmConfigSet().register(settings)
plugantic.base_configset.BaseConfigSet().register(settings)
plugantic.base_hook.BaseHook().register(settings, parent_plugin=pkg_plugins.npm.NpmPlugin())
plugantic.base_hook.BaseHook().register(settings, parent_plugin=plugins_pkg.npm.NpmPlugin())
...
...
@ -74,17 +74,17 @@ class BaseHook(BaseModel):
@property
def hook_module(self) -> str:
"""e.g. extractor_plugins.singlefile.apps.SinglefileConfigSet"""
"""e.g. plugins_extractor.singlefile.apps.SinglefileConfigSet"""
return f'{self.__module__}.{self.__class__.__name__}'
@property
def hook_file(self) -> Path:
"""e.g. extractor_plugins.singlefile.apps.SinglefileConfigSet"""
"""e.g. plugins_extractor.singlefile.apps.SinglefileConfigSet"""
return Path(inspect.getfile(self.__class__))
@property
def plugin_module(self) -> str:
"""e.g. extractor_plugins.singlefile"""
"""e.g. plugins_extractor.singlefile"""
return f"{self.__module__}.{self.__class__.__name__}".split("archivebox.", 1)[-1].rsplit(".apps.", 1)[0]
@property

View file

@ -61,14 +61,14 @@ class BasePlugin(BaseModel):
def plugin_module(self) -> str: # DottedImportPath
""" "
Dotted import path of the plugin's module (after its loaded via settings.INSTALLED_APPS).
e.g. 'archivebox.pkg_plugins.npm.apps.NpmPlugin' -> 'pkg_plugins.npm'
e.g. 'archivebox.plugins_pkg.npm.apps.NpmPlugin' -> 'plugins_pkg.npm'
"""
return f"{self.__module__}.{self.__class__.__name__}".split("archivebox.", 1)[-1].rsplit('.apps.', 1)[0]
@property
def plugin_module_full(self) -> str: # DottedImportPath
"""e.g. 'archivebox.pkg_plugins.npm.apps.NpmPlugin'"""
"""e.g. 'archivebox.plugins_pkg.npm.apps.NpmPlugin'"""
return f"{self.__module__}.{self.__class__.__name__}"
# @computed_field
@ -84,7 +84,7 @@ class BasePlugin(BaseModel):
# preserve references to original default objects,
# pydantic deepcopies them by default which breaks mutability
# see https://github.com/pydantic/pydantic/issues/7608
# if we dont do this, then sys_plugins.base.CORE_CONFIG != settings.CONFIGS.CoreConfig for example
# if we dont do this, then plugins_sys.base.CORE_CONFIG != settings.CONFIGS.CoreConfig for example
# and calling .__init__() on one of them will not update the other
self.hooks = self.model_fields['hooks'].default