From: Hugo Date: Sat, 9 Jun 2018 14:41:43 +0000 (+0300) Subject: Drop Python 2.6 / 3.3 support X-Git-Tag: rel_1_0_0~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=843decd8ea0e7785914ed563ba93590e9fda399b;p=thirdparty%2Fsqlalchemy%2Falembic.git Drop Python 2.6 / 3.3 support For Alembic 1.0, Python 2.6 / 3.3 support is being dropped, allowing a fixed setup.py to be built as well as universal wheels. Pull request courtesy Hugo. Change-Id: Iff9018ea6c5a65b3560f7ca72e0ef233c822ec27 Fixes: #491 --- diff --git a/alembic/testing/mock.py b/alembic/testing/mock.py index db8a6731..08a756cb 100644 --- a/alembic/testing/mock.py +++ b/alembic/testing/mock.py @@ -12,9 +12,9 @@ """ from __future__ import absolute_import -from ..util.compat import py33 +from ..util.compat import py3k -if py33: +if py3k: from unittest.mock import MagicMock, Mock, call, patch, ANY else: try: diff --git a/alembic/testing/plugin/bootstrap.py b/alembic/testing/plugin/bootstrap.py index 1560b03d..9f42fd21 100644 --- a/alembic/testing/plugin/bootstrap.py +++ b/alembic/testing/plugin/bootstrap.py @@ -26,7 +26,7 @@ to_bootstrap = locals()['to_bootstrap'] def load_file_as_module(name): path = os.path.join(os.path.dirname(bootstrap_file), "%s.py" % name) - if sys.version_info >= (3, 3): + if sys.version_info.major >= 3: from importlib import machinery mod = machinery.SourceFileLoader(name, path).load_module() else: diff --git a/alembic/testing/plugin/noseplugin.py b/alembic/testing/plugin/noseplugin.py index 1adfccb1..f8894d66 100644 --- a/alembic/testing/plugin/noseplugin.py +++ b/alembic/testing/plugin/noseplugin.py @@ -27,7 +27,7 @@ import sys from nose.plugins import Plugin fixtures = None -py3k = sys.version_info >= (3, 0) +py3k = sys.version_info.major >= 3 class NoseSQLAlchemy(Plugin): diff --git a/alembic/testing/plugin/plugin_base.py b/alembic/testing/plugin/plugin_base.py index 81584230..a5c7ee39 100644 --- a/alembic/testing/plugin/plugin_base.py +++ b/alembic/testing/plugin/plugin_base.py @@ -28,7 +28,7 @@ except ImportError: import sys import re -py3k = sys.version_info >= (3, 0) +py3k = sys.version_info.major >= 3 if py3k: import configparser diff --git a/alembic/testing/plugin/pytestplugin.py b/alembic/testing/plugin/pytestplugin.py index 15c7e078..4d0f340d 100644 --- a/alembic/testing/plugin/pytestplugin.py +++ b/alembic/testing/plugin/pytestplugin.py @@ -11,7 +11,7 @@ except ImportError: import sys -py3k = sys.version_info >= (3, 0) +py3k = sys.version_info.major >= 3 import pytest import argparse diff --git a/alembic/util/compat.py b/alembic/util/compat.py index a754f2a8..b3e0d57a 100644 --- a/alembic/util/compat.py +++ b/alembic/util/compat.py @@ -1,13 +1,12 @@ import io import sys -if sys.version_info < (2, 6): - raise NotImplementedError("Python 2.6 or greater is required.") +if sys.version_info < (2, 7): + raise NotImplementedError("Python 2.7 or greater is required.") py27 = sys.version_info >= (2, 7) -py2k = sys.version_info < (3, 0) -py3k = sys.version_info >= (3, 0) -py33 = sys.version_info >= (3, 3) +py2k = sys.version_info.major < 3 +py3k = sys.version_info.major >= 3 py35 = sys.version_info >= (3, 5) py36 = sys.version_info >= (3, 6) @@ -89,7 +88,7 @@ if py35: spec.loader.exec_module(module) return module -elif py33: +elif py3k: import importlib.machinery def load_module_py(module_id, path): @@ -104,7 +103,7 @@ elif py33: del sys.modules[module_id] return module -if py33: +if py3k: def get_bytecode_suffixes(): try: return importlib.machinery.BYTECODE_SUFFIXES @@ -114,16 +113,11 @@ if py33: def get_current_bytecode_suffixes(): if py35: suffixes = importlib.machinery.BYTECODE_SUFFIXES - elif py33: + else: if sys.flags.optimize: suffixes = importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES else: suffixes = importlib.machinery.BYTECODE_SUFFIXES - else: - if sys.flags.optimize: - suffixes = [".pyo"] - else: - suffixes = [".pyc"] return suffixes diff --git a/docs/build/front.rst b/docs/build/front.rst index dceb1a47..45a15f27 100644 --- a/docs/build/front.rst +++ b/docs/build/front.rst @@ -54,7 +54,9 @@ is installed, in addition to other dependencies. Alembic will work with SQLAlchemy as of version **0.7.3**, however more features are available with newer versions such as the 0.9 or 1.0 series. -Alembic supports Python versions 2.6 and above. +Alembic supports Python versions 2.7, 3.4 and above. + +.. versionchanged:: 1.0.0 Support for Python 2.6 and 3.3 was dropped. Community ========= diff --git a/docs/build/unreleased/491.rst b/docs/build/unreleased/491.rst new file mode 100644 index 00000000..3aed5da0 --- /dev/null +++ b/docs/build/unreleased/491.rst @@ -0,0 +1,10 @@ +.. change:: + :tags: feature, general + :tickets: 491 + + For Alembic 1.0, Python 2.6 / 3.3 support is being dropped, allowing a + fixed setup.py to be built as well as universal wheels. Pull request + courtesy Hugo. + + + diff --git a/setup.py b/setup.py index e424eb03..af0c74d2 100644 --- a/setup.py +++ b/setup.py @@ -19,11 +19,6 @@ requires = [ 'python-dateutil' ] -try: - import argparse -except ImportError: - requires.append('argparse') - class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] @@ -48,12 +43,18 @@ setup(name='alembic', version=VERSION, description="A database migration tool for SQLAlchemy.", long_description=open(readme).read(), + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'Programming Language :: Python', + '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 :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Database :: Front-Ends', diff --git a/tests/test_autogen_fks.py b/tests/test_autogen_fks.py index 569408b7..0e5f076b 100644 --- a/tests/test_autogen_fks.py +++ b/tests/test_autogen_fks.py @@ -5,7 +5,7 @@ from sqlalchemy import MetaData, Column, Table, Integer, String, \ ForeignKeyConstraint from alembic.testing import eq_ -py3k = sys.version_info >= (3, ) +py3k = sys.version_info.major >= 3 from ._autogen_fixtures import AutogenFixtureTest