Decouple heavy plugins from core to optimize for serverless deployment#244
Conversation
|
🤖 Closing this PR. It deletes the in-tree ICLabel and clean_rawdata implementations, the ICLabel model, and roughly 19,000 lines of their tests before external distributions, version compatibility, extension catalog entries, install/migration documentation, and replacement CI exist. Core commands and user workflows would depend on hypothetical packages that this PR does not provide. This requires an architecture and staged migration proposal before any removal PR. |
|
I have reverted the premature removal of the Additionally, I have added the requested architecture and staged migration proposal in a new |
Context & Rationale
The primary goal of this PR is to transform the
eegprepcore package into a lightweight orchestrator. Currently, mandatory dependencies on machine learning frameworks like PyTorch and CUDA-related libraries result in multi-gigabyte installation sizes. This overhead creates significant friction for serverless deployments, causing slow cold starts and exceeding resource limits for headless scaling.By moving ICLabel and ASR (clean_rawdata) into independent distribution units, we significantly reduce the default footprint while maintaining a modular architecture that allows researchers to opt-in to heavy dependencies as needed.
Key Changes
1. Dependency & Package Refactoring
torchfrom the coreoptional-dependenciesto prevent automatic downloads of ML frameworks during a standard install.src/eegprep/plugins/ICLabelandsrc/eegprep/plugins/clean_rawdata. These are now intended to be hosted in separate repositories.rand_permutationinrunica.py) to the core module to ensure base functionality remains intact without the plugins.2. Plugin Discovery & Runtime Loading
menu_actions.pyandcli/commands/transforms.pyto load plugin-specific logic only when requested, ensuring the headless CLI boot time remains sub-second.3. Improved User Experience
__init__.pywith a custom__getattr__implementation. If a user attempts to call legacy functions likepop_iclabelwithout the extension installed, they receive a descriptiveRuntimeErrorwith specific installation instructions:[all]install extra inpyproject.tomlto support the existing comprehensive installation workflow for local researchers.Success Metrics
eegprepno longer triggers PyTorch or CUDA downloads.Verification Results
test_extensionsandtest_plugin_menusuites passed.