Add Pydantic-based postprocessor configuration framework#25
Open
tomdurrant wants to merge 3 commits intomainfrom
Open
Add Pydantic-based postprocessor configuration framework#25tomdurrant wants to merge 3 commits intomainfrom
tomdurrant wants to merge 3 commits intomainfrom
Conversation
Implement configuration-driven postprocessing to bring parity with run backend framework. BREAKING CHANGES: - Replace string-based processor names with config objects - ModelRun.postprocess() now requires BasePostprocessorConfig instances - CLI --processor option replaced with --processor-config (required) - LocalPipelineBackend.execute() requires processor_config parameter New Features: - BasePostprocessorConfig abstract class with common fields - NoopPostprocessorConfig concrete implementation - Entry point-based dynamic config loading (rompy.postprocess.config) - ProcessorConfig type alias for Union of all processor configs - CLI --processor-config option for postprocess/pipeline commands - CLI --processor-type option for backends validate command - Example configs in examples/backends/postprocessor_configs/ Files Added: - src/rompy/postprocess/config.py - Config classes and loading - tests/test_postprocess_config.py - Comprehensive test suite (18 tests) - examples/backends/postprocessor_configs/ - Example YAML configs Files Modified: - src/rompy/cli.py - Updated CLI commands - src/rompy/model.py - Updated postprocess() method - src/rompy/pipeline/__init__.py - Updated LocalPipelineBackend - pyproject.toml - Added entry point registration - tests/backends/test_enhanced_backends.py - Updated pipeline tests - README.md - Added postprocessor configuration section - HISTORY.rst - Added v0.6.0 changelog entry All tests passing: 254 passed, 15 skipped
Add comprehensive documentation for Pydantic-based postprocessor configuration system across all relevant docs: - CLI documentation: Added --processor-config and --processor-type options for postprocess, pipeline, and backends validate commands - Backends documentation: Added complete Postprocessor Configuration section with usage examples, validation, and CLI integration - Plugin architecture: Updated postprocessor section to reflect configuration-based approach with detailed implementation examples - Configuration deep dive: Added postprocessor configuration section with validation, serialization, and entry point loading - Backend reference: Comprehensive developer documentation for custom postprocessor configurations and implementations Key documentation additions: - Configuration file formats (YAML/JSON) - Entry point registration and discovery - Type-safe validation with Pydantic - Custom postprocessor configuration development - CLI integration and usage examples - Configuration serialization and schema generation - Integration with pipeline backends All documentation now reflects the new configuration-driven postprocessing API that replaces the old string-based processor selection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a comprehensive Pydantic-based postprocessor configuration framework that brings parity with the run backend configuration system. Enables configuration-driven postprocessing via YAML/JSON files with CLI support.
Motivation
The existing postprocessing system used string-based processor names, which lacked type safety, validation, and extensibility. This implementation provides:
Changes
Core Implementation
New Files:
src/rompy/postprocess/config.py(226 lines) - Configuration classes and loading infrastructuretests/test_postprocess_config.py(234 lines) - Comprehensive test suite (18 tests)examples/backends/postprocessor_configs/- Example YAML configurations with documentationModified Files:
src/rompy/cli.py- Updated CLI commands with--processor-configoptionsrc/rompy/model.py- Updatedpostprocess()to require config objectssrc/rompy/pipeline/__init__.py- Updated LocalPipelineBackend for config objectspyproject.toml- Added entry point registrationtests/backends/test_enhanced_backends.py- Updated all pipeline testsDocumentation
Updated 5 documentation files with 1064+ lines of new content:
docs/cli.md- CLI options and usagedocs/backends.md- Postprocessor configuration guidedocs/plugin_architecture.md- Plugin developmentdocs/configuration_deep_dive.md- Configuration patternsdocs/developer/backend_reference.md- Developer referenceBreaking Changes
API Changes
Old (removed):
New (required):
CLI Changes
Old (removed):
New (required):
Features
Configuration Classes
BasePostprocessorConfig- Abstract base with common fieldsNoopPostprocessorConfig- Concrete implementation for validation-only processingProcessorConfig- Type alias for Union of all processor configsEntry Point System
Configurations are dynamically loaded via entry points:
CLI Integration
rompy postprocess- Process existing model outputs with config filerompy pipeline- Updated to require--processor-configoptionrompy backends validate- Added--processor-typeoption for validationConfiguration File Format
Testing
Migration Guide
For Users
Replace string processor names with configuration files:
Update Python code:
For Plugin Developers
Create configuration class:
Register in
pyproject.toml:Examples
See
examples/backends/postprocessor_configs/for:noop_basic.yml- Minimal configurationnoop_advanced.yml- Advanced optionsREADME.md- Usage documentationBackward Compatibility
No backward compatibility maintained. The postprocessing framework is relatively new, and the priority is a clean, functional implementation over maintaining the old string-based API.
Related Issues
Addresses the need for configuration-driven postprocessing to match the existing backend configuration framework.
Checklist
Changelog Entry
Added to
HISTORY.rstfor v0.6.0:Breaking Changes:
--processoroption replaced with--processor-config(required)New Features:
Note: This PR does not require backward compatibility as the postprocessing system is relatively new.