Skip to content

Refactor snapshots generator: ProcessPoolExecutor, UTF-8 support#3062

Merged
arkid15r merged 13 commits intovacanza:devfrom
PPsyrius:make_snapshot
Nov 17, 2025
Merged

Refactor snapshots generator: ProcessPoolExecutor, UTF-8 support#3062
arkid15r merged 13 commits intovacanza:devfrom
PPsyrius:make_snapshot

Conversation

@PPsyrius
Copy link
Copy Markdown
Collaborator

@PPsyrius PPsyrius commented Nov 14, 2025

Proposed change

  • Add UTF-8 support for snapshot files.
  • Uses ProcessPoolExecutor to speed up snapshot generation by running each country_subdiv, country_common, or market snapshot each as its own process.

Pre-Optimised

[TIMER] Total snapshot runtime: 57.84 seconds
[TIMER] Total snapshot runtime: 59.28 seconds
[TIMER] Total snapshot runtime: 59.47 seconds
Old Average = 58.97 seconds (approximately)

With ProcessPoolExecutor Refactor

[TIMER] Total snapshot runtime: 13.30 seconds
[TIMER] Total snapshot runtime: 13.06 seconds
[TIMER] Total snapshot runtime: 13.15 seconds
New Average = 13.17 seconds (approximately)

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 14, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Improved snapshot generation with parallel processing for faster performance
    • Added runtime reporting for snapshot generation operations
  • Bug Fixes

    • Corrected holiday names and historical figure names with proper spelling and diacritics across multiple country snapshots
  • Chores

    • Updated configuration for snapshot generation tooling

Walkthrough

Adds ProcessPoolExecutor-based parallel snapshot generation and timing to the snapshot script, updates JSON I/O signatures/encoding and CLI parsing, adds a pyproject per-file-ignore, and applies widespread diacritic/capitalization normalizations across many Argentina snapshots and one Andorra snapshot.

Changes

Cohort / File(s) Summary
Build configuration
pyproject.toml
Added a per-file-ignores entry for scripts/generate_snapshots.py (T201).
Snapshot generation script
scripts/generate_snapshots.py
Switched to ProcessPoolExecutor with new worker functions (_country_subdiv_snapshot_worker, _financial_snapshot_worker), added perf_counter total runtime printing, updated holiday accessors imports, changed CLI to mutually exclusive country/market options, and updated signatures: prepare_snapshot_directory(Path) -> None and save(dict, Path) -> None (UTF‑8/ensure_ascii handling, trailing newline).
Andorra snapshot
snapshots/countries/AD_06.json
Fixed diacritics and normalized holiday name strings (e.g., "Virgin Mary of Canòlich").
Argentina snapshots (bulk normalization)
snapshots/countries/AR_*.json
snapshots/countries/AR_A.json, .../AR_B.json, .../AR_C.json, .../AR_COMMON.json, .../AR_D.json, .../AR_E.json, .../AR_F.json, .../AR_G.json, .../AR_H.json, .../AR_J.json, .../AR_K.json, .../AR_L.json, .../AR_M.json, .../AR_N.json, .../AR_P.json, .../AR_Q.json
Large-scale textual normalization only: standardized capitalization and diacritics for personal names across many date entries (notably variants of "José de San Martín" and "Martín Miguel de Güemes"). No structural or control-flow changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review focus:
    • scripts/generate_snapshots.py: ensure worker callables and arguments are picklable, correct ProcessPoolExecutor lifecycle and error propagation, and safe concurrent file operations.
    • save / prepare_snapshot_directory: confirm Path typing, JSON encoding options (ensure_ascii=False, UTF‑8), newline/trailing newline behavior.
    • Spot-check representative snapshots/countries/AR_*.json and snapshots/countries/AD_06.json for unintended key changes or encoding artifacts.

Possibly related PRs

Suggested reviewers

  • arkid15r
  • KJhellico

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: ProcessPoolExecutor refactor and UTF-8 support for snapshot generation.
Description check ✅ Passed The description is directly related to the changeset, explaining the UTF-8 support and ProcessPoolExecutor optimization with concrete performance metrics.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4389aa6 and 37ae0b9.

📒 Files selected for processing (1)
  • scripts/generate_snapshots.py (3 hunks)
