-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
The sdgsystem/configs/config.py file has grown to 818 lines, making it difficult to maintain, understand, and extend. Multiple config classes have extremely long from_dict methods (150+ lines), violating the Single Responsibility Principle.
Metrics
- Lines: 818 (should be split into multiple files)
- Classes: 20+ config classes in one file
- Cyclomatic Complexity: High in
from_dictmethods - Method Length: Some methods exceed 150 lines
Issues
- Discoverability - Hard to find specific config classes
- Merge Conflicts - High risk when multiple people edit
- Testing - Difficult to test in isolation
- Cognitive Load - Too much to understand in one file
- Reusability - Config classes can't be easily imported separately
Proposed Structure
sdgsystem/configs/
├── __init__.py # Re-export all configs
├── base.py # BaseConfig, common utilities
├── model.py # ModelConfig, ProviderConfig
├── generation.py # GenerationConfig, RewriteConfig
├── tasks/
│ ├── __init__.py
│ ├── text.py # TextTaskConfig, LocalConfig, WebConfig
│ └── image.py # ImageTaskConfig, VQAConfig
├── training.py # TrainerConfig, SFTConfig, GRPOConfig
├── evaluation.py # EvaluationConfig, DeepEvalConfig
├── server.py # ServerConfig, CORSConfig (new!)
└── loaders.py # YAML/dict loading utilities
Benefits
✅ Maintainability - Each file < 200 lines
✅ Clarity - Related configs grouped together
✅ Testability - Can test each module independently
✅ Extensibility - Easy to add new config types
✅ Navigation - IDE can jump to files directly
Migration Strategy
- Create new directory structure
- Extract configs incrementally (maintain backward compatibility)
- Update imports in dependent files
- Keep
__init__.pywith re-exports for compatibility - Update documentation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels