with open(
os.path.join(config.get_template_directory(), tempname, "README")
) as readme:
- synopsis = next(readme)
+ synopsis = next(readme).rstrip()
config.print_stdout("%s - %s", tempname, synopsis)
config.print_stdout("\nTemplates are used via the 'init' command, e.g.:")
+++ /dev/null
-Configuration that reads from a Pylons project environment.
\ No newline at end of file
+++ /dev/null
-# a Pylons configuration.
-
-[alembic]
-# path to migration scripts
-script_location = ${script_location}
-
-# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
-# Uncomment the line below if you want the files to be prepended with date and time
-# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
-# for all available tokens
-# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
-
-# sys.path path, will be prepended to sys.path if present.
-# defaults to the current working directory.
-prepend_sys_path = .
-
-# timezone to use when rendering the date within the migration file
-# as well as the filename.
-# If specified, requires the python-dateutil library that can be
-# installed by adding `alembic[tz]` to the pip requirements
-# string value is passed to dateutil.tz.gettz()
-# leave blank for localtime
-# timezone =
-
-# max length of characters to apply to the
-# "slug" field
-# truncate_slug_length = 40
-
-# set to 'true' to run the environment during
-# the 'revision' command, regardless of autogenerate
-# revision_environment = false
-
-# set to 'true' to allow .pyc and .pyo files without
-# a source .py file to be detected as revisions in the
-# versions/ directory
-# sourceless = false
-
-# version location specification; This defaults
-# to ${script_location}/versions. When using multiple version
-# directories, initial revisions must be specified with --version-path.
-# The path separator used here should be the separator specified by "version_path_separator" below.
-# version_locations = %(here)s/bar:%(here)s/bat:${script_location}/versions
-
-# version path separator; As mentioned above, this is the character used to split
-# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
-# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
-# Valid values for version_path_separator are:
-#
-# version_path_separator = :
-# version_path_separator = ;
-# version_path_separator = space
-version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
-
-# the output encoding used when revision files
-# 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 REVISION_SCRIPT_FILENAME
-
-pylons_config_file = ./development.ini
-
-# that's it !
+++ /dev/null
-"""Pylons bootstrap environment.
-
-Place 'pylons_config_file' into alembic.ini, and the application will
-be loaded from there.
-
-"""
-from logging.config import fileConfig
-
-from paste.deploy import loadapp
-
-from alembic import context
-
-
-try:
- # if pylons app already in, don't create a new app
- from pylons import config as pylons_config
-
- pylons_config["__file__"]
-except:
- config = context.config
- # can use config['__file__'] here, i.e. the Pylons
- # ini file, instead of alembic.ini
- config_file = config.get_main_option("pylons_config_file")
- if config_file is not None:
- fileConfig(config_file)
- wsgi_app = loadapp("config:%s" % config_file, relative_to=".")
-
-
-# customize this section for non-standard engine configurations.
-meta = __import__(
- "%s.model.meta" % wsgi_app.config["pylons.package"]
-).model.meta
-
-# add your model's MetaData object here
-# for 'autogenerate' support
-# from myapp import mymodel
-# target_metadata = mymodel.Base.metadata
-target_metadata = None
-
-
-def run_migrations_offline() -> None:
- """Run migrations in 'offline' mode.
-
- This configures the context with just a URL
- and not an Engine, though an Engine is acceptable
- here as well. By skipping the Engine creation
- we don't even need a DBAPI to be available.
-
- Calls to context.execute() here emit the given string to the
- script output.
-
- """
- context.configure(
- url=meta.engine.url,
- target_metadata=target_metadata,
- literal_binds=True,
- dialect_opts={"paramstyle": "named"},
- )
- with context.begin_transaction():
- context.run_migrations()
-
-
-def run_migrations_online() -> None:
- """Run migrations in 'online' mode.
-
- In this scenario we need to create an Engine
- and associate a connection with the context.
-
- """
- # specify here how the engine is acquired
- # engine = meta.engine
- raise NotImplementedError("Please specify engine connectivity here")
-
- with engine.connect() as connection: # noqa
- context.configure(
- connection=connection, target_metadata=target_metadata
- )
-
- with context.begin_transaction():
- context.run_migrations()
-
-
-if context.is_offline_mode():
- run_migrations_offline()
-else:
- run_migrations_online()
+++ /dev/null
-"""${message}
-
-Revision ID: ${up_revision}
-Revises: ${down_revision | comma,n}
-Create Date: ${create_date}
-
-"""
-from alembic import op
-import sqlalchemy as sa
-${imports if imports else ""}
-
-# revision identifiers, used by Alembic.
-revision = ${repr(up_revision)}
-down_revision = ${repr(down_revision)}
-branch_labels = ${repr(branch_labels)}
-depends_on = ${repr(depends_on)}
-
-
-def upgrade() -> None:
- ${upgrades if upgrades else "pass"}
-
-
-def downgrade() -> None:
- ${downgrades if downgrades else "pass"}
=========
Alembic is developed by `Mike Bayer <http://techspot.zzzeek.org>`_, and is
-loosely associated with the SQLAlchemy_, `Pylons <http://www.pylonsproject.org>`_,
-and `Openstack <http://www.openstack.org>`_ projects.
+part of the SQLAlchemy_ project.
-User issues, discussion of potential bugs and features should be posted
-to the Alembic Google Group at `sqlalchemy-alembic <https://groups.google.com/group/sqlalchemy-alembic>`_.
+User issues, discussion of potential bugs and features are most easily
+discussed using `Github Discussions <https://github.com/sqlalchemy/alembic/discussions/>`_.
.. _bugs:
generic - Generic single-database configuration.
async - Generic single-database configuration with an async dbapi.
multidb - Rudimentary multi-database configuration.
- pylons - Configuration that reads from a Pylons project environment.
Templates are used via the 'init' command, e.g.:
- alembic init --template pylons ./scripts
+ alembic init --template generic ./scripts
+
+.. versionchanged:: 1.8 The "pylons" environment template has been removed.
Editing the .ini File
=====================
:tags: feature, typing
:tickets: 764
- Adds typing annotations to ``env.py`` and migration templates.
- Pull request by Nikita Sobolev.
+ :pep:`484` typing annotations have been added to the ``env.py`` and
+ revision template files within migration templates. Pull request by Nikita
+ Sobolev.
--- /dev/null
+.. change::
+ :tags: changed, environment
+ :tickets: 987
+
+ The "Pylons" environment template has been removed as of Alembic 1.8. This
+ template was based on the very old pre-Pyramid Pylons web framework which
+ has been long superseded by Pyramid.