🧰 Additional context used
🧠 Learnings (50)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-08-03T12:59:53.286Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2635
File: README.md:108-110
Timestamp: 2025-08-03T12:59:53.286Z
Learning: Always verify country counts in the COUNTRIES dictionary by checking the current count in the COUNTRIES dictionary in holidays/registry.py directly, rather than relying on information from previous PRs, as the count changes frequently with new country additions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: In the vacanza/holidays project, ruff configuration allows longer docstring lines than the typical 100-character limit, so docstring reference lines that exceed standard line length limits are acceptable and won't be flagged by ruff format during pre-commit checks.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, coding standards and line length limits should follow what is allowed by the ruff linter configuration used in the pre-commit checks, not arbitrary 100-character limits.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-04T11:06:21.179Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T18:24:26.712Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2600
File: holidays/countries/philippines.py:56-56
Timestamp: 2025-06-05T18:24:26.712Z
Learning: In the holidays repository, if code passes `make pre-commit` checks, then it's allowed regardless of individual static analysis tool warnings like Pylint line length violations. The pre-commit hooks are the definitive source of truth for their coding standards.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T18:25:25.165Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:25-30
Timestamp: 2025-06-24T18:25:25.165Z
Learning: In the holidays project, reference URLs in docstrings/comments that exceed 100 characters are acceptable if they pass the pre-commit tests, even if Pylint flags them as line length violations.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:32.644Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bosnia_and_herzegovina.py:22-23
Timestamp: 2025-11-08T04:57:32.644Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files (e.g., tests/countries/test_*.py) intentionally do not include return type annotations like `-> None`. The signature should remain as `def setUpClass(cls):` without explicit return type hints, consistent with the project's test conventions and similar to the pattern for `__init__` and `_populate` methods in the main codebase.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:36:32.788Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.788Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-08-24T11:55:06.810Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: README.md:108-108
Timestamp: 2025-08-24T11:55:06.810Z
Learning: The actual count of countries in the holidays library should always be verified by counting entries in the COUNTRIES dictionary in holidays/registry.py using `grep -E '^\s*"[a-z_]+"\s*:' holidays/registry.py | wc -l`, rather than making assumptions about incremental changes.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-17T05:45:27.730Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3062
File: scripts/generate_snapshots.py:69-80
Timestamp: 2025-11-17T05:45:27.730Z
Learning: The vacanza/holidays project requires Python 3.10+ as of November 2025 (specified in pyproject.toml as "requires-python = ">=3.10""). Python 3.9 support has been deprecated.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-08-24T13:01:51.370Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2852
File: tests/countries/test_tajikistan.py:26-28
Timestamp: 2025-08-24T13:01:51.370Z
Learning: In the holidays project country test files, the standard method name for testing country aliases (ISO codes) is `test_country_aliases`, not `test_aliases`. This naming convention is consistently used across all country test files.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-08-24T13:01:51.370Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2852
File: tests/countries/test_tajikistan.py:26-28
Timestamp: 2025-08-24T13:01:51.370Z
Learning: In the holidays project country test files, the universally adopted standard method name for testing country aliases (ISO codes) is `test_country_aliases`. This naming convention is used consistently across all 235+ country test files in the repository, with no exceptions using `test_aliases`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-08-09T18:31:23.218Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2778
File: tests/countries/test_kiribati.py:15-15
Timestamp: 2025-08-09T18:31:23.218Z
Learning: In the holidays project test files, the standard import pattern is `from holidays.countries.<country> import Country, CODE1, CODE2` (used in ~97% of test files), not `from holidays.countries import Country, CODE1, CODE2`. Only a few exceptions (Suriname, Sierra Leone, Mauritius, Mali, Ivory Coast, Guyana) use the aggregated import pattern.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-08-20T19:46:15.625Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2833
File: tests/countries/test_uganda.py:15-0
Timestamp: 2025-08-20T19:46:15.625Z
Learning: In the holidays project, the standard import pattern for country test files is `from holidays.countries.<country> import Country, CODE1, CODE2` (direct module import), used by ~75% of country test files. Only a minority (~25%) use the aggregated public API import `from holidays.countries import Country, CODE1, CODE2`. The direct module import pattern should be used for new country test files to follow the established convention.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-03-13T07:50:10.598Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-14T20:13:29.536Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2614
File: README.md:108-108
Timestamp: 2025-06-14T20:13:29.536Z
Learning: In the vacanza/holidays repository, the team prefers to manually update the country count in README.md when adding new countries, with tests in place to verify the count stays accurate. They are satisfied with this approach and do not want it automated.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-17T11:07:04.986Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2720
File: README.md:108-110
Timestamp: 2025-07-17T11:07:04.986Z
Learning: Always verify country counts in the holidays library by checking the current count in the COUNTRIES dictionary in holidays/registry.py directly, rather than relying on information from previous PRs, as the count changes frequently with new country additions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-15T15:00:32.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2687
File: README.md:108-108
Timestamp: 2025-07-15T15:00:32.728Z
Learning: When verifying country counts in the holidays library, always check the current count in the COUNTRIES dictionary in holidays/registry.py rather than relying on previously recorded counts, as new countries may have been added in merged PRs.

