Skip to content

chore: Add tzdata to hiddenimports, as preparation for pandas 3.0#1335

Merged
Czaki merged 3 commits intodevelopfrom
fix_pre_pyinstaller
Dec 7, 2025
Merged

chore: Add tzdata to hiddenimports, as preparation for pandas 3.0#1335
Czaki merged 3 commits intodevelopfrom
fix_pre_pyinstaller

Conversation

@Czaki
Copy link
Collaborator

@Czaki Czaki commented Dec 7, 2025

closes #1258

Summary by Sourcery

Add tzdata to the application's hidden imports and ensure the prerelease test workflow runs when the launcher spec changes.

Bug Fixes:

  • Include tzdata as a hidden import to prevent missing timezone data at runtime.

CI:

  • Trigger prerelease tests when launcher.spec is modified.

Summary by CodeRabbit

  • Chores
    • Expanded CI test triggers to run on additional spec changes, improving pre-release checks.
    • Improved packaged application to include timezone data, reducing time/date issues in PyInstaller builds.

✏️ Tip: You can customize this high-level summary in your review settings.

@Czaki Czaki added this to the 0.16.5 milestone Dec 7, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 7, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds the tzdata package to PyInstaller hidden imports to prepare for pandas 3.0, and ensures the prerelease test workflow is triggered when the PyInstaller spec file changes.

Flow diagram for PyInstaller build including tzdata hidden import for pandas 3.0

flowchart TD
    A["launcher.spec configuration"] --> B["hiddenimports tuple"]
    B --> C["Includes tzdata entry"]
    C --> D["Run PyInstaller build"]
    D --> E["PyInstaller collects hidden imports"]
    E --> F["tzdata bundled into application"]
    F --> G["Runtime use of pandas 3.0"]
    G --> H["pandas relies on tzdata time zone data"]
    H --> I["Application handles time zones correctly in packaged build"]
Loading

File-Level Changes

Change Details Files
Include tzdata in the PyInstaller hidden imports to avoid missing-timezone-data issues with upcoming pandas 3.0.
  • Extend the hiddenimports tuple to include the tzdata package so it is bundled into the launcher artifact.
  • Keep existing dynamic hiddenimports for imageio and skimage unchanged while appending tzdata.
launcher.spec
Ensure prerelease CI workflow reruns when the PyInstaller spec file is modified.
  • Add launcher.spec to the list of paths that trigger the test_prereleases GitHub Actions workflow on push or pull request changes.
.github/workflows/test_prereleases.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#1258 Fix the failing pyinstaller bundle --pre test workflow (linux py3.12) so that the prerelease CI job passes again.
#1258 Ensure future changes to the PyInstaller configuration (launcher.spec) correctly trigger the prerelease test workflow.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 7, 2025

Walkthrough

Adds tzdata to PyInstaller packaging (hidden imports and data files) and makes the test workflow trigger on changes to launcher.spec.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/test_prereleases.yml
Added launcher.spec to PR-trigger paths so the workflow runs when the spec file is modified
PyInstaller Spec File
launcher.spec
Added "tzdata" to hiddenimports and collect_data_files('tzdata') to include tzdata files in the bundled distribution

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Check that tzdata is added in the correct format/location within hiddenimports.
  • Verify collect_data_files('tzdata') is called where collected data files are assembled and paths are correct.

Poem

🐰
A nibble of code, a bundle to bake,
tzdata tucked in for packaging’s sake,
CI listens when the spec gets a tweak,
Hoppy builds run clean and sleek — 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding tzdata to hiddenimports for pandas 3.0 preparation.
Linked Issues check ✅ Passed The PR addresses the failing PyInstaller workflow by adding tzdata to hiddenimports and updating CI triggers, resolving the requirements in issue #1258.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the PyInstaller bundle failure: tzdata addition and workflow trigger update for launcher.spec.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_pre_pyinstaller

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 523f5a6 and b72ac01.

📒 Files selected for processing (1)
  • launcher.spec (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • launcher.spec
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
  • GitHub Check: 4DNucleome.PartSeg (Tests_other test windows)
  • GitHub Check: 4DNucleome.PartSeg (Tests_other test macos)
  • GitHub Check: 4DNucleome.PartSeg (Tests_linux test_linux)
  • GitHub Check: Base py3.10 / ubuntu-22.04 py 3.10 latest PySide2
  • GitHub Check: Base py3.11 / windows-latest py 3.11 latest PyQt5
  • GitHub Check: Base py3.11 / ubuntu-24.04 py 3.11 latest PyQt5
  • GitHub Check: Base py3.11 / macos-15-intel py 3.11 latest PyQt5
  • GitHub Check: Base py3.9 / ubuntu-24.04 py 3.9 latest PyQt5
  • GitHub Check: Base py3.10 / ubuntu-22.04 py 3.10 latest PyQt5 _pydantic_1
  • GitHub Check: Base py3.12 / ubuntu-22.04 py 3.12 latest PyQt6
  • GitHub Check: test_coverage / ubuntu-24.04 py 3.12 latest PyQt5
  • GitHub Check: Test PartSeg minimal / ubuntu-24.04 py 3.9 latest PyQt5
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller windows)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller macos_arm)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller macos)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller_linux)
  • GitHub Check: 4DNucleome.PartSeg (Builds sdist)
  • GitHub Check: ubuntu-24.04 py3.12 --pre
  • GitHub Check: windows-2022 py3.12 --pre
  • GitHub Check: 4DNucleome.PartSeg (formatting_check check_formating)
  • GitHub Check: 4DNucleome.PartSeg (manifest_check manifest_check)
  • GitHub Check: 4DNucleome.PartSeg (Documentation_check help)
  • GitHub Check: 4DNucleome.PartSeg (Documentation_check Notebook_check)
  • GitHub Check: 4DNucleome.PartSeg (GetTestData linux)
  • GitHub Check: Sourcery review
  • GitHub Check: Codacy Static Code Analysis

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.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Czaki Czaki changed the title Add tzdata to hiddenimports, as prepare for pandas 3.0 chore: Add tzdata to hiddenimports, as prepare for pandas 3.0 Dec 7, 2025
@Czaki Czaki changed the title chore: Add tzdata to hiddenimports, as prepare for pandas 3.0 chore: Add tzdata to hiddenimports, as preparation for pandas 3.0 Dec 7, 2025
@Czaki Czaki added the skip check PR title skip spellcheking PR title label Dec 7, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
launcher.spec (1)

100-101: Dynamic module collection improves maintainability.

Lines 100-101 use dynamic collection to include imageio plugins and skimage submodules, which is better than hardcoding module names.

The test exclusion pattern on line 101 using "tests" not in x is functional for skimage's module naming conventions, though a more precise pattern like ".tests" not in x and not x.endswith("tests") would avoid potential false positives if module names change.

Verify that imageio plugin objects have the module_name attribute expected on line 100, as this assumption is critical for the code to work at runtime.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3475a86 and 523f5a6.

📒 Files selected for processing (2)
  • .github/workflows/test_prereleases.yml (1 hunks)
  • launcher.spec (1 hunks)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller windows)
  • GitHub Check: 4DNucleome.PartSeg (Tests_other test windows)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller macos_arm)
  • GitHub Check: 4DNucleome.PartSeg (Builds sdist)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller_linux)
  • GitHub Check: 4DNucleome.PartSeg (Tests_other test macos)
  • GitHub Check: 4DNucleome.PartSeg (Builds pyinstaller macos)
  • GitHub Check: 4DNucleome.PartSeg (Tests_linux test_linux)
  • GitHub Check: Base py3.10 / ubuntu-22.04 py 3.10 latest PySide2
  • GitHub Check: Base py3.11 / macos-15-intel py 3.11 latest PyQt5
  • GitHub Check: Base py3.12 / ubuntu-22.04 py 3.12 latest PyQt6
  • GitHub Check: Base py3.12 / ubuntu-24.04 py 3.12 latest PyQt5
  • GitHub Check: Base py3.10 / ubuntu-24.04 py 3.10 latest PySide6
  • GitHub Check: Base py3.11 / windows-latest py 3.11 latest PyQt5
  • GitHub Check: Base py3.12 / macos-15 py 3.12 latest PyQt6
  • GitHub Check: Base py3.11 / ubuntu-24.04 py 3.11 latest PyQt5
  • GitHub Check: Base py3.10 / ubuntu-24.04 py 3.10 latest PyQt5
  • GitHub Check: test_coverage / ubuntu-24.04 py 3.12 latest PyQt5
  • GitHub Check: macos-14 py3.12 --pre
  • GitHub Check: windows-2022 py3.12 --pre
  • GitHub Check: ubuntu-24.04 py3.12 --pre
  • GitHub Check: 4DNucleome.PartSeg (manifest_check manifest_check)
  • GitHub Check: 4DNucleome.PartSeg (GetTestData linux)
  • GitHub Check: 4DNucleome.PartSeg (Documentation_check help)
  • GitHub Check: 4DNucleome.PartSeg (formatting_check check_formating)
  • GitHub Check: 4DNucleome.PartSeg (Documentation_check Notebook_check)
  • GitHub Check: Sourcery review
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
.github/workflows/test_prereleases.yml (1)

17-17: LGTM! Appropriate workflow trigger.

Adding launcher.spec to the PR trigger paths ensures that changes to the PyInstaller specification are tested by the pyinstaller job in this workflow.

"imagecodecs._imagecodecs",
"PartSeg.plugins.napari_widgets",
"PartSegCore.napari_io",
"tzdata",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

pandas 3.0 tzdata dependency pyinstaller timezone

💡 Result:

Short answer — pandas 3.0 switched to using the stdlib zoneinfo (PEP 615) by default and raised tzdata as a required dependency (min tzdata 2023.3 noted in the 3.0 whats‑new). This means on platforms that lack a system IANA DB (notably Windows, some minimal Linux containers), ZoneInfo will fall back to the tzdata package; if neither system data nor tzdata are available you get ZoneInfoNotFoundError. [1][2][3]

What this means for PyInstaller builds

  • Ensure tzdata is installed/packaged with your app (declare it in requirements). If you rely on zone names (e.g. "US/Eastern"), zoneinfo needs the IANA files at runtime. [2][3]
  • With PyInstaller you must include tzdata’s package data (the zoneinfo directory) into the bundle because PyInstaller does not automatically include non‑code data. Use one of:
    • pyinstaller options: --collect-data tzdata (or --add-data pointing to tzdata/zoneinfo) or --collect-all tzdata.
    • Or add datas to the .spec (collect_data_files('tzdata') / manual importlib-based path). [4][5][6]

Practical steps

  1. pip install tzdata and add tzdata to your packaging requirements. [3]
  2. Build with PyInstaller and include tzdata data, e.g.:
    pyinstaller --onefile --collect-data tzdata your_app.py
    (or edit .spec to include tzdata.zoneinfo files or use --add-data if you prefer explicit paths). [4][6]
  3. Test the frozen executable on the target OS (especially Windows / minimal containers) to confirm ZoneInfo(key) works (no ZoneInfoNotFoundError). [2]

References

  • pandas 3.0 whats‑new (tzdata minimum & zoneinfo default). [1]
  • Python zoneinfo docs (behavior, fallback to tzdata, ZoneInfoNotFoundError). [2]
  • tzdata package documentation / PyPI (what tzdata provides). [3]
  • PyInstaller docs and common recipes for including package data (--collect-data / --add-data / spec file). [4][5]

If you want, I can produce the exact PyInstaller .spec snippet or a one-line build command tailored to your OS.


