From 085048d22b440a8bbd4b0b3239976dff658ed535 Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Sat, 23 Oct 2021 00:23:05 +0200 Subject: [PATCH] Drop Py2.7, 3.5 and Django 1.11, 2.0, 2.1, 3.0 --- CHANGELOG.md | 5 +++++ django_migration_linter/migration_linter.py | 9 +-------- docs/internals/publishing.md | 2 +- setup.py | 12 +----------- tests/functional/test_cache.py | 7 +------ tests/functional/test_makemigrations_command.py | 16 +++------------- tox.ini | 14 +++----------- 7 files changed, 15 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 212626e..d1ec8e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.0.0 + +- Drop support for Python 2.7 and 3.5 +- Drop support for Django 1.11, 2.0, 2.1, 3.0 + ## 3.0.1 Fixed bug: diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py index 73156dc..be9c992 100644 --- a/django_migration_linter/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -5,7 +5,6 @@ import inspect import logging import os import re -import sys from enum import Enum, unique from subprocess import PIPE, Popen @@ -26,8 +25,6 @@ from .utils import clean_bytes_to_str, get_migration_abspath, split_migration_pa logger = logging.getLogger("django_migration_linter") -PY2 = sys.version_info[0] == 2 - @unique class MessageType(Enum): @@ -465,11 +462,7 @@ class MigrationLinter(object): warning.append(issue) # Detect warning for argument naming convention - args_spec = ( - inspect.getargspec(runpython.code) - if PY2 - else inspect.getfullargspec(runpython.code) - ) + args_spec = inspect.getfullargspec(runpython.code) if tuple(args_spec.args) != EXPECTED_DATA_MIGRATION_ARGS: issue = { "code": "RUNPYTHON_ARGS_NAMING_CONVENTION", diff --git a/docs/internals/publishing.md b/docs/internals/publishing.md index 177810a..6d4fd85 100644 --- a/docs/internals/publishing.md +++ b/docs/internals/publishing.md @@ -3,5 +3,5 @@ A small note on how the linter is usually published to PyPi: - `python3 setup.py sdist bdist_wheel --universal` -- `twine upload dist/django_migration_linter-X.Y.Z-py2.py3-none-any.whl dist/django-migration-linter-X.Y.Z.tar.gz` +- `twine upload dist/django_migration_linter-X.Y.Z-py3-none-any.whl dist/django-migration-linter-X.Y.Z.tar.gz` diff --git a/setup.py b/setup.py index 11c5ec8..25eb39c 100644 --- a/setup.py +++ b/setup.py @@ -32,9 +32,8 @@ setup( license="Apache License 2.0", packages=find_packages(include=["django_migration_linter*"]), install_requires=[ - "django>=1.11", + "django>=2.2", "appdirs>=1.4.3", - 'enum34>=1.1.6;python_version<"3.4"', "toml>=0.10.2", ], extras_require={ @@ -43,8 +42,6 @@ setup( "mysqlclient>=1.4.6,<2", "psycopg2-binary>=2.8.5,<2.9", "django_add_default_value>=0.4.0", - 'mock>=3.0.5;python_version<"3.3"', - 'backports.tempfile>=1.0;python_version<="2.7"', "coverage>=5.5", ], }, @@ -54,18 +51,11 @@ setup( "Intended Audience :: Developers", "Environment :: Web Environment", "Framework :: Django", - "Framework :: Django :: 1.11", - "Framework :: Django :: 2.0", - "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", - "Framework :: Django :: 3.0", "Framework :: Django :: 3.1", "Framework :: Django :: 3.2", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", diff --git a/tests/functional/test_cache.py b/tests/functional/test_cache.py index 3b0d6ef..7876851 100644 --- a/tests/functional/test_cache.py +++ b/tests/functional/test_cache.py @@ -1,6 +1,6 @@ import os -import sys import unittest +import unittest.mock as mock from django.conf import settings from django.db.migrations import Migration @@ -12,11 +12,6 @@ from django_migration_linter import ( get_migration_abspath, ) -if sys.version_info >= (3, 3): - import unittest.mock as mock -else: - import mock - class OperationsIgnoreMigration(Migration): operations = [IgnoreMigration()] diff --git a/tests/functional/test_makemigrations_command.py b/tests/functional/test_makemigrations_command.py index 278c6a0..c1978a0 100644 --- a/tests/functional/test_makemigrations_command.py +++ b/tests/functional/test_makemigrations_command.py @@ -1,20 +1,10 @@ import os import shutil -import sys +import tempfile +import unittest.mock as mock from contextlib import contextmanager from importlib import import_module - -if sys.version_info >= (3, 3): - import unittest.mock as mock -else: - import mock - -if sys.version_info.major >= 3: - import tempfile - from io import StringIO as StringIO -else: - from backports import tempfile - from io import BytesIO as StringIO +from io import StringIO from django.apps import apps from django.conf import settings diff --git a/tox.ini b/tox.ini index c4ae97a..ec73790 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,12 @@ [tox] envlist = - py27-django111 - py{35,36,37,38}-django{111,20,21} - py{35,36,37,38,39}-django22 - py{36,37,38,39}-django{30,31,32} + py{36,37,38,39}-django22 + py{36,37,38,39}-django{31,32} lint coverage [gh-actions] python = - 2.7: py27 - 3.5: py35 3.6: py36 3.7: py37 3.8: py38 @@ -21,16 +17,12 @@ commands = ./manage.py test --no-input {posargs} extras = test pip_pre = true deps = - django111: django>=1.11,<2.0 - django20: django>=2.0,<2.1 - django21: django>=2.1,<2.2 django22: django>=2.2,<2.3 - django30: django>=3.0,<3.1 django31: django>=3.1,<3.2 django32: django>=3.2,<3.3 [testenv:lint] -basepython = python3.6 +basepython = python3.8 deps = -r requirements/dev.txt commands =