Applied to files:

  • scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
  • country_holidays (31-227)
  • financial_holidays (230-312)
  • list_supported_countries (410-421)
  • list_supported_financial (425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py

121-121: Avoid specifying long messages outside the exception class

(TRY003)


145-145: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build distribution
  • GitHub Check: Test docs build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (aa817b4) to head (e47e0b1).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #3062   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          306       306           
  Lines        18015     18015           
  Branches      2285      2285           
=========================================
  Hits         18015     18015           

☔ 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
Copy Markdown
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: 4

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a5effb and d02629f.

📒 Files selected for processing (19)
  • pyproject.toml (1 hunks)
  • scripts/generate_snapshots.py (3 hunks)
  • snapshots/countries/AD_06.json (101 hunks)
  • snapshots/countries/AR_A.json (93 hunks)
  • snapshots/countries/AR_B.json (94 hunks)
  • snapshots/countries/AR_C.json (94 hunks)
  • snapshots/countries/AR_COMMON.json (94 hunks)
  • snapshots/countries/AR_D.json (94 hunks)
  • snapshots/countries/AR_E.json (94 hunks)
  • snapshots/countries/AR_F.json (94 hunks)
  • snapshots/countries/AR_G.json (94 hunks)
  • snapshots/countries/AR_H.json (94 hunks)
  • snapshots/countries/AR_J.json (94 hunks)
  • snapshots/countries/AR_K.json (93 hunks)
  • snapshots/countries/AR_L.json (94 hunks)
  • snapshots/countries/AR_M.json (94 hunks)
  • snapshots/countries/AR_N.json (94 hunks)
  • snapshots/countries/AR_P.json (94 hunks)
  • snapshots/countries/AR_Q.json (94 hunks)
🧰 Additional context used
🧠 Learnings (29)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.762Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/locale/en_US/LC_MESSAGES/VC.po:76-76
Timestamp: 2025-06-10T05:08:07.939Z
Learning: For the holidays project, localization file formatting issues (like missing terminal periods in .po files) should be automatically fixed by running `make l10n` command (which is included in `make check`). Authors should be directed to use this automated tooling instead of manual formatting fixes.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
📚 Learning: 2025-11-08T04:56:18.061Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:228-229
Timestamp: 2025-11-08T04:56:18.061Z
Learning: Argentina: Good Friday ("Viernes Santo") is established from 1977 by Law 21329. In tests/countries/test_argentina.py, assert presence for range(1977, self.end_year) and absence for range(self.start_year, 1977); do not assert over self.full_range.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AD_06.json
  • snapshots/countries/AR_M.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-08-12T03:21:09.116Z
Learnt from: mbfarah
Repo: vacanza/holidays PR: 2798
File: holidays/countries/chile.py:278-281
Timestamp: 2025-08-12T03:21:09.116Z
Learning: In Chile holidays implementation, the general rule for September 17 (years >= 2007) uses MON_ONLY for years 2007-2016, meaning it only adds the holiday when September 17 falls on a Monday. For years when September 17 falls on other days and was declared a one-off holiday by specific laws, it must be added to the special_public_holidays dictionary.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AD_06.json
  • snapshots/countries/AR_M.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-09-03T17:08:59.893Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:765-766
Timestamp: 2025-09-03T17:08:59.893Z
Learning: The Anniversary of the Battle of Tucumán holiday in Argentina's Tucumán province (subdiv="T") has been in effect since at least 1946 according to official government documentation, which predates AR.start_year (1957). Therefore, using self.full_range for this holiday test is correct.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AR_M.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-09-20T15:37:21.301Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_colombia.py:45-61
Timestamp: 2025-09-20T15:37:21.301Z
Learning: In Colombia's holiday system, movable observed holidays were only introduced from 1984 onwards. Before this date, holidays that later became movable (like Saint Joseph's Day) existed as regular holidays from their introduction year, but had no observed variant system. The years_non_observed parameter in Colombia tests reflects this 1984 start date for the observed holiday system.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AR_M.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-08-12T03:21:09.116Z
Learnt from: mbfarah
Repo: vacanza/holidays PR: 2798
File: holidays/countries/chile.py:278-281
Timestamp: 2025-08-12T03:21:09.116Z
Learning: September 17, 2010 and September 20, 2010 were both one-off holidays in Chile established by Law 20.450, separate from the general September 17 observance rule that only applies to Mondays.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AR_M.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-03-19T16:53:00.375Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:185-188
Timestamp: 2025-03-19T16:53:00.375Z
Learning: In the Fiji holidays implementation, the `special_public_holidays_observed` dictionary in `FijiStaticHolidays` is only used for exceptions to the normal observance rules, not for documenting all holidays. Only 2019's Constitution Day needed a special entry as it didn't follow the standard patterns.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AD_06.json
  • snapshots/countries/AR_M.json
📚 Learning: 2025-09-17T15:16:16.192Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2944
File: holidays/countries/myanmar.py:183-191
Timestamp: 2025-09-17T15:16:16.192Z
Learning: The special_public_holidays formatting pattern in the holidays codebase follows a consistent convention: single entries per year use flat tuple format like `2024: (MONTH, DAY, name)`, while multiple entries per year use tuple-of-tuples format like `2024: ((MONTH, DAY, name), (MONTH, DAY, name))`. This pattern is used consistently across all countries.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_D.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_A.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AD_06.json
  • snapshots/countries/AR_M.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.205Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.

Applied to files:

  • snapshots/countries/AR_H.json
  • snapshots/countries/AR_COMMON.json
  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_P.json
  • snapshots/countries/AR_Q.json
  • snapshots/countries/AR_C.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_G.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AR_B.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-09-03T17:10:35.672Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/locale/fr/LC_MESSAGES/DZ.po:37-41
Timestamp: 2025-09-03T17:10:35.672Z
Learning: In Algerian French localization (holidays/locale/fr/LC_MESSAGES/DZ.po), capitalization should follow Algerian source-accurate conventions rather than standard French orthographic rules. For example, "Jour de l'An Grégorien" with capital "G" is correct for Algerian usage, even though standard French would typically use lowercase "grégorien".

Applied to files:

  • snapshots/countries/AR_L.json
  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AD_06.json
📚 Learning: 2025-09-26T13:58:49.363Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2960
File: holidays/locale/ca/LC_MESSAGES/ES.po:148-151
Timestamp: 2025-09-26T13:58:49.363Z
Learning: In the holidays project, when translating holiday names in .po files, the msgstr should be a faithful translation of the original msgid (in the country's default language), not influenced by English commentary or common en_US names. For example, "Día de la Pascua Granada" (Spanish) correctly translates to "Dia de la Pasqua Granada" (Catalan), even though the English comment refers to it as "Whit Monday".

Applied to files:

  • snapshots/countries/AR_E.json
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_K.json
  • snapshots/countries/AD_06.json
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.

Applied to files:

  • snapshots/countries/AR_E.json
  • pyproject.toml
  • snapshots/countries/AR_J.json
  • snapshots/countries/AR_N.json
  • snapshots/countries/AD_06.json
📚 Learning: 2025-09-14T06:39:08.485Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/south_africa.py:163-170
Timestamp: 2025-09-14T06:39:08.485Z
Learning: In South Africa's holidays implementation (holidays/countries/south_africa.py), the 2021 election uses the literal "Municipal elections" instead of the local_elections constant ("Local Government Elections") - this inconsistency is intentional and should not be flagged as an issue.

Applied to files:

  • snapshots/countries/AR_E.json
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.

Applied to files:

  • pyproject.toml
  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).