🌐 Web query:

pandas 3.0 release notes timezone handling

💡 Result:

Summary of pandas 3.0 timezone-related changes (from the 3.0.0 "what's new" notes):

  • pd.offsets.Day now represents a calendar day (preserves wall clock time across DST), not a fixed 24-hour span — fixes date_range-related bugs but changes equality/operations semantics and can make additions ambiguous/non‑existent (these now raise). [1][2]

  • pandas now uses the stdlib zoneinfo as the default timezone implementation when a timezone string is passed; pytz is no longer required (but still supported if passed directly and can be installed via pip install pandas[timezone]). [1][2]

  • pandas no longer surfaces pytz-specific exceptions for ambiguous/nonexistent times; those cases now raise ValueError (and behavior around ambiguous/nonexistent times is more strict). [1][2]

(See the pandas 3.0 "What’s new" / release notes for full details and examples.) [1][2]

Sources:
[1] pandas 3.0.0 "What’s new" release notes. (pandas.pydata.org)
[2] pandas 3.0.0rc0 "What’s new" release notes. (pandas.pydata.org)

Citations:


🌐 Web query:

pyinstaller pandas hidden imports tzdata

💡 Result:

Short answer — include tzdata as a package + its data when building.

What to do (quick steps)

  1. Ensure tzdata is installed in your build environment:
    pip install tzdata. [2][3]

  2. Tell PyInstaller to include the tzdata package (hidden import) and its data files. Two ways:

  • Command line (quick):
    pyinstaller --hidden-import=tzdata --hidden-import=pandas yourscript.py

  • Preferable: edit the .spec to collect tzdata data files so zoneinfo resources are bundled. Example additions to the top of your spec:
    from PyInstaller.utils.hooks import collect_data_files, collect_submodules
    datas = collect_data_files('tzdata')
    hiddenimports = collect_submodules('tzdata') + collect_submodules('pandas')
    (then pass datas and hiddenimports into Analysis). [1]

  1. If you still see ZoneInfoNotFoundError, confirm zoneinfo falls back to tzdata (Python docs) and that tzdata's zoneinfo files were actually bundled into the exe (check dist// or use runtime print of sys._MEIPASS). [2][3]

Why

  • zoneinfo uses system tz DB or the tzdata package; on Windows (or systems without system tz data) you must ship tzdata. PyInstaller’s static analysis can miss data-only packages, so you must explicitly include them. [2][3][1]

References

  • PyInstaller hooks / hiddenimports / collect_data_files. [1]
  • Python zoneinfo docs (tzdata fallback). [2]
  • tzdata package documentation (what files to include). [3]
  • Examples / community reports about pandas + PyInstaller hidden imports. [4]

If you want, I can produce a ready-to-use .spec file snippet tailored to your script and platform — tell me your Python version and OS.


Also collect tzdata's data files in the .spec; hidden import alone is insufficient.

Adding tzdata to hiddenimports is correct and necessary for pandas 3.0 (which now requires tzdata for timezone handling), but PyInstaller does not automatically bundle tzdata's data files (.zoneinfo directory). The bundle will fail at runtime on Windows or systems without system timezone data. Add to launcher.spec:

from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('tzdata')

Then include datas in the Analysis() call.

🤖 Prompt for AI Agents
In launcher.spec around line 98, hiddenimports already includes 'tzdata' but the
tzdata package data files (.zoneinfo) are not being collected; import
collect_data_files from PyInstaller.utils.hooks, call
collect_data_files('tzdata') to produce a datas variable, and pass that datas
into the Analysis(...) call so the tzdata data files are bundled with the
executable.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2025

@Czaki Czaki merged commit 66fe7ac into develop Dec 7, 2025
63 checks passed
@Czaki Czaki deleted the fix_pre_pyinstaller branch December 7, 2025 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip check PR title skip spellcheking PR title

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test-bot] pyinstaller bundle --pre is failing

1 participant