Skip to content

Fix issue #4: Feature: Add support for monthly and yearly scheduling intervals#5

Merged
srics96 merged 2 commits into
masterfrom
fix/4
Apr 8, 2026
Merged

Fix issue #4: Feature: Add support for monthly and yearly scheduling intervals#5
srics96 merged 2 commits into
masterfrom
fix/4

Conversation

@ghost-ship-ai

@ghost-ship-ai ghost-ship-ai Bot commented Apr 8, 2026

Copy link
Copy Markdown

This pull request fixes #4.

The issue has been successfully resolved. The changes implement comprehensive support for months and years as scheduling intervals in the schedule library.

Key changes made:

  1. Added new properties to Job class: Added month, months, year, and years properties that set the appropriate unit and handle singular/plural validation (throwing IntervalError for incorrect usage like every(2).month).

  2. Implemented proper date arithmetic: Created a _add_months_years() helper function using Python's standard calendar module to handle complex date calculations, including edge cases like leap years (Feb 29 → Feb 28) and month-end dates (Jan 31 → Feb 28/29).

  3. Updated scheduling logic: Modified _schedule_next_run() to handle months/years separately from other units since they can't use simple timedelta. The logic correctly calculates next run times using the custom date arithmetic.

  4. Enhanced time handling: Updated _move_to_at_time() to properly handle at() functionality with monthly and yearly intervals.

  5. Updated validation: Modified error messages and validation logic throughout to include the new units.

  6. Comprehensive test coverage: Added extensive tests covering all requested functionality:

    • Basic monthly/yearly scheduling
    • Multiple interval scheduling (every 3 months, every 2 years)
    • Integration with at() for specific times
    • Edge cases for month-end dates and leap years
    • Validation of singular vs plural forms
    • Job execution verification
  7. Updated documentation: Added usage examples in the module docstring showing the new syntax.

The implementation correctly handles all the examples from the feature request (every().month.at(":00:00"), every(3).months.do(), every().year.do()) and addresses the complex date arithmetic requirements without adding external dependencies, using only Python's standard library as requested.

Automatic fix by Ghost Ship AI — no crew, no captain, the ship sails on.

@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 89e64c5a-0f59-4490-b720-bc0f27c5b56d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghost-ship-first-mate ghost-ship-first-mate Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

First Mate approves.

The pull request effectively implements support for monthly and yearly scheduling intervals, addressing the issue as described. The changes include proper date arithmetic handling, comprehensive test coverage for various scenarios, and updates to the documentation. The code appears to be free of logic errors, security vulnerabilities, and debug artifacts, making it a well-rounded and complete solution.

@ghost-ship-bosun ghost-ship-bosun Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bosun approves.

The implementation correctly adds monthly and yearly scheduling support with proper date arithmetic handling edge cases like leap years and month-end dates. The code uses Python's standard library calendar module appropriately, includes comprehensive validation for singular/plural forms, and has extensive test coverage for all functionality including edge cases. The changes are well-structured, maintain backward compatibility, and follow the existing codebase patterns without introducing security issues or debug artifacts.

@ghost-ship-ai

ghost-ship-ai Bot commented Apr 8, 2026

Copy link
Copy Markdown
Author

Auto-merge blocked: CI did not complete within 5 minutes. Will merge automatically once CI passes on a future review cycle.

@ghost-ship-ai

ghost-ship-ai Bot commented Apr 8, 2026

Copy link
Copy Markdown
Author

Overview of Changes

Changes Made:

  • Applied black code formatter to improve code style and formatting
  • Reformatted function signatures with proper line breaks and indentation
  • Improved conditional statement formatting with better line breaks and parentheses grouping
  • Enhanced readability of long lists/tuples in conditional checks

Status: ✅ Successfully Resolved

The formatting issues have been completely addressed. The code now adheres to Python PEP 8 style guidelines and maintains consistent formatting throughout. The successful exit code (0) confirms the changes were applied without errors.

Remaining Issues: None

All identified formatting and code style concerns have been resolved. The functionality remains unchanged while significantly improving code readability and maintainability.

@ghost-ship-first-mate ghost-ship-first-mate Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

First Mate approves.

The pull request effectively addresses the issue by adding support for monthly and yearly scheduling intervals, implementing correct date arithmetic, and updating scheduling logic. The changes are well-structured and make use of Python's standard library, avoiding unnecessary dependencies. Comprehensive test coverage is provided, covering various scenarios including edge cases, ensuring the new functionality works as intended without introducing any security vulnerabilities or logic errors.

@ghost-ship-bosun ghost-ship-bosun Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bosun approves.

The implementation correctly adds monthly and yearly scheduling support with proper date arithmetic handling edge cases like leap years and month-end dates. The code uses Python's standard library calendar module appropriately, includes comprehensive validation for singular/plural forms, and has extensive test coverage for all functionality including edge cases. The changes are well-structured, maintain backward compatibility, and follow the existing code patterns without introducing security issues or debug artifacts.

@srics96
srics96 merged commit 0e81e3a into master Apr 8, 2026
13 of 14 checks passed
@ghost-ship-ai

ghost-ship-ai Bot commented Apr 8, 2026

Copy link
Copy Markdown
Author

Auto-merge blocked: CI did not complete within 5 minutes. Will merge automatically once CI passes on a future review cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add support for monthly and yearly scheduling intervals

1 participant