Applied to files:

  • pyproject.toml
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.

Applied to files:

  • pyproject.toml
📚 Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.

Applied to files:

  • snapshots/countries/AR_K.json
  • snapshots/countries/AD_06.json
  • snapshots/countries/AR_F.json
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.

Applied to files:

  • snapshots/countries/AR_N.json
  • scripts/generate_snapshots.py
  • snapshots/countries/AD_06.json
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-26T13:55:16.266Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2960
File: holidays/locale/ca/LC_MESSAGES/ES.po:116-119
Timestamp: 2025-09-26T13:55:16.266Z
Learning: When reviewing religious holiday names in the holidays library, proper nouns referring to specific churches, sanctuaries, or locations should be preserved rather than converted to generic equivalents. For example, "Santa Maria of Africa" refers to the specific Sanctuary of Saint Mary of Africa in Ceuta and should remain as the proper name rather than being changed to "Our Lady of Africa."

Applied to files:

  • snapshots/countries/AD_06.json
📚 Learning: 2025-06-18T10:18:59.447Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:178-182
Timestamp: 2025-06-18T10:18:59.447Z
Learning: In the France holidays implementation, deprecated subdivision names like "Alsace-Moselle" and "Saint-Barthélémy" are handled through explicit conditionals in _populate_public_holidays() that map them to their corresponding new subdivision-specific holiday population methods, providing backward compatibility while users transition to the new ISO codes.

Applied to files:

  • snapshots/countries/AD_06.json
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.

Applied to files:

  • snapshots/countries/AD_06.json
📚 Learning: 2025-06-18T10:26:50.180Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:178-180
Timestamp: 2025-06-18T10:26:50.180Z
Learning: In the France holidays implementation, the _populate_subdiv_57_public_holidays() (Moselle) and _populate_subdiv_6ae_public_holidays() (Alsace) methods are functionally identical, both adding Good Friday (≥1893) and Saint Stephen's Day (≥1892) with the same legal references from August 16th, 1892. Therefore, for the deprecated "Alsace-Moselle" subdivision, calling either method produces the same result.

Applied to files:

  • snapshots/countries/AD_06.json
📚 Learning: 2025-06-28T10:39:19.185Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2684
File: holidays/locale/it/LC_MESSAGES/SM.po:13-13
Timestamp: 2025-06-28T10:39:19.185Z
Learning: In the holidays project, .po file header comments use the format "# [Country] holidays." for default language files (without trailing hash) and "# [Country] holidays [locale] localization." for non-default language files (also without trailing hash).

Applied to files:

  • snapshots/countries/AD_06.json
📚 Learning: 2025-08-08T10:33:55.695Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2763
File: README.md:108-110
Timestamp: 2025-08-08T10:33:55.695Z
Learning: When verifying the country total in holidays/registry.py, isolate between '^COUNTRIES:' and '^FINANCIAL:' and count only lines matching the strict key pattern '^\s*"[a-z0-9_ ]+":\s*\(' to avoid overcounting non-entry quoted lines. As of PR vacanza/holidays#2763, this yields 227 entries.

Applied to files:

  • snapshots/countries/AD_06.json
📚 Learning: 2025-07-10T03:36:16.461Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2706
File: holidays/countries/cayman_islands.py:80-97
Timestamp: 2025-07-10T03:36:16.461Z
Learning: In the holidays library, date dictionaries that map years to specific dates (like queens_birthday_dates, spring_bank_dates, thanksgiving_day_dates, etc.) are typically defined within the _populate_public_holidays method rather than as module-level constants. This is the established library-wide pattern seen across multiple country implementations including United Kingdom, United States, Sri Lanka, and others.

Applied to files:

  • snapshots/countries/AD_06.json
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
  • country_holidays (31-227)
  • financial_holidays (230-312)
  • list_supported_countries (410-421)
  • list_supported_financial (425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py

26-26: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)


119-119: Avoid specifying long messages outside the exception class

(TRY003)


128-128: Consider iterable unpacking instead of concatenation

Replace with iterable unpacking

(RUF005)


141-141: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test docs build
  • GitHub Check: Build distribution
🔇 Additional comments (30)
snapshots/countries/AR_P.json (1)

12-12: Generated snapshot sanity: encoding + naming pass; please confirm provenance.

Edits are consistent with UTF‑8 and canonical forms. Confirm AR_P.json was produced via the refactored make snapshot. If yes, all good.

Re‑run the verification script shared in AR_J to:

  • Validate UTF‑8 across snapshots,
  • Flag any remaining non‑canonical name variants,
  • Assert deterministic dump behavior.

Also applies to: 978-986, 1207-1215, 1240-1247, 1708-1713, 1995-2000

snapshots/countries/AR_K.json (2)

2000-2000: Minor: guard against nondeterministic write order.

