]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
Add file_path_separator to apply to all path splitting
authorMike Werezak <mike.werezak@nrcan-rncan.gc.ca>
Sat, 26 Apr 2025 18:57:24 +0000 (14:57 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 13 May 2025 15:01:08 +0000 (11:01 -0400)
commit9913fdb8e20262ccbc34f715b044d36b4be8b5ad
tree51d97a5276a558afe0c8b755e0e95b3c2557a269
parente9f0c07b34b2e157400e7d777c8e31f97381f9ad
Add file_path_separator to apply to all path splitting

Added new option to the ConfigParser config (typically via ``alembic.ini``)
``path_separator``. This new option supersedes the previous similar
option ``version_path_separator``.   The new ``path_separator`` option
applies to the path splitting mechanism of both the ``version_locations``
option as well as the ``prepend_sys_path`` option, and in newly
rendered ``alembic.ini`` files will use the value ``os``, which means to
use the operating system path separator when splitting these string values
into a list of paths.

The new attribute applies necessary os-dependent path splitting to the
``prepend_sys_path`` option so that windows paths which contain drive
letters with colons are not inadvertently split, whereas previously
os-dependent path splitting were only available for the
``version_locations`` option.

Existing installations that do not have ``path_separator`` present
will continue to make use of ``version_path_separator`` when parsing the
``version_locations`` option, or splitting on spaces / commas if
``version_path_separator`` is also not present.  ``prepend_sys_path`` will
continue to be split on spaces/commas/colons if ``path_separator`` is
not present.   Under all of these fallback conditions, a deprecation
warning is now emitted encouraging to set ``path_separator``.

Pull request courtesy Mike Werezak.

This change also begins to move some of the role of interpreting
of specific config options into the Config object.  This process will
continue as we look to add toml support to config.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #1330
Closes: #1331
Pull-request: https://github.com/sqlalchemy/alembic/pull/1331
Pull-request-sha: f16b35d69acddd046cbba8f28e46219c872c151d

Change-Id: Idef47e8a6947210f1eb63c3d16c4be553effa3a2
18 files changed:
alembic/__init__.py
alembic/config.py
alembic/script/base.py
alembic/script/write_hooks.py
alembic/templates/async/alembic.ini.mako
alembic/templates/generic/alembic.ini.mako
alembic/templates/multidb/alembic.ini.mako
alembic/testing/__init__.py
alembic/testing/assertions.py
alembic/testing/env.py
alembic/util/__init__.py
alembic/util/messaging.py
docs/build/branches.rst
docs/build/changelog.rst
docs/build/tutorial.rst
docs/build/unreleased/1330.rst [new file with mode: 0644]
tests/test_config.py
tests/test_environment.py