Drop Python 2.7 and Dj 1.11

This commit is contained in:
Andrew-Chen-Wang 2020-06-18 09:28:00 -04:00
parent f82e892ad5
commit 6e22dc7f58
30 changed files with 28 additions and 130 deletions

1
.gitignore vendored
View file

@ -59,7 +59,6 @@ coverage.xml
local_settings.py
db.sqlite3
db.sqlite3-journal
.idea/
# Flask stuff:
instance/

View file

@ -2,18 +2,16 @@ language: python
services:
- memcached
- redis-server
- redis
- mysql
- postgresql
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
env:
- DJANGO="1.11"
- DJANGO="2.0"
- DJANGO="2.1"
- DJANGO="2.2"
@ -21,27 +19,14 @@ env:
matrix:
exclude:
- python: 2.7
env: DJANGO=2.0
- python: 2.7
env: DJANGO=2.1
- python: 2.7
env: DJANGO=2.2
- python: 2.7
env: DJANGO=3.0
- python: 3.5
env: DJANGO=3.0
- python: 3.8
env: DJANGO=1.11
- python: 3.8
env: DJANGO=2.0
- python: 3.8
env: DJANGO=2.1
sudo: false
cache: pip
install: pip install tox tox-travis coveralls

View file

@ -1,6 +1,11 @@
Whats new in django-cachalot?
==============================
2.3.0
-----
- Drop support for Django 1.11 and Python 2.7
2.2.0
-----

View file

@ -1,5 +1,3 @@
**New Maintainer**: `Andrew Chen Wang`_ is a new maintainer of this repo. Bordage is still the admin but will most likely be inactive.
Django Cachalot
===============
@ -27,11 +25,7 @@ Documentation: http://django-cachalot.readthedocs.io
Quickstart
----------
Cachalot officially supports Python 2.7, 3.4-3.8 and Django 1.11, 2.0-2.2, 3.0 with the databases PostgreSQL, SQLite, and MySQL.
Note 1: Python 3.4 with MySQL fails on tests. If your MySQL is configured correctly, then it may work.
Note 2: Python 3.5 with Django 1.11 in tests prove to occasionally have performance issues.
Cachalot officially supports Python 3.5-3.8 and Django 2.0-2.2, 3.0 with the databases PostgreSQL, SQLite, and MySQL.
Third-Party Cache Comparison
----------------------------

View file

@ -1,7 +1,3 @@
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals, print_function
from collections import OrderedDict
import io
import os

View file

