Skip to content

Commit

Permalink
fix(requirements): add tzdata to tz extras; fixes #1556
Browse files Browse the repository at this point in the history
Add `tzdata` to `tz` extras, since `zoneinfo` on its own does not contain any timezones.

Fixes: #1556
Closes: #1558
Pull-request: #1558
Pull-request-sha: 9c60d7c

Change-Id: Ibf6d863a7cd277c6abffcf2853f452a5b16c5fd5
  • Loading branch information
Danipulok authored and zzzeek committed Nov 6, 2024
1 parent b6b44c1 commit 2e95cec
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion alembic/templates/async/alembic.ini.mako
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ prepend_sys_path = .

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
Expand Down
2 changes: 1 addition & 1 deletion alembic/templates/generic/alembic.ini.mako
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prepend_sys_path = .

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
Expand Down
2 changes: 1 addition & 1 deletion alembic/templates/multidb/alembic.ini.mako
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prepend_sys_path = .

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
Expand Down
8 changes: 4 additions & 4 deletions docs/build/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ The file generated with the "generic" configuration looks like::

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library.
# If specified, requires the python>=3.9 or backports.zoneinfo library and tzdata library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
Expand Down Expand Up @@ -299,9 +299,9 @@ This file contains the following features:
* ``timezone`` - an optional timezone name (e.g. ``UTC``, ``EST5EDT``, etc.)
that will be applied to the timestamp which renders inside the migration
file's comment as well as within the filename. This option requires Python>=3.9
or installing the ``backports.zoneinfo`` library. If ``timezone`` is specified,
the create date object is no longer derived from ``datetime.datetime.now()``
and is instead generated as::
or installing the ``backports.zoneinfo`` library and the ``tzdata`` library.
If ``timezone`` is specified, the create date object is no longer derived
from ``datetime.datetime.now()`` and is instead generated as::

datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc
Expand Down
6 changes: 6 additions & 0 deletions docs/build/unreleased/1556.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. change::
:tags: bug, environment
:tickets: 1556

Added `tzdata` to `tz` extras, which is required on some platforms such as
Windows. Pull request courtesy Danipulok.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ install_requires =
[options.extras_require]
tz =
backports.zoneinfo;python_version<"3.9"
tzdata

[options.package_data]
alembic = *.pyi, py.typed
Expand Down

0 comments on commit 2e95cec

Please sign in to comment.