+
Skip to content

Update Indonesia holidays: 2031-2050 Day of Silence (Nyepi) data, migrate to BalineseSakaCalendarHolidays #2328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 6, 2025

Conversation

PPsyrius
Copy link
Collaborator

@PPsyrius PPsyrius commented Mar 5, 2025

Proposed change

  • Adds 2031-2050 Day of Silence (Nyepi) holidays data.
  • Migrate existing Nyepi holiday data to the new standalone _BalineseSakaLunar calendar and BalineseSakaCalendarHolidays holiday group to make it easier to extend support beyond 2050.

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

Copy link
Contributor

coderabbitai bot commented Mar 5, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced Indonesia holiday management by integrating a new calendar system for a more streamlined approach to the Day of Silence (Nyepi) holiday.
    • Expanded holiday schedules now include additional future dates for the Day of Silence.
  • Documentation

    • Updated holiday reference materials to reflect an extended coverage period.
  • Tests

    • Improved test coverage to ensure the accurate recognition of holiday dates over a broader range of years.

Walkthrough

This update modifies the Indonesian holiday management system by introducing support for the Balinese Saka calendar. It adds new entries for the "Day of Silence" holiday for years 2031 to 2050 and integrates a new base class for enhanced functionality. The changes also include updates to the test suite to ensure broader coverage for holiday recognition. Documentation has been improved to reflect these updates and provide additional cultural references.

Changes

Files Change Summary
holidays/countries/indonesia.py, snapshots/countries/ID_COMMON.json Added "Day of Silence" holiday entries with specific March dates for years 2031–2050 and updated class documentation with a reference link for the year range.
tests/countries/test_indonesia.py Extended test coverage by adding an assertion to confirm "Hari Suci Nyepi" is recognized as a holiday from 1983 to 2049.
holidays/calendars/__init__.py, holidays/calendars/balinese_saka.py, holidays/groups/__init__.py, holidays/groups/balinese_saka.py Introduced new classes and methods for the Balinese Saka calendar, including _BalineseSakaLunar and BalineseSakaCalendarHolidays, enhancing holiday management.
tests/test_holiday_groups.py Added a new test class TestBalineseSakaCalendarHolidays to validate the functionality of adding holidays to the Balinese Saka calendar.

Suggested reviewers

  • KJhellico

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a43dfb and 0b36efe.

📒 Files selected for processing (4)
  • holidays/calendars/__init__.py (1 hunks)
  • holidays/calendars/balinese_saka.py (1 hunks)
  • holidays/countries/indonesia.py (5 hunks)
  • holidays/groups/balinese_saka.py (1 hunks)
🔇 Additional comments (13)
holidays/calendars/__init__.py (1)

15-15: Clean import addition for Balinese Saka calendar support.

The addition of the _BalineseSakaLunar import enables the necessary functionality for Balinese Saka lunar calendar calculations in the calendar system.

holidays/calendars/balinese_saka.py (4)

1-29: Well-structured class documentation.

The file header and class docstring provide clear context about the Balinese Saka calendar, including its cultural significance and relation to the Moon phases and Gregorian year.


31-100: Comprehensive Nyepi date mappings.

The extensive dictionary mapping years to month/day pairs for Nyepi dates from 1983 to 2050 provides good coverage for the holiday calculations.


102-105: Efficient holiday date retrieval implementation.

The _get_holiday method provides a clean, generic approach to retrieve holiday dates from any mapping dictionary, with proper handling for missing dates.


106-112: Well-documented data sources.

The nyepi_date method includes clear references to the data sources for the years 1983-2025 and 2020-2050, which is helpful for verification and future maintenance.

holidays/groups/balinese_saka.py (3)

19-26: Clear class structure for calendar holidays.

The BalineseSakaCalendarHolidays class provides a clean abstraction for managing Balinese Saka lunar calendar holidays.


27-34: Robust holiday addition method with null handling.

The _add_balinese_saka_calendar_holiday method properly handles null dates, ensuring that the system behaves gracefully when date information is unavailable.


35-45: Well-documented Nyepi holiday implementation.

