Add add_includes/etc methods to OrbiterBase#128
Conversation
Prepare for using git worktrees for isolated development branches. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #128 +/- ##
==========================================
+ Coverage 78.92% 82.85% +3.92%
==========================================
Files 35 51 +16
Lines 1362 2070 +708
==========================================
+ Hits 1075 1715 +640
- Misses 287 355 +68 ☔ View full report in Codecov by Sentry. |
Add conditional import of Self from typing_extensions for Python < 3.11. This ensures compatibility with Python 3.10 while using the built-in Self type for Python 3.11+. Changes: - Add typing-extensions dependency for Python < 3.11 - Update imports in __init__.py and project.py with version check Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- add_requirements(), add_connections(), add_env_vars(), add_includes(), add_variables() - All methods now accept | None = None parameter - Early return on None/empty to support fluent chaining without conditionals - Added doctests demonstrating None handling - Updated type hints and docstrings This allows cleaner method chaining in consuming code: operator(...).add_requirements(None).add_includes(None) # Returns self without error, no conditionals needed
…-ImportError - Updated add_* methods (add_requirements, add_connections, add_env_vars, add_includes, add_variables) to use explicit parameter names in doctests for clarity. - Improved Python 3.10 compatibility by wrapping Self import in try-except for fallback to typing_extensions.
add_includes/etc methods to OrbiterBase
There was a problem hiding this comment.
Pull request overview
This PR adds convenience methods to the OrbiterBase class to support fluent interface pattern for adding requirements, connections, environment variables, includes, and variables. It also refactors the OrbiterProject class to use inline @validate_call() decorators instead of post-class decoration.
Changes:
- Added five
add_*methods toOrbiterBasewith Pydantic validation and comprehensive doctests - Refactored
OrbiterProjectto use inline@validate_call()decorators on methods - Updated
orbiter_metafield to support both singleOrbiterMetaand lists - Added
typing-extensionsdependency for Python < 3.11 compatibility
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pyproject.toml | Added typing-extensions dependency for Python < 3.11 |
| orbiter/objects/project.py | Refactored to use inline @validate_call() decorators and Self type hint |
| orbiter/objects/init.py | Added five add_* methods to OrbiterBase with validation and doctests, updated orbiter_meta type |
| orbiter/init.py | Bumped version to 1.10.5 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove 4 skipped doctests by converting set outputs to sorted lists. Uses key=str for simple, deterministic ordering without accessing attributes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: fritz-astronomer <80706212+fritz-astronomer@users.noreply.github.com>
Summary
Add five convenience methods to
OrbiterBaseclass for fluent interface pattern:add_requirements()- append to imports listadd_connections()- add to orbiter_conns setadd_env_vars()- add to orbiter_env_vars setadd_includes()- add to orbiter_includes setadd_variables()- add to orbiter_vars setAll methods include Pydantic
@validate_call()validation and support both single items and iterables.Changes
OrbiterBasewith comprehensive doctestsOrbiterProjectto use inline@validate_call()decoratorsIterable,Self,validate_call)orbiter_metato support listsTest Plan
🤖 Generated with Claude Code