If not already in the generator, dump with sort_keys=True and fixed separators to avoid churn under ProcessPoolExecutor.

⛔ Skipped due to learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:266-284
Timestamp: 2025-04-13T20:41:56.613Z
Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2465
File: holidays/countries/suriname.py:219-251
Timestamp: 2025-04-13T19:10:31.502Z
Learning: The `_CustomIslamicHolidays` classes in this project contain only exact verified holiday dates from reliable sources, rather than calculated or estimated future dates. This is by design to ensure accuracy, particularly for religious holidays that may follow lunar calendars or depend on local observations.

12-12: Verification complete—canonicalization and UTF-8 handling confirmed.

Confirmed:

  • Line 12 and sampled entries (531, 1036, 1214, 1461, 2153) all display proper UTF-8 (no escaped sequences like \u00e9)
  • No stale escape variants remain in AR_K.json
  • File structure and encoding valid
  • Standardized names ("General Don José de San Martín", etc.) applied consistently
snapshots/countries/AR_J.json (2)

2010-2010: Review comment is already addressed in the codebase.

The generator script (scripts/generate_snapshots.py, lines 64-74) already implements proper UTF-8 handling with unescaped characters:

  • Uses encoding="utf-8" in write_text()
  • Uses ensure_ascii=False in json.dumps()

The AR_J.json output confirms diacritics like "Güemes" and "José" are preserved unescaped. The current implementation (using Path.write_text() + json.dumps()) is functionally equivalent to the suggested approach and correctly maintains UTF-8 with unescaped non-ASCII characters.


12-12: AR_J.json is confirmed as a generated artifact—all validation checks passed.

Verification confirms:

  • File produced by make snapshotscripts/generate_snapshots.py
  • UTF-8 encoding valid across all snapshots ✓
  • Canonical name forms enforced; no variants leaked ✓
  • Deterministic output (sorted keys, stable formatting) ✓
  • Recent commits confirm UTF-8 refactor applied ✓

No hand-edits detected. Safe to merge.

snapshots/countries/AR_COMMON.json (2)

318-324: Good Friday boundary looks correct.

Good Friday appears starting in 1977. That matches project guidance; ensure tests continue asserting presence from 1977 onward only. Based on learnings.


12-12: All verification checks passed.

The AR snapshots are clean: no unaccented variants, valid UTF-8 across all files, and proper JSON structure with string values. The normalization is correct as shown in the provided snippet.

snapshots/countries/AR_N.json (1)

12-12: Consistent diacritics; keep snapshots generator-owned.

Spelling/diacritic normalization is consistent. Confirm this file was regenerated by the new snapshot tool (not hand-edited) and encoded UTF‑8.

Use the same script shared in AR_COMMON to validate across all AR_* files.

Also applies to: 978-985

snapshots/countries/AR_Q.json (1)

12-12: LGTM on name normalization; please confirm deterministic writer settings.

With ProcessPoolExecutor, ensure the writer uses ensure_ascii=False and sorted keys to keep stable diffs across runs.

If helpful, I can add a quick check in the generator to enforce sorted keys on save.

Also applies to: 978-985

pyproject.toml (1)

72-72: T201 ignore for generator is appropriate; code already follows all best practices.

Verification confirms the generator already implements:

  • ensure_ascii=False in json.dumps() (line 76)
  • encoding="utf-8" in write_text() (line 80)
  • if __name__ == "__main__": guard (line 157)
  • Centralized I/O through the save() method called by both worker functions

The code is well-structured and safe for parallel snapshot generation. The T201 ignore is justified.

snapshots/countries/AR_H.json (1)

12-2009: Diacritics and normalization verified; confirm snapshot reproducibility locally.

Good news: diacritics (José, Güemes) are preserved and properly NFC-normalized. However, sandbox limitations prevent us from running the snapshot generator. Please verify in your local environment that regenerating these snapshots produces no diffs—this confirms they're reproducible and match your tooling's output.

snapshots/countries/AR_M.json (1)

12-2083: All verifications passed; content is sound.

No ASCII fallbacks — San Martín and Güemes correctly use diacritics throughout
NFC normalization — All AR_*.json files in canonical form
Reproducible — Git diff shows no changes after regeneration attempt (file stable)

The snapshot changes span 1957–2050 with consistent holiday data and proper Unicode normalization. No issues detected.

snapshots/countries/AR_L.json (1)

12-2009: Diacritics verified; snapshot reproducible.

All checks passed:

  • ✓ UTF‑8 diacritics preserved (José, Güemes, Belgrano preserved; no ASCII fallbacks)
  • ✓ NFC normalization verified across AR_*.json
  • ✓ File reproducible (MD5 hash stable before/after regeneration: 3b48e9d5f8bf2c5cc4ce9b67599da641)

The snapshot changes are data‑only, encoding‑safe, and consistent.

snapshots/countries/AR_D.json (2)

12-12: Standardization verified — "José de San Martín" consistently applied across all 94 occurrences.

No ASCII fallbacks detected. The canonical accented form is uniformly used throughout snapshots/countries/AR_D.json, including all cited line ranges.


1003-1004: Diacritics verified across all instances—no issues found.

All 36 occurrences of "Martín Miguel de Güemes" correctly preserve the ü diacritic with no fallback spellings detected. Formatting is consistent across the date range (2016–2050).

snapshots/countries/AR_E.json (2)

12-12: Verification confirms consistent "San Martín" normalization with no fallbacks detected.

