]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
remove pylons template
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 May 2022 20:18:57 +0000 (16:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 May 2022 20:21:27 +0000 (16:21 -0400)
also some other doc updates
Fixes: #987
Change-Id: Icf3513201a4e26296cef15e2d6b3703759f6e831

alembic/command.py
alembic/templates/pylons/README [deleted file]
alembic/templates/pylons/alembic.ini.mako [deleted file]
alembic/templates/pylons/env.py [deleted file]
alembic/templates/pylons/script.py.mako [deleted file]
docs/build/front.rst
docs/build/tutorial.rst
docs/build/unreleased/764.rst
docs/build/unreleased/987.rst [new file with mode: 0644]

index d48affc738fa69cf3ec77e5fc452c45d5625f601..bbff75d1f78d0d2ef452e3cb98cec4bbce295fd2 100644 (file)
@@ -29,7 +29,7 @@ def list_templates(config):
         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.:")
diff --git a/alembic/templates/pylons/README b/alembic/templates/pylons/README
deleted file mode 100644 (file)
index ed3c28e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Configuration that reads from a Pylons project environment.
\ No newline at end of file
diff --git a/alembic/templates/pylons/alembic.ini.mako b/alembic/templates/pylons/alembic.ini.mako
deleted file mode 100644 (file)
index 82facf9..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# 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 !
diff --git a/alembic/templates/pylons/env.py b/alembic/templates/pylons/env.py
deleted file mode 100644 (file)
index 99bc19e..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-"""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()
diff --git a/alembic/templates/pylons/script.py.mako b/alembic/templates/pylons/script.py.mako
deleted file mode 100644 (file)
index 55df286..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-"""${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"}
index 547a60d97dff2a51e5ba022bb229aa0cae056efb..f4eb660ba2a10b0738ebc816d9c66cb91ba503cd 100644 (file)
@@ -93,11 +93,10 @@ Community
 =========
 
 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:
 
index 17034c16a32ed4e39fa858f36717a33384bdc1bf..8540be13d92349a33cd993946ab76431bef245c9 100644 (file)
@@ -108,11 +108,12 @@ command::
     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
 =====================
index 184c0ac78f09371b1ff5df39354391d98ce85521..9be4a96769d91dd26e10c947374865ccd77c75e5 100644 (file)
@@ -2,5 +2,6 @@
     :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.
diff --git a/docs/build/unreleased/987.rst b/docs/build/unreleased/987.rst
new file mode 100644 (file)
index 0000000..c9d7055
--- /dev/null
@@ -0,0 +1,7 @@
+.. 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.