Skip to content

Commit 468019c

Browse files
committed
- 1.16.0
1 parent 3feee4c commit 468019c

File tree

12 files changed

+166
-156
lines changed

12 files changed

+166
-156
lines changed

docs/build/changelog.rst

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,170 @@ Changelog
55

66
.. changelog::
77
:version: 1.16.0
8-
:include_notes_from: unreleased
8+
:released: May 21, 2025
9+
10+
.. change::
11+
:tags: feature, environment
12+
:tickets: 1082
13+
14+
Added optional :pep:`621` support to Alembic, allowing all source code
15+
related configuration (e.g. local file paths, post write hook
16+
configurations, etc) to be configured in the project's ``pyproject.toml``
17+
file. A new init template ``pyproject`` is added which illustrates a
18+
basic :pep:`621` setup.
19+
20+
Besides being better integrated with a Python project's existing source
21+
code configuration, the TOML format allows for more flexible structures,
22+
allowing configuration items like ``version_locations`` and
23+
``prepend_sys_path`` to be configured as lists of path strings without the
24+
need for path separator characters used by ``ConfigParser`` format. The
25+
feature continues to support the ``%(here)s`` token which can substitute
26+
the absolute parent directory of the ``pyproject.toml`` file when
27+
consumed.
28+
29+
The :pep:`621` feature supports configuration values that are relevant to
30+
source code organization and generation only; it does not accommodate
31+
configuration of database connectivity or logging, which remain under the
32+
category of "deployment" configuration and continue to be part of
33+
``alembic.ini``, or whatever configurational method is established by the
34+
``env.py`` file. Using the combination of ``pyproject.toml`` for source
35+
code configuration along with a custom database/logging configuration
36+
method established in ``env.py`` will allow the ``alembic.ini`` file to be
37+
omitted altogether.
38+
39+
40+
.. seealso::
41+
42+
:ref:`using_pep_621`
43+
44+
.. change::
45+
:tags: usecase, environment
46+
:tickets: 1330
47+
48+
Added new option to the ConfigParser (e.g. ``alembic.ini``) configuration
49+
``path_separator``, which supersedes the existing ``version_path_separator``
50+
option. ``path_separator`` specifies the path separator character that
51+
will be recognized for both the ``version_locations`` option as well
52+
as the ``prepend_sys_path`` option, defaulting to ``os`` which indicates
53+
that the value of ``os.pathsep`` should be used.
54+
55+
The new attribute applies necessary os-dependent path splitting to the
56+
``prepend_sys_path`` option so that windows paths which contain drive
57+
letters with colons are not inadvertently split, whereas previously
58+
os-dependent path splitting were only available for the ``version_locations`` option.
59+
60+
Existing installations that don't indicate ``path_separator``
61+
will continue to use the older behavior, where ``version_path_separator``
62+
may be configured for ``version_locations``, and ``prepend_sys_path``
63+
continues to be split on spaces/commas/colons. A deprecation warning
64+
is emitted for these fallback scenarios.
65+
66+
When using the new ``pyproject.toml`` configuration detailed at
67+
:ref:`using_pep_621`, the whole issue of "path separators" is sidestepped
68+
and parameters like ``path_separator`` are unnecessary, as the TOML based
69+
configuration configures version locations and sys path elements as
70+
lists.
71+
72+
Pull request courtesy Mike Werezak.
73+
74+
.. change::
75+
:tags: feature, commands
76+
:tickets: 1610
77+
78+
Added new :meth:`.CommandLine.register_command` method to
79+
:class:`.CommandLine`, intended to facilitate adding custom commands to
80+
Alembic's command line tool with minimal code required; previously this
81+
logic was embedded internally and was not publicly accessible. A new
82+
recipe demonstrating this use is added. Pull request courtesy Mikhail
83+
Bulash.
84+
85+
.. seealso::
86+
87+
:ref:`custom_commandline`
88+
89+
.. change::
90+
:tags: usecase, operations
91+
:tickets: 1626
92+
93+
Added :paramref:`.Operations.add_column.if_not_exists` and
94+
:paramref:`.Operations.drop_column.if_exists` to render ``IF [NOT] EXISTS``
95+
for ``ADD COLUMN`` and ``DROP COLUMN`` operations, a feature available on
96+
some database backends such as PostgreSQL, MariaDB, as well as third party
97+
backends. The parameters also support autogenerate rendering allowing them
98+
to be added to autogenerate scripts via a custom :class:`.Rewriter`. Pull
99+
request courtesy of Louis-Amaury Chaib (@lachaib).
100+
101+
.. change::
102+
:tags: bug, general
103+
:tickets: 1637
104+
105+
The ``pyproject.toml`` file used by the Alembic project itself for its
106+
Python package configuration has been amended to use the updated :pep:`639`
107+
configuration for license, which eliminates loud deprecation warnings when
108+
building the package. Note this necessarily bumps setuptools build
109+
requirement to 77.0.3.
110+
111+
.. change::
112+
:tags: bug, environment
113+
:tickets: 1643
114+
115+
Fixed issue where use of deprecated ``utcnow()`` function would generate
116+
warnings. Has been replaced with ``now(UTC)``. Pull request courtesy
117+
Jens Tröger.
118+
119+
.. change::
120+
:tags: usecase, operations
121+
:tickets: 1650
122+
123+
Added :paramref:`.Operations.drop_constraint.if_exists` parameter to
124+
:meth:`.Operations.drop_constraint` which will render ``DROP CONSTRAINT IF
125+
EXISTS``. The parameter also supports autogenerate rendering allowing it to
126+
be added to autogenerate scripts via a custom :class:`.Rewriter`. Pull
127+
request courtesy Aaron Griffin.
128+
129+
.. change::
130+
:tags: bug, autogenerate
131+
:tickets: 1656
132+
133+
The :meth:`.Operations.execute` operation when rendered in autogenerate
134+
(which would necessarily be only when using a custom writer that embeds
135+
:class:`.ExecuteSQLOp`) now correctly takes into account the value
136+
configured in :paramref:`configure.alembic_module_prefix` when rendering
137+
the operation with its prefixing namespace; previously this was hardcoded
138+
to ``op.``. Pull request courtesy Avery Fischer.
139+
140+
.. change::
141+
:tags: bug, autogenerate
142+
:tickets: 264
143+
144+
The autogenerate process will now apply the :meth:`.Operations.f` modifier
145+
to the names of all constraints and indexes that are reflected from the
146+
target database when generating migrations, which has the effect that these
147+
names will not have any subsequent naming conventions applied to them when
148+
the migration operations proceed. As reflected objects already include the
149+
exact name that's present in the database, these names should not be
150+
modified. The fix repairs the issue when using custom naming conventions
151+
which feature the ``%(constraint_name)s`` token would cause names to be
152+
double-processed, leading to errors in migration runs.
153+
154+
155+
156+
.. change::
157+
:tags: refactored, environment
158+
159+
The command, config and script modules now rely on ``pathlib.Path`` for
160+
internal path manipulations, instead of ``os.path()`` operations. This
161+
has some impact on both public and private (i.e. underscored) API functions:
162+
163+
* Public API functions that accept parameters indicating file and directory
164+
paths as strings will continue to do so, but now will also accept
165+
``os.PathLike`` objects as well.
166+
* Public API functions and accessors that return directory paths as strings
167+
such as :attr:`.ScriptDirectory.dir`, :attr:`.Config.config_file_name`
168+
will continue to do so.
169+
* Private API functions and accessors, i.e. all those that are prefixed
170+
with an underscore, that previously returned directory paths as
171+
strings may now return a Path object instead.
9172

10173
.. changelog::
11174
:version: 1.15.2

docs/build/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
# The short X.Y version.
101101
version = alembic.__version__
102102
# The full version, including alpha/beta/rc tags.
103-
release = "1.15.2"
104-
release_date = "March 28, 2025"
103+
release = "1.16.0"
104+
release_date = "May 21, 2025"
105105

106106

107107
# The language for content autogenerated by Sphinx. Refer to documentation

docs/build/unreleased/1082.rst

Lines changed: 0 additions & 33 deletions
This file was deleted.

docs/build/unreleased/1330.rst

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/build/unreleased/1610.rst

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/build/unreleased/1626.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/build/unreleased/1637.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/build/unreleased/1643.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/build/unreleased/1650.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/build/unreleased/1656.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)