summaryrefslogtreecommitdiff
path: root/alembic/templates/pylons
diff options
context:
space:
mode:
authorMike Waites <mikey.waites@gmail.com>2018-12-30 16:09:27 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2019-09-19 13:16:14 -0400
commit51b307247de12f77b2e482b7bd90a244394566b9 (patch)
treee646d554cbc0a66db0ca51b3f615d0ac7fa6a9b0 /alembic/templates/pylons
parent3398e6b5a5175009c9d7047df0c1bbf9891c6610 (diff)
downloadalembic-51b307247de12f77b2e482b7bd90a244394566b9.tar.gz
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
Diffstat (limited to 'alembic/templates/pylons')
-rw-r--r--alembic/templates/pylons/alembic.ini.mako11
1 files changed, 11 insertions, 0 deletions
diff --git a/alembic/templates/pylons/alembic.ini.mako b/alembic/templates/pylons/alembic.ini.mako
index 6f6511b..70fead0 100644
--- a/alembic/templates/pylons/alembic.ini.mako
+++ b/alembic/templates/pylons/alembic.ini.mako
@@ -35,6 +35,17 @@ script_location = ${script_location}
# are written from script.py.mako
# output_encoding = utf-8
+[post_write_hooks]
+# post_write_hooks defines scripts or Python functions that are run
+# on newly generated revision scripts. See the documentation for further
+# detail and examples
+
+# format using "black" - use the console_scripts runner, against the "black" entrypoint
+# hooks=black
+# black.type=console_scripts
+# black.entrypoint=black
+# black.options=-l 79
+
pylons_config_file = ./development.ini
# that's it ! \ No newline at end of file