-
Notifications
You must be signed in to change notification settings - Fork 91
-
Python has had the zoneinfo library since 3.9, and pytz is widely considered a legacy project that was necessary at one time, but no longer. (E.g. Django dropped support for it in 5.0.) For more background, see here.
In this project, pytz is included in pyproject.toml only in the test and scripts dependency groups, despite it actually being a runtime dependency, apparently for TIMESTAMPTZ support (correct me if I'm wrong). I transitioned away from pytz to zoneinfo in a Django project that also has duckdb-python, and after removing pytz my server startup (where I'm performing a schema check on a table with a TIMESTAMPTZ field) started failing:
_duckdb.InvalidInputException: Invalid Input Error: Required module 'pytz' failed to import, due to the following Python exception:
ModuleNotFoundError: No module named 'pytz'
Quick and dirty fix: pytz should at the very least be in optional-dependencies.all in pyproject.toml.
Better fix: drop pytz and use zoneinfo instead; one less external dependency to worry about.
Beta Was this translation helpful? Give feedback.