The _add_nyepi method includes comprehensive documentation explaining what Nyepi is - a Balinese "Day of Silence" commemorated every Saka new year according to the Balinese calendar.

holidays/countries/indonesia.py (5)

23-23: Clean integration of Balinese Saka calendar holidays.

The import of BalineseSakaCalendarHolidays enables the Indonesia class to properly handle Balinese Saka calendar-specific holidays.


36-36: Good inheritance structure update.

Adding BalineseSakaCalendarHolidays to the inheritance chain of the Indonesia class provides clean access to Balinese Saka calendar functionality.


49-49: Updated reference source documentation.

The docstring reference update for Indonesia years 1963-2025 ensures proper attribution of data sources.


66-66: Proper initialization of Balinese Saka calendar.

The initialization call to BalineseSakaCalendarHolidays.__init__(self) ensures the Balinese Saka calendar is properly set up for use.


152-153: Simplified Nyepi holiday implementation.

The code now uses the dedicated _add_nyepi method instead of direct date lookups, improving maintainability and leveraging the structured holiday system.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@PPsyrius
Copy link
Collaborator Author

PPsyrius commented Mar 5, 2025

@arkid15r I've noticed that codecov hasn't been running unless it reaches 100.00% coverage since #2173 was implemented, defeating its very purpose of identifying missing coverage cases.

Given that our existing sonarqubecloud tool also supports test coverage display, perhaps we should consider implementing it at some point to streamline our workflow. 🙏

@KJhellico
Copy link
Collaborator

I use make coverage in such cases.

@PPsyrius
Copy link
Collaborator Author

PPsyrius commented Mar 5, 2025

I use make coverage in such cases.

I'll keep in mind for future PRs 🙏

@PPsyrius PPsyrius changed the title Update Indonesia holidays: 2031-2050 Day of Silence (Nyepi) data Update Indonesia holidays: 2031-2050 Day of Silence (Nyepi) data, migrate to BalineseSakaCalendarHolidays Mar 6, 2025
@PPsyrius PPsyrius marked this pull request as ready for review March 6, 2025 04:27
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (93bb4af) to head (0b36efe).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2328   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          201       203    +2     
  Lines        12378     12402   +24     
  Branches      1777      1777           
=========================================
+ Hits         12378     12402   +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1728aa6 and 6a43dfb.

📒 Files selected for processing (1)
  • holidays/calendars/balinese_saka.py (1 hunks)
⏰ Context from checks skipped due to timeout of 300000ms (1)
  • GitHub Check: Test build on windows-latest
🔇 Additional comments (4)
holidays/calendars/balinese_saka.py (4)

1-11: Header and initial comments look good.

No issues observed here; the license header and explanatory comments are consistent.


13-14: Imports are correct.

The usage of datetime.date and typing.Optional for type annotations is appropriate.


94-99: Method functionality is clear.

The _get_holiday method effectively merges exact and fallback data. No immediate issues found; just ensure future developers understand the second returned value indicates estimated vs. exact.


100-101: Clear method naming.

nyepi_date wraps _get_holiday neatly. No problems spotted.

Copy link

sonarqubecloud bot commented Mar 6, 2025

Copy link
Collaborator

@KJhellico KJhellico left a comment

Choose a reason for hiding this comment

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

LGTM!

@arkid15r
Copy link
Collaborator

arkid15r commented Mar 6, 2025

@arkid15r I've noticed that codecov hasn't been running unless it reaches 100.00% coverage since #2173 was implemented, defeating its very purpose of identifying missing coverage cases.

Given that our existing sonarqubecloud tool also supports test coverage display, perhaps we should consider implementing it at some point to streamline our workflow. 🙏

I'll look into improving this, thanks for noticing!

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Thanks for restructuring that! LGTM

@arkid15r arkid15r added this pull request to the merge queue Mar 6, 2025
Merged via the queue into vacanza:dev with commit e2f0790 Mar 6, 2025
33 checks passed
@PPsyrius PPsyrius deleted the indonesia_nyepi_2050 branch March 7, 2025 03:40
@KJhellico KJhellico mentioned this pull request Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载