chore: Add tzdata to hiddenimports, as preparation for pandas 3.0#1335
chore: Add tzdata to hiddenimports, as preparation for pandas 3.0#1335
tzdata to hiddenimports, as preparation for pandas 3.0#1335Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds 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.0flowchart 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"]
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughAdds Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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. Comment |
tzdata to hiddenimports, as preparation for pandas 3.0
There was a problem hiding this comment.
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 xis 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_nameattribute 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
📒 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.specto 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", |
There was a problem hiding this comment.
🧩 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
- pip install tzdata and add tzdata to your packaging requirements. [3]
- 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] - 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:
- 1: https://pandas.pydata.org/pandas-docs/dev/whatsnew/v3.0.0.html?utm_source=openai
- 2: https://pandas.pydata.org/docs/dev/whatsnew/v3.0.0.html?utm_source=openai
🌐 Web query:
pyinstaller pandas hidden imports tzdata
💡 Result:
Short answer — include tzdata as a package + its data when building.
What to do (quick steps)
-
Ensure tzdata is installed in your build environment:
pip install tzdata. [2][3] -
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]
- 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.
|



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:
CI:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.