Coverage for nexusLIMS/extractors/plugins/__init__.py: 100%
1 statements
« prev ^ index » next coverage.py v7.11.3, created at 2026-03-24 05:23 +0000
« prev ^ index » next coverage.py v7.11.3, created at 2026-03-24 05:23 +0000
1"""Plugin package for NexusLIMS extractors.
3This package contains extractor plugins that are auto-discovered by the
4ExtractorRegistry. Any module in this package (or subpackages) that defines
5a class implementing the BaseExtractor protocol will be automatically
6registered.
8To create a new extractor plugin:
101. Create a new .py file in this directory
112. Define a class with these attributes/methods:
12 - name: str (unique identifier)
13 - priority: int (0-1000, higher = preferred)
14 - supports(context: ExtractionContext) -> bool
15 - extract(context: ExtractionContext) -> dict[str, Any]
163. The registry will automatically discover and register it
18No manual registration required!
20Examples
21--------
22Creating a new extractor plugin::
24```python
25# plugins/my_extractor.py
26from nexusLIMS.extractors.base import ExtractionContext
28class MyFormatExtractor:
29 name = "my_format_extractor"
30 priority = 100
32 def supports(self, context: ExtractionContext) -> bool:
33 return context.file_path.suffix.lower() == '.myformat'
35 def extract(self, context: ExtractionContext) -> dict:
36 # Extract metadata
37 return {"nx_meta": {...}}
38```
39"""
41__all__ = []