Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: remove plugins

NTFSvolume7dc3b73a3c32
diff --git a/cyberdrop_dl/plugins.py b/cyberdrop_dl/plugins.py
deleted file mode 100644
index 5da6ee05b..000000000
--- a/cyberdrop_dl/plugins.py
+++ /dev/null
@@ -1,59 +0,0 @@
-"""Loads external packages dynamically from their metadata
-
-Packages need to specify an entrypoint in their metadata as "cyberdrop_dl_plugins".
-
-The entrypoint will be executed after CDL's startup but before the scrape process begins.
-
-The entrypoint must be a callable that takes an instance of `Manager`
-
-Example plugin: https://github.com/NTFSvolume/cdl-dynamic-crawlers
-
-NOTE: Since this works with packages' metadata, only valid packages published to pypi can be used as plugins and they need to be installed on the same env as CDL
-
-See: https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata"""
-
-from __future__ import annotations
-
-import dataclasses
-import logging
-from importlib.metadata import entry_points
-from typing import TYPE_CHECKING, Final
-
-from cyberdrop_dl import env
-
-if TYPE_CHECKING:
- from collections.abc import Iterable
- from importlib.metadata import EntryPoint
-
- from cyberdrop_dl.manager import Manager
-
-logger = logging.getLogger(__name__)
-_GROUP_NAME: Final = "cyberdrop_dl_plugins"
-
-
[email protected](slots=True, frozen=True)
-class Plugin:
- name: str
- module: str
- value: str
- entrypoint: EntryPoint = dataclasses.field(repr=False)
-
-
-def _get_plugins() -> Iterable[Plugin]:
- for entrypoint in entry_points(group=_GROUP_NAME):
- yield Plugin(
- entrypoint.name,
- entrypoint.module,
- entrypoint.value,
- entrypoint,
- )
-
-
-def load(manager: Manager) -> None:
- for plugin in _get_plugins():
- if env.NO_PLUGINS:
- logger.error(f"Found plugins installed but plugins are disabled. Ignored: {tuple(_get_plugins())}")
- return
-
- plugin.entrypoint.load()(manager)
- logger.info(f"Loaded {plugin}")
diff --git a/cyberdrop_dl/scrape_mapper.py b/cyberdrop_dl/scrape_mapper.py
index 38c6df459..e21274ffc 100644
--- a/cyberdrop_dl/scrape_mapper.py
+++ b/cyberdrop_dl/scrape_mapper.py
@@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any, Literal, Self
from pydantic.types import ByteSize
-from cyberdrop_dl import aio, filepath, plugins, storage
+from cyberdrop_dl import aio, filepath, storage
from cyberdrop_dl.clients.jdownloader import JDownloader
from cyberdrop_dl.constants import BlockedDomains
from cyberdrop_dl.crawlers import create_crawlers
@@ -150,8 +150,6 @@ class ScrapeMapper:
_disable_crawlers_by_config(self.crawlers, *self.manager.config.disable_crawlers)
- plugins.load(self.manager)
-
@contextlib.asynccontextmanager
async def __call__(self) -> AsyncGenerator[Self]:
assert not self._done.is_set()