Skip to content

Add add_includes/etc methods to OrbiterBase#128

Merged
fritz-astronomer merged 16 commits intomainfrom
orbiter_base
Jan 23, 2026
Merged

Add add_includes/etc methods to OrbiterBase#128
fritz-astronomer merged 16 commits intomainfrom
orbiter_base

Conversation

@fritz-astronomer
Copy link
Contributor

Summary

Add five convenience methods to OrbiterBase class for fluent interface pattern:

  • add_requirements() - append to imports list
  • add_connections() - add to orbiter_conns set
  • add_env_vars() - add to orbiter_env_vars set
  • add_includes() - add to orbiter_includes set
  • add_variables() - add to orbiter_vars set

All methods include Pydantic @validate_call() validation and support both single items and iterables.

Changes

  • Added 5 methods to OrbiterBase with comprehensive doctests
  • Refactored OrbiterProject to use inline @validate_call() decorators
  • Updated type imports (Iterable, Self, validate_call)
  • Updated orbiter_meta to support lists

Test Plan

  • All 90 tests pass (85 existing + 5 new doctests)
  • Doctests verify single and multiple item additions
  • Type validation enforced by Pydantic decorators
  • No regressions in existing functionality

🤖 Generated with Claude Code

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.85%. Comparing base (b3ee237) to head (cbc0fd1).
⚠️ Report is 81 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

fritz-astronomer and others added 4 commits January 23, 2026 02:07
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.
@fritz-astronomer fritz-astronomer self-assigned this Jan 23, 2026
@fritz-astronomer fritz-astronomer changed the title feat: Add add_* methods to OrbiterBase Add add_includes/etc methods to OrbiterBase Jan 23, 2026
@fritz-astronomer fritz-astronomer added the enhancement New feature or request label Jan 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to OrbiterBase with Pydantic validation and comprehensive doctests
  • Refactored OrbiterProject to use inline @validate_call() decorators on methods
  • Updated orbiter_meta field to support both single OrbiterMeta and lists
  • Added typing-extensions dependency 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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Contributor Author

@fritz-astronomer fritz-astronomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-Reviewed ✔️

@fritz-astronomer fritz-astronomer merged commit 7d9867c into main Jan 23, 2026
8 checks passed
@fritz-astronomer fritz-astronomer deleted the orbiter_base branch January 23, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants