]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
Provide revision post-write hooks
authorMike Waites <mikey.waites@gmail.com>
Sun, 30 Dec 2018 16:09:27 +0000 (16:09 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Sep 2019 17:16:14 +0000 (13:16 -0400)
commit51b307247de12f77b2e482b7bd90a244394566b9
treee646d554cbc0a66db0ca51b3f615d0ac7fa6a9b0
parent3398e6b5a5175009c9d7047df0c1bbf9891c6610
Provide revision post-write hooks

Added "post write hooks" to revision generation.   The primary rationale is
to provide for code formatting tools to automatically format new revisions,
however any arbitrary script or Python function may be  invoked as a hook.
The hooks are enabled by providing a ``[post_write_hooks]`` section in the
alembic.ini file.   The provided hook is a command-line runner which
includes configuration examples for running Black or autopep8 on newly
generated revision scripts.

The documentation also illustrates a custom hook that converts Python
source spaces to tabs, as requested in #577.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #307
Fixes: #577
Change-Id: I9d2092d20ec23f62ed3b33d979c16b979a450b48
12 files changed:
alembic/config.py
alembic/script/base.py
alembic/script/write_hooks.py [new file with mode: 0644]
alembic/templates/generic/alembic.ini.mako
alembic/templates/multidb/alembic.ini.mako
alembic/templates/pylons/alembic.ini.mako
alembic/util/messaging.py
docs/build/api/script.rst
docs/build/autogenerate.rst
docs/build/tutorial.rst
docs/build/unreleased/307.rst [new file with mode: 0644]
tests/test_post_write.py [new file with mode: 0644]