You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Python has had the
zoneinfolibrary since 3.9, andpytzis 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,
pytzis included inpyproject.tomlonly in thetestandscriptsdependency groups, despite it actually being a runtime dependency, apparently forTIMESTAMPTZsupport (correct me if I'm wrong). I transitioned away frompytztozoneinfoin a Django project that also hasduckdb-python, and after removingpytzmy server startup (where I'm performing a schema check on a table with aTIMESTAMPTZfield) started failing:Quick and dirty fix:
pytzshould at the very least be inoptional-dependencies.allinpyproject.toml.Better fix: drop
pytzand usezoneinfoinstead; one less external dependency to worry about.Beta Was this translation helpful? Give feedback.
All reactions