shashbha14 opened a new pull request, #62314:
URL: https://github.com/apache/airflow/pull/62314

   Description
   
   This PR improves the robustness and developer experience of the Airflow 
plugin system by adding thorough type hinting and Pydantic-based validations 
for `AirflowPlugin` attributes.
   
   Key Improvements:
   - Refactored Model Definition: Moved all plugin attribute models to a 
dedicated \`models.py\` in the shared \`plugins_manager\` package, keeping the 
core logic clean.
   - Enhanced Type Hinting: Added comprehensive type hints to the 
\`AirflowPlugin\` class for all attributes (macros, views, apps, listeners, 
etc.).
   - Declarative Validation: Updated \`AirflowPlugin.validate()\` with a 
declarative validation approach that leverages Pydantic for complex attributes 
while maintaining basic checks for others.
   - Streamlined Compatibility: Introduced a \`_convert_to_dict\` helper in the 
core manager to cleanly handle Pydantic model-to-dictionary conversion, 
ensuring full backward compatibility with legacy views and routers.
   - Updated Examples: Refined the \`test_plugin.py\` and documentation example 
(\`empty_plugin_example.py\`) to demonstrate the new strongly-typed approach.
   
   Tests
   - Updated \`airflow-core/tests/unit/plugins/test_plugin.py\` with 
model-based test cases and a new validation test.
   - Verified manual validation of the refactored code structure.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to