All checks passed: JSON valid, 94 canonical entries, zero unaccented variants, separators preserved across multi-holiday dates. No action required.


1043-1044: Accents verified as correct and consistent.

Script output confirms 35 occurrences of the correct "Martín Miguel de Güemes" spelling, zero fallback variants without accents, and consistent non-ASCII handling across the file. No issues found.

snapshots/countries/AD_06.json (2)

11-15: UTF-8 diacritics verified across entire file.

Verification confirms all technical checks pass:

  • JSON valid
  • No duplicate keys
  • Diacritics ("Canòlich", "Sant Julià de Lòria") consistently present across 1950–2050 range
  • No ASCII fallbacks detected

Changes read as systematic and generated (consistent pattern repeats across all years). No issues found.


1597-1600: File encoding verified as correct.

The file already uses raw UTF-8 encoding with no Unicode escape sequences. All mentioned line ranges (1597–1600, 1618–1621, 1641–1644, 1663–1666, 1684–1688) contain accented characters in raw form (e.g., "Canòlich", "Julià", "Lòria"). The generator correctly used ensure_ascii=False, preserving readability as intended.

snapshots/countries/AR_G.json (2)

12-12: San Martín diacritics normalized — LGTM.

String canonicalization to “Pass to the Immortality of General Don José de San Martín” is consistent and UTF‑8 clean across the file.

Please confirm these lines were snapshot-generated via the new ProcessPoolExecutor path, not hand-edited. Based on learnings.

Also applies to: 804-804, 1015-1015, 1214-1214, 1464-1464, 1890-1890


978-978: Güemes name: correct “ü” and full title.

Spelling/diacritics for “Don Martín Miguel de Güemes” look correct; chronology intact.

Confirm these entries stem from the generator with UTF‑8 writes (ensure_ascii=False, encoding='utf-8'). Based on learnings.

Also applies to: 1996-1996

snapshots/countries/AR_A.json (2)

12-12: San Martín string normalization — consistent and correct.

Canonical form and diacritics are uniform; good improvement for l10n/UTF‑8.

Also applies to: 832-832, 1104-1105, 1442-1442, 1645-1646, 2031-2032


1163-1164: Duplicate Güemes entries on same date — confirm intent.

Seeing both “Day of Memory of … Güemes” (provincial) and “Pass to the Immortality … Güemes” (national) on the same day. Looks intentional for Salta; please confirm this is the desired composite snapshot output from the generator.

This should come solely from generator logic; snapshots should not be manually edited. Based on learnings.

Also applies to: 1199-1200, 1234-1235, 1458-1460, 1496-1498, 1530-1533

snapshots/countries/AR_C.json (2)

324-324: Consistent San Martín normalization — looks good.

UTF‑8 diacritics and wording are standardized across years; ordering preserved.

Also applies to: 736-737, 1015-1016, 1246-1247, 1395-1396, 1712-1713


1010-1011: Güemes entries: diacritics and titles OK.

Names render correctly (“Martín”, “Güemes”); no JSON structure drift observed.

Also applies to: 1240-1241, 1418-1419

snapshots/countries/AR_B.json (1)

12-1996: Consistent name normalization in AR_B snapshot

The updated entries for San Martín and Martín Miguel de Güemes look uniformly formatted and keep the JSON structure intact; for an auto‑generated snapshot this is fine as‑is.

snapshots/countries/AR_F.json (1)

12-2220: Snapshot text cleanup for La Rioja looks good

Name/diacritic normalization for San Martín, Martín Miguel de Güemes, and Ángel Vicente Peñaloza is consistent and leaves the JSON schema untouched; fine for regenerated snapshots.

scripts/generate_snapshots.py (3)

71-81: UTF‑8 JSON output matches the PR’s intent

Writing snapshots via write_text(..., ensure_ascii=False, encoding="utf-8") with a trailing newline gives proper UTF‑8 files and stays friendly to pre‑commit. This aligns neatly with the UTF‑8 support objective.


147-149: Financial snapshot parallelization looks straightforward

The market work items and their handling in ProcessPoolExecutor are simple and match the country side; passing years and snapshot_path is all that’s needed. Nice, minimal parallelization.


159-162: Runtime timer is handy for tracking the speedup

Using perf_counter() around SnapshotGenerator().run() and printing a single summary line gives a cheap sanity check on performance and matches the timings in the PR description. No changes needed here.

Copy link
Copy Markdown
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: 1

♻️ Duplicate comments (1)
scripts/generate_snapshots.py (1)

26-31: Clean up the unused noqa directive.

The # noqa: E402 comment on the import is flagged by Ruff as unused (RUF100). You can drop it.

Based on past review feedback.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d02629f and d1dfa9a.

📒 Files selected for processing (1)
  • scripts/generate_snapshots.py (3 hunks)
🧰 Additional context used
🧠 Learnings (27)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.257Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.257Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.295Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.295Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.141Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.141Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.