@ -1,14 +1,6 @@
# coding: utf-8
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.db import connections
try:
from django.utils.six import string_types
except ImportError:
from six import string_types
from .cache import cachalot_caches
from .settings import cachalot_settings
@ -34,12 +26,12 @@ def _cache_db_tables_iterator(tables, cache_alias, db_alias):
def _get_tables(tables_or_models):
for table_or_model in tables_or_models:
if isinstance(table_or_model, string_types) and '.' in table_or_model:
if isinstance(table_or_model, str) and '.' in table_or_model:
try:
table_or_model = apps.get_model(table_or_model)
except LookupError:
pass
yield (table_or_model if isinstance(table_or_model, string_types)
yield (table_or_model if isinstance(table_or_model, str)
else table_or_model._meta.db_table)

View file

@ -1,5 +1,3 @@
from __future__ import unicode_literals
from django import __version__ as django__version__, VERSION as django_version
from django.apps import AppConfig
from django.conf import settings
@ -13,7 +11,7 @@ from .settings import (
@register(Tags.compatibility)
def check_django_version(app_configs, **kwargs):
if not (1, 11) <= django_version < (3, 1):
if not (2, 0) <= django_version < (3, 1):
return [Error(
'Django %s is not compatible with this version of django-cachalot.'
% django__version__,

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from collections import defaultdict
from threading import local

View file

@ -1,7 +1,5 @@
# coding: utf-8
from __future__ import unicode_literals
from collections import Iterable
from functools import wraps
from time import time
from django.db.backends.utils import CursorWrapper
@ -12,11 +10,6 @@ from django.db.models.sql.compiler import (
)
from django.db.transaction import Atomic, get_connection
try:
from django.utils.six import binary_type, wraps
except ImportError:
from six import binary_type, wraps
from .api import invalidate
from .cache import cachalot_caches
from .settings import cachalot_settings, ITERABLES
@ -129,7 +122,7 @@ def _patch_cursor():
finally:
connection = cursor.db
if getattr(connection, 'raw', True):
if isinstance(sql, binary_type):
if isinstance(sql, bytes):
sql = sql.decode('utf-8')
sql = sql.lower()
if 'update' in sql or 'insert' in sql or 'delete' in sql \

View file

@ -1,13 +1,10 @@
# coding: utf-8
from __future__ import unicode_literals
from collections import defaultdict
from datetime import datetime
from debug_toolbar.panels import Panel
from django.apps import apps
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils.timesince import timesince
from .cache import cachalot_caches

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from django.dispatch import Signal

View file

@ -1,7 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.postgres.fields import (
ArrayField, HStoreField, IntegerRangeField, JSONField, FloatRangeField,

View file

@ -1,7 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.postgres.fields import (
ArrayField, HStoreField,

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from unittest import skipIf
from django import VERSION as DJANGO_VERSION

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from datetime import date, datetime
from decimal import Decimal
from unittest import skipUnless

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
import datetime
from unittest import skipIf
from uuid import UUID

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from time import sleep
from unittest import skipIf

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from unittest import skipIf
from django.conf import settings

View file

@ -1,10 +1,6 @@
from django import VERSION as DJANGO_VERSION
from django.core.management.color import no_style
from django.db import connection, transaction
try:
from django.utils.six import string_types
except ImportError:
from six import string_types
from .models import PostgresModel
from ..utils import _get_tables
@ -35,7 +31,7 @@ class TestUtilsMixin:
connection.cursor()
def assert_tables(self, queryset, *tables):
tables = {table if isinstance(table, string_types)
tables = {table if isinstance(table, str)
else table._meta.db_table for table in tables}
self.assertSetEqual(_get_tables(queryset.db, queryset.query), tables)

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from threading import Thread
from django.db import connection, transaction

View file

@ -1,7 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import transaction, connection, IntegrityError
from django.test import TransactionTestCase, skipUnlessDBFeature

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from unittest import skipIf, skipUnless
from django import VERSION as DJANGO_VERSION

View file

@ -1,7 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
from .settings import cachalot_settings

View file

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
import datetime
from decimal import Decimal
from hashlib import sha1
@ -13,10 +10,6 @@ from django.db.models import QuerySet, Subquery, Exists
from django.db.models.functions import Now
from django.db.models.sql import Query, AggregateQuery
from django.db.models.sql.where import ExtraWhere, WhereNode, NothingNode
try:
from django.utils.six import text_type, binary_type, integer_types
except ImportError:
from six import text_type, binary_type, integer_types
from .settings import ITERABLES, cachalot_settings
from .transaction import AtomicCache
@ -31,10 +24,9 @@ class IsRawQuery(Exception):
CACHABLE_PARAM_TYPES = {
bool, int, float, Decimal, bytearray, binary_type, text_type, type(None),
bool, int, float, Decimal, bytearray, bytes, str, type(None),
datetime.date, datetime.time, datetime.datetime, datetime.timedelta, UUID,
}
CACHABLE_PARAM_TYPES.update(integer_types) # Adds long for Python 2
UNCACHABLE_FUNCS = {Now, TransactionNow}
try:
@ -79,7 +71,7 @@ def get_query_cache_key(compiler):
sql, params = compiler.as_sql()
check_parameter_types(params)
cache_key = '%s:%s:%s' % (compiler.using, sql,
[text_type(p) for p in params])
[str(p) for p in params])
return sha1(cache_key.encode('utf-8')).hexdigest()

View file

@ -21,7 +21,7 @@ Caches your Django ORM queries and automatically invalidates them.
:target: https://scrutinizer-ci.com/g/noripyt/django-cachalot/
.. image:: https://img.shields.io/badge/cachalot-Chat%20on%20Slack-green?style=flat&logo=slack
:target: https://join.slack.com/t/cachalotdjango/shared_invite/enQtOTMyNzI0NTQzOTA3LWViYmYwMWY3MmU0OTZkYmNiMjBhN2NjNjc4OWVlZDNiMjMxN2Y3YzljYmNiYTY4ZTRjOGQxZDRiMTM0NWE3NGI
:target: https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw
Usage
.....

View file

@ -4,15 +4,15 @@ Quick start
Requirements
............
- Django 1.11, 2.0-2.2, or 3.0
- Python 2.7, 3.4-3.8
- Django 2.0-2.2, or 3.0
- Python 3.5-3.8
- a cache configured as ``'default'`` with one of these backends:
- `django-redis <https://github.com/niwinz/django-redis>`_
- `memcached <https://docs.djangoproject.com/en/2.0/topics/cache/#memcached>`_
- `memcached <https://docs.djangoproject.com/en/dev/topics/cache/#memcached>`_
(using either python-memcached or pylibmc)
- `filebased <https://docs.djangoproject.com/en/2.0/topics/cache/#filesystem-caching>`_
- `locmem <https://docs.djangoproject.com/en/2.0/topics/cache/#local-memory-caching>`_
- `filebased <https://docs.djangoproject.com/en/dev/topics/cache/#filesystem-caching>`_
- `locmem <https://docs.djangoproject.com/en/dev/topics/cache/#local-memory-caching>`_
(but its not shared between processes, see :ref:`locmem limits <Locmem>`)
- one of these databases:

View file

@ -7,7 +7,7 @@ Bug reports, questions, discussion, new features
`on GitHub <https://github.com/noripyt/django-cachalot/issues>`_
- If you have **a question** on how django-cachalot works
or to **simply discuss**,
`chat with us on Slack <https://join.slack.com/t/cachalotdjango/shared_invite/enQtOTMyNzI0NTQzOTA3LWViYmYwMWY3MmU0OTZkYmNiMjBhN2NjNjc4OWVlZDNiMjMxN2Y3YzljYmNiYTY4ZTRjOGQxZDRiMTM0NWE3NGI>`_.
`chat with us on Slack <https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw>`_.
- If you want **to add a feature**:
- if you have an idea on how to implement it, you can fork the project
@ -15,4 +15,4 @@ Bug reports, questions, discussion, new features
someone else could already be working on it
- if youre sure that its a must-have feature, open an issue
- if its just a vague idea, please
`ask on Slack <https://join.slack.com/t/cachalotdjango/shared_invite/enQtOTMyNzI0NTQzOTA3LWViYmYwMWY3MmU0OTZkYmNiMjBhN2NjNjc4OWVlZDNiMjMxN2Y3YzljYmNiYTY4ZTRjOGQxZDRiMTM0NWE3NGI>`_ first
`ask on Slack <https://join.slack.com/t/cachalotdjango/shared_invite/zt-dd0tj27b-cIH6VlaSOjAWnTG~II5~qw>`_ first

View file

@ -1,2 +1 @@
Django>=1.11
six>=1.13
Django>=2

View file

@ -26,16 +26,16 @@ setup(
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Internet :: WWW/HTTP',
],
license='BSD',

View file

@ -1,6 +1,5 @@
[tox]
envlist =
py{27,35,36,37}-django1.11-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{35,36,37}-django2.0-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{35,36,37}-django2.1-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{35,36,37,38}-django2.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
@ -8,13 +7,11 @@ envlist =
[testenv]
basepython =
py27: python2.7
py35: python3.5
py36: python3.6
py37: python3.7
py38: python3.8
deps =
django1.11: Django>=1.11,<1.12
django2.0: Django>=2.0,<2.1
django2.1: Django>=2.1,<2.2
django2.2: Django>=2.2,<2.3
@ -29,7 +26,6 @@ deps =
django-debug-toolbar
beautifulsoup4
coverage
six
setenv =
sqlite3: DB_ENGINE=sqlite3
postgresql: DB_ENGINE=postgresql
@ -44,7 +40,6 @@ commands =
[travis:env]
DJANGO =
1.11: django1.11
2.0: django2.0
2.1: django2.1
2.2: django2.2