From 2e95cec38ce3950c4b5cd4d7154bc1b2ba025532 Mon Sep 17 00:00:00 2001 From: Danipulok Date: Wed, 6 Nov 2024 12:06:50 -0500 Subject: [PATCH] fix(requirements): add `tzdata` to `tz` extras; fixes #1556 Add `tzdata` to `tz` extras, since `zoneinfo` on its own does not contain any timezones. Fixes: #1556 Closes: #1558 Pull-request: https://github.com/sqlalchemy/alembic/pull/1558 Pull-request-sha: 9c60d7c1a2d4171511828ae60de0649905297a17 Change-Id: Ibf6d863a7cd277c6abffcf2853f452a5b16c5fd5 --- alembic/templates/async/alembic.ini.mako | 2 +- alembic/templates/generic/alembic.ini.mako | 2 +- alembic/templates/multidb/alembic.ini.mako | 2 +- docs/build/tutorial.rst | 8 ++++---- docs/build/unreleased/1556.rst | 6 ++++++ setup.cfg | 1 + 6 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 docs/build/unreleased/1556.rst diff --git a/alembic/templates/async/alembic.ini.mako b/alembic/templates/async/alembic.ini.mako index 7eee9132..02ddb9e1 100644 --- a/alembic/templates/async/alembic.ini.mako +++ b/alembic/templates/async/alembic.ini.mako @@ -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 diff --git a/alembic/templates/generic/alembic.ini.mako b/alembic/templates/generic/alembic.ini.mako index f1f76cae..fb709232 100644 --- a/alembic/templates/generic/alembic.ini.mako +++ b/alembic/templates/generic/alembic.ini.mako @@ -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 diff --git a/alembic/templates/multidb/alembic.ini.mako b/alembic/templates/multidb/alembic.ini.mako index bf383ea1..687da570 100644 --- a/alembic/templates/multidb/alembic.ini.mako +++ b/alembic/templates/multidb/alembic.ini.mako @@ -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 diff --git a/docs/build/tutorial.rst b/docs/build/tutorial.rst index a5779d29..347e856b 100644 --- a/docs/build/tutorial.rst +++ b/docs/build/tutorial.rst @@ -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 @@ -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 diff --git a/docs/build/unreleased/1556.rst b/docs/build/unreleased/1556.rst new file mode 100644 index 00000000..d0b96b13 --- /dev/null +++ b/docs/build/unreleased/1556.rst @@ -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. diff --git a/setup.cfg b/setup.cfg index e3a51f25..89c095f7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,6 +49,7 @@ install_requires = [options.extras_require] tz = backports.zoneinfo;python_version<"3.9" + tzdata [options.package_data] alembic = *.pyi, py.typed