Applied to files:

  • scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
  • country_holidays (31-227)
  • financial_holidays (230-312)
  • list_supported_countries (410-421)
  • list_supported_financial (425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py

117-117: Avoid specifying long messages outside the exception class

(TRY003)


141-141: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build distribution
  • GitHub Check: Test docs build
🔇 Additional comments (8)
scripts/generate_snapshots.py (8)

41-59: Nice fix—mutual exclusivity now enforced at parse time.

This directly addresses the prior concern about --country and --market silently doing nothing when both are supplied. Clean solution.


63-67: LGTM!

Type annotations are clear, logic is correct.


70-80: UTF-8 support looks solid.

ensure_ascii=False + explicit encoding="utf-8" + trailing newline for pre-commit. Well done.


82-96: Worker implementation is correct for ProcessPoolExecutor.

The parent instantiates country_holidays (line 125) to gather metadata (subdivisions, categories), and the worker instantiates it again to generate the actual snapshot. This is unavoidable—workers run in separate processes and can't share pickled HolidayBase objects. The current design is optimal.


97-107: LGTM!

Clean worker implementation for financial snapshots.


123-131: Parallel execution and unpacking look great.

The iterable unpacking (None, *country.subdivisions) fixes the RUF005 concern from prior reviews, and the ProcessPoolExecutor implementation is clean. The type annotation on work_items adds clarity.


147-151: LGTM!

Financial snapshot generation follows the same clean pattern as country snapshots.


161-164: Good instrumentation.

The timing printout aligns with the PR's performance objectives (13s vs 59s). Clean implementation.

Copy link
Copy Markdown
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.

Great acceleration! 🚀

Co-authored-by: ~Jhellico <[email protected]>
@PPsyrius PPsyrius requested a review from KJhellico November 15, 2025 03:36
Copy link
Copy Markdown
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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1dfa9a and 32c1c85.

📒 Files selected for processing (1)
  • scripts/generate_snapshots.py (3 hunks)
🧰 Additional context used
🧠 Learnings (27)
📓 Common learnings
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (2)
holidays/holiday_base.py (1)
  • append (940-951)
holidays/utils.py (4)
  • country_holidays (31-227)
  • financial_holidays (230-312)
  • list_supported_countries (410-421)
  • list_supported_financial (425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py

117-117: Avoid specifying long messages outside the exception class

(TRY003)


141-141: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Test build on windows-latest
  • GitHub Check: Test build on macos-latest
  • GitHub Check: Test build on ubuntu-latest
  • GitHub Check: Test docs build
🔇 Additional comments (8)
scripts/generate_snapshots.py (8)

21-31: ProcessPool and holidays helper imports fit the new design

Bringing in ProcessPoolExecutor, perf_counter, and the country_holidays / financial_holidays / list_supported_* helpers is a clean way to align this script with the core APIs for parallel snapshot generation. No concerns here.


41-59: Mutually exclusive --country / --market flags fix the earlier no-op trap

Using an argparse mutually exclusive group for the entity selectors matches the run flow and prevents the previous “both flags → no snapshots” behavior, while still allowing repeated --country/--market via action="extend". The CLI surface looks solid.


63-67: Directory prep logic is safe for full regenerations

shutil.rmtree(..., ignore_errors=True) followed by mkdir(parents=True, exist_ok=True) gives a clean slate for full runs and is tolerant of missing directories, which is exactly what you want for auto-generated snapshots.


69-80: UTF‑8 JSON output with normalized newlines is on point

save() now writes UTF‑8 JSON with ensure_ascii=False, sorted date keys, and a final newline using newline="\n", which should keep snapshot contents stable across platforms and happy with the pre-commit EOF fixer. Just ensure your minimum Python version includes the newline parameter on Path.write_text, but for modern versions this is fine. Based on learnings.


82-107: Worker functions are nicely stateless and en_US-aware

Both workers take simple tuples, reconstruct their holiday objects in the child process, force language="en_US", and (for countries) honor supported_categories before delegating to save(). That keeps the ProcessPool usage straightforward and avoids write races by mapping one work item to one file. Based on learnings.


109-131: Country snapshot scheduling via work_items + ProcessPool looks correct

Country selection, unknown-country validation, conditional directory cleanup for “all countries” runs, and building work_items over (None, *country.subdivisions) with supported_categories and a shared years range all line up. The ProcessPool executor over that list should parallelize cleanly while keeping each snapshot confined to its own file under snapshots/countries.


133-151: Financial snapshot flow mirrors the country path cleanly

The financial branch follows the same pattern—supported list lookup, unknown-market guard, optional full-dir reset, then a simple (market_code, years, snapshot_path) work_items list mapped through the financial worker. The symmetry with the country flow makes this easy to reason about and maintain.


161-164: Timing wrapper provides useful feedback without touching core logic

Wrapping SnapshotGenerator().run() with perf_counter() and printing a single summary line at the end gives a clear runtime signal for local and CI runs, and the script guard keeps this from affecting library users.

@KJhellico KJhellico changed the title Refactor make snapshot: ProcessPoolExecutor, UTF-8 support Refactor snapshots generator: ProcessPoolExecutor, UTF-8 support Nov 16, 2025
Copy link
Copy Markdown
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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc8a93b and a1bc26b.

📒 Files selected for processing (1)
  • scripts/generate_snapshots.py (3 hunks)
🧰 Additional context used
🧠 Learnings (35)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: In the vacanza/holidays project, ruff configuration allows longer docstring lines than the typical 100-character limit, so docstring reference lines that exceed standard line length limits are acceptable and won't be flagged by ruff format during pre-commit checks.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, coding standards and line length limits should follow what is allowed by the ruff linter configuration used in the pre-commit checks, not arbitrary 100-character limits.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-04T11:06:21.179Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T18:24:26.712Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2600
File: holidays/countries/philippines.py:56-56
Timestamp: 2025-06-05T18:24:26.712Z
Learning: In the holidays repository, if code passes `make pre-commit` checks, then it's allowed regardless of individual static analysis tool warnings like Pylint line length violations. The pre-commit hooks are the definitive source of truth for their coding standards.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T18:25:25.165Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:25-30
Timestamp: 2025-06-24T18:25:25.165Z
Learning: In the holidays project, reference URLs in docstrings/comments that exceed 100 characters are acceptable if they pass the pre-commit tests, even if Pylint flags them as line length violations.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.

Applied to files:

  • scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
  • country_holidays (31-227)
  • financial_holidays (230-312)
  • list_supported_countries (410-421)
  • list_supported_financial (425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py

117-117: Avoid specifying long messages outside the exception class

(TRY003)


141-141: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test Python 3.11 on windows-latest
🔇 Additional comments (5)
scripts/generate_snapshots.py (5)

41-59: Mutually exclusive group properly enforces country/market separation.

This cleanly resolves the earlier concern about supplying both --country and --market resulting in silent no-op. Argparse will now reject conflicting flags upfront with a clear error.


68-80: UTF-8 support properly implemented.

The encoding="utf-8", newline="\n", and ensure_ascii=False combination correctly handles UTF-8 snapshots across platforms. Trailing newline keeps pre-commit happy.


123-129: Work item construction properly optimized.

Instantiating country_holidays once per country and using iterable unpacking (None, *country.subdivisions) addresses the RUF005 violation and eliminates redundant instantiation. Passing supported_categories in the work items is the right approach.


160-160: Warnings suppression doesn't affect worker processes.

warnings.simplefilter("ignore") only affects the main process. Workers spawned by ProcessPoolExecutor will still emit warnings (e.g., from India, Marshall Islands). This is expected behavior—each subprocess has its own warnings configuration. If you need to suppress warnings in workers, you'd need to call warnings.simplefilter("ignore") inside each worker function.

Based on learnings


161-164: Runtime timer cleanly implemented.

Using perf_counter() for timing is the right choice for performance measurement. The formatted output matches the PR's reported improvements (~13s post-refactor vs ~59s pre-refactor).

@PPsyrius PPsyrius requested a review from KJhellico November 17, 2025 05:33
Copy link
Copy Markdown
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: 5

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1bc26b and 4389aa6.

📒 Files selected for processing (1)
  • scripts/generate_snapshots.py (3 hunks)
🧰 Additional context used
🧠 Learnings (38)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.788Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: In the vacanza/holidays project, ruff configuration allows longer docstring lines than the typical 100-character limit, so docstring reference lines that exceed standard line length limits are acceptable and won't be flagged by ruff format during pre-commit checks.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, coding standards and line length limits should follow what is allowed by the ruff linter configuration used in the pre-commit checks, not arbitrary 100-character limits.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-04T11:06:21.179Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-05T18:24:26.712Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2600
File: holidays/countries/philippines.py:56-56
Timestamp: 2025-06-05T18:24:26.712Z
Learning: In the holidays repository, if code passes `make pre-commit` checks, then it's allowed regardless of individual static analysis tool warnings like Pylint line length violations. The pre-commit hooks are the definitive source of truth for their coding standards.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-06-24T18:25:25.165Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:25-30
Timestamp: 2025-06-24T18:25:25.165Z
Learning: In the holidays project, reference URLs in docstrings/comments that exceed 100 characters are acceptable if they pass the pre-commit tests, even if Pylint flags them as line length violations.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.

Applied to files:

  • scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:32.644Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bosnia_and_herzegovina.py:22-23
Timestamp: 2025-11-08T04:57:32.644Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files (e.g., tests/countries/test_*.py) intentionally do not include return type annotations like `-> None`. The signature should remain as `def setUpClass(cls):` without explicit return type hints, consistent with the project's test conventions and similar to the pattern for `__init__` and `_populate` methods in the main codebase.

Applied to files:

  • scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
  • country_holidays (31-227)
  • financial_holidays (230-312)
  • list_supported_countries (410-421)
  • list_supported_financial (425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py

116-116: Avoid specifying long messages outside the exception class

(TRY003)


137-137: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test docs build
  • GitHub Check: Build distribution
🔇 Additional comments (4)
scripts/generate_snapshots.py (4)

21-31: Process pool imports and holidays wiring look solid

Using ProcessPoolExecutor plus perf_counter and inserting Path.cwd() into sys.path before importing holidays gives the script what it needs without extra cruft. Also good that the unused # noqa: E402 is gone now.


41-59: Mutually exclusive --country / --market fixes the silent no-op

Putting --country and --market into a mutually exclusive group is a clean way to avoid the previous “both set ⇒ nothing happens” trap. The extend + nargs="+"" pattern with default=[] keeps the API flexible.


63-66: Directory prep helper is straightforward and robust

shutil.rmtree(..., ignore_errors=True) followed by mkdir(parents=True, exist_ok=True) is a simple, resilient reset for the snapshot directory and handles missing dirs gracefully.


100-109: Financial worker mirrors the country worker cleanly

The market worker is a nice parallel to the country worker: it builds a deterministic filename, uses the shared years/snapshot_path, and pins language="en_US". No issues here.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
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 arkid15r added this pull request to the merge queue Nov 17, 2025
Merged via the queue into vacanza:dev with commit 567a50b Nov 17, 2025
33 checks passed
@KJhellico KJhellico mentioned this pull request Nov 17, 2025
@PPsyrius PPsyrius deleted the make_snapshot branch November 18, 2025 02:35
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