From: Federico Caselli Date: Sun, 29 Mar 2020 18:57:08 +0000 (+0200) Subject: Remove support for python 3.4 X-Git-Tag: rel_1_4_0b1~435^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4bd4b483e07bd81dd2417aa2a3e737fedb7ee5b4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Remove support for python 3.4 Also remove no longer used compat code Change-Id: Ifda239fd84b425e43f4028cb55a5b3b8efa4dfc6 --- diff --git a/doc/build/changelog/migration_14.rst b/doc/build/changelog/migration_14.rst index e7ee2a7b21..72cd996fb8 100644 --- a/doc/build/changelog/migration_14.rst +++ b/doc/build/changelog/migration_14.rst @@ -1508,7 +1508,7 @@ join rewriting logic would only occur for SQLite verisons prior to 3.7.16 after bisection was used to identify where SQLite fixed its support for this construct, and no further issues were reported against the behavior (even though some bugs were found internally). It is now anticipated that there -are little to no Python builds for Python 2.7 or 3.4 and above (the supported +are little to no Python builds for Python 2.7 or 3.5 and above (the supported Python versions) which would include a SQLite version prior to 3.7.17, and the behavior is only necessary only in more complex ORM joining scenarios. A warning is now emitted if the installed SQLite version is older than diff --git a/doc/build/changelog/unreleased_14/drop_python34.rst b/doc/build/changelog/unreleased_14/drop_python34.rst new file mode 100644 index 0000000000..6956393138 --- /dev/null +++ b/doc/build/changelog/unreleased_14/drop_python34.rst @@ -0,0 +1,5 @@ +.. change:: + :tags: change + + Python 3.4 has reached EOL and its support has been dropped from + SQLAlchemy. diff --git a/doc/build/intro.rst b/doc/build/intro.rst index f31206bde1..828ba31b31 100644 --- a/doc/build/intro.rst +++ b/doc/build/intro.rst @@ -71,14 +71,14 @@ Supported Platforms SQLAlchemy has been tested against the following platforms: * cPython 2.7 -* cPython 3.4 and higher +* cPython 3.5 and higher * `PyPy `_ 2.1 or greater .. versionchanged:: 1.2 Python 2.7 is now the minimum Python version supported. -.. versionchanged:: 1.3 - Within the Python 3 series, 3.4 is now the minimum Python 3 version supported. +.. versionchanged:: 1.4 + Within the Python 3 series, 3.5 is now the minimum Python 3 version supported. Supported Installation Methods ------------------------------- diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index f093cad909..682ef891cb 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -192,7 +192,7 @@ class _DialectArgView(util.collections_abc.MutableMapping): def __iter__(self): return ( - util.safe_kwarg("%s_%s" % (dialect_name, value_name)) + "%s_%s" % (dialect_name, value_name) for dialect_name in self.obj.dialect_options for value_name in self.obj.dialect_options[ dialect_name diff --git a/lib/sqlalchemy/testing/mock.py b/lib/sqlalchemy/testing/mock.py index 16c2d2ac92..a63082b9b2 100644 --- a/lib/sqlalchemy/testing/mock.py +++ b/lib/sqlalchemy/testing/mock.py @@ -9,10 +9,10 @@ """ from __future__ import absolute_import -from ..util import py33 +from ..util import py3k -if py33: +if py3k: from unittest.mock import MagicMock from unittest.mock import Mock from unittest.mock import call diff --git a/lib/sqlalchemy/util/__init__.py b/lib/sqlalchemy/util/__init__.py index 1909619c59..c0e290cb0e 100644 --- a/lib/sqlalchemy/util/__init__.py +++ b/lib/sqlalchemy/util/__init__.py @@ -63,7 +63,6 @@ from .compat import parse_qsl # noqa from .compat import pickle # noqa from .compat import print_ # noqa from .compat import py2k # noqa -from .compat import py33 # noqa from .compat import py36 # noqa from .compat import py3k # noqa from .compat import quote_plus # noqa @@ -71,7 +70,6 @@ from .compat import raise_ # noqa from .compat import raise_from_cause # noqa from .compat import reduce # noqa from .compat import reraise # noqa -from .compat import safe_kwarg # noqa from .compat import string_types # noqa from .compat import StringIO # noqa from .compat import text_type # noqa diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py index 31654b97c8..79de3c9783 100644 --- a/lib/sqlalchemy/util/compat.py +++ b/lib/sqlalchemy/util/compat.py @@ -16,12 +16,8 @@ import sys py36 = sys.version_info >= (3, 6) -py33 = sys.version_info >= (3, 3) -py35 = sys.version_info >= (3, 5) -py32 = sys.version_info >= (3, 2) py3k = sys.version_info >= (3, 0) py2k = sys.version_info < (3, 0) -py265 = sys.version_info >= (2, 6, 5) cpython = platform.python_implementation() == "CPython" @@ -53,13 +49,6 @@ except ImportError: import dummy_threading as threading # noqa -# work around http://bugs.python.org/issue2646 -if py265: - safe_kwarg = lambda arg: arg # noqa -else: - safe_kwarg = str - - def inspect_getfullargspec(func): """Fully vendored version of getfullargspec from Python 3.3.""" @@ -298,7 +287,7 @@ else: TYPE_CHECKING = False -if py35: +if py3k: def _formatannotation(annotation, base_module=None): """vendored from python 3.7 @@ -378,7 +367,7 @@ if py35: return result -elif py2k: +else: from inspect import formatargspec as _inspect_formatargspec def inspect_formatargspec(*spec, **kw): @@ -386,13 +375,9 @@ elif py2k: return _inspect_formatargspec(*spec[0:4], **kw) # noqa -else: - from inspect import formatargspec as inspect_formatargspec # noqa - - # Fix deprecation of accessing ABCs straight from collections module # (which will stop working in 3.8). -if py33: +if py3k: import collections.abc as collections_abc else: import collections as collections_abc # noqa diff --git a/setup.py b/setup.py index e77c617b42..3b175c9353 100644 --- a/setup.py +++ b/setup.py @@ -157,7 +157,7 @@ def run_setup(with_cext): license="MIT", cmdclass=cmdclass, long_description=readme, - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -166,7 +166,6 @@ def run_setup(with_cext): "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", diff --git a/test/ext/declarative/test_basic.py b/test/ext/declarative/test_basic.py index d81b99ccd5..cb70b59f12 100644 --- a/test/ext/declarative/test_basic.py +++ b/test/ext/declarative/test_basic.py @@ -1006,7 +1006,7 @@ class DeclarativeTest(DeclarativeTestBase): try: hasattr(User.addresses, "property") except exc.InvalidRequestError: - assert sa.util.compat.py32 + assert sa.util.compat.py3k # the exception is preserved. Remains the # same through repeated calls. diff --git a/test/orm/test_mapper.py b/test/orm/test_mapper.py index 99e7358e5a..e4ba50f13e 100644 --- a/test/orm/test_mapper.py +++ b/test/orm/test_mapper.py @@ -182,7 +182,7 @@ class MapperTest(_fixtures.FixtureTest, AssertsCompiledSQL): try: hasattr(Address.user, "property") except sa.orm.exc.UnmappedClassError: - assert util.compat.py32 + assert util.compat.py3k for i in range(3): assert_raises_message( diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index 8ef272a9ef..afe5bdb593 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -29,7 +29,6 @@ from sqlalchemy import TypeDecorator from sqlalchemy import types as sqltypes from sqlalchemy import Unicode from sqlalchemy import UniqueConstraint -from sqlalchemy import util from sqlalchemy.engine import default from sqlalchemy.schema import AddConstraint from sqlalchemy.schema import CreateIndex @@ -4164,17 +4163,6 @@ class DialectKWArgTest(fixtures.TestBase): }, ) # still populates - def test_runs_safekwarg(self): - - with mock.patch( - "sqlalchemy.util.safe_kwarg", lambda arg: "goofy_%s" % arg - ): - with self._fixture(): - idx = Index("a", "b") - idx.kwargs[util.u("participating_x")] = 7 - - eq_(list(idx.dialect_kwargs), ["goofy_participating_x"]) - def test_combined(self): with self._fixture(): idx = Index(