diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1aad0d0..2d954e08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: matrix: os: [ubuntu-20.04] python-version: ['3.8'] - toxenv: [django22, django30, django31, django32, quality, docs, without-django] + toxenv: [quality, docs, without-django, django32, django40] steps: - uses: actions/checkout@v2 @@ -36,7 +36,7 @@ jobs: run: tox -- --hypothesis-profile=ci - name: Run Coverage - if: matrix.python-version == '3.8' && matrix.toxenv=='django22' + if: matrix.python-version == '3.8' && matrix.toxenv=='django32' uses: codecov/codecov-action@v1 with: flags: unittests diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5dcbf3d0..8d92f0c2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,7 @@ +# 2.3.0 + +* Added Support for Django40 and removed Django22, 30 and 31 + # 2.2.2 * Moved django pin from django.in to constraint.txt. Upgraded dependencies diff --git a/opaque_keys/__init__.py b/opaque_keys/__init__.py index fce7bf75..50d00270 100644 --- a/opaque_keys/__init__.py +++ b/opaque_keys/__init__.py @@ -8,12 +8,12 @@ """ from abc import ABCMeta, abstractmethod from functools import total_ordering -from stevedore.enabled import EnabledExtensionManager # pylint: disable=wrong-import-order from _collections import defaultdict +from stevedore.enabled import EnabledExtensionManager -__version__ = '2.2.2' +__version__ = '2.3.0' class InvalidKeyError(Exception): diff --git a/opaque_keys/edx/django/models.py b/opaque_keys/edx/django/models.py index 1dd52daa..321ef9f2 100644 --- a/opaque_keys/edx/django/models.py +++ b/opaque_keys/edx/django/models.py @@ -2,6 +2,7 @@ Useful django models for implementing XBlock infrastructure in django. If Django is unavailable, none of the classes below will work as intended. """ +# pylint: disable=abstract-method import logging import warnings @@ -27,6 +28,7 @@ class _Creator: A placeholder class that provides a way to set the attribute on the model. """ + def __init__(self, field): self.field = field @@ -45,6 +47,7 @@ class CreatorMixin: Mixin class to provide SubfieldBase functionality to django fields. See: https://docs.djangoproject.com/en/1.11/releases/1.8/#subfieldbase """ + def contribute_to_class(self, cls, name, *args, **kwargs): super().contribute_to_class(cls, name, *args, **kwargs) setattr(cls, name, _Creator(self)) @@ -168,6 +171,7 @@ class OpaqueKeyFieldEmptyLookupIsNull(IsNull): This overrides the default __isnull model filter to help enforce the special way we handle null / empty values in OpaqueKeyFields. """ + def get_prep_lookup(self): raise TypeError("Use this field's .Empty member rather than None or __isnull " "to query for missing objects of this type.") @@ -214,6 +218,7 @@ class LocationKeyField(UsageKeyField): """ A django Field that stores a UsageKey object as a string. """ + def __init__(self, *args, **kwargs): warnings.warn("LocationKeyField is deprecated. Please use UsageKeyField instead.", stacklevel=2) super().__init__(*args, **kwargs) diff --git a/setup.py b/setup.py index 35ac52ed..b6160a5a 100644 --- a/setup.py +++ b/setup.py @@ -5,9 +5,6 @@ import os import re -import os -import re - from setuptools import find_packages, setup @@ -106,10 +103,8 @@ def get_version(*file_paths): "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Framework :: Django", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", ], # We are including the tests because other libraries do use mixins from them. packages=find_packages(), diff --git a/tox.ini b/tox.ini index 42efa097..149f9a95 100644 --- a/tox.ini +++ b/tox.ini @@ -1,37 +1,33 @@ [tox] -envlist = py38-django{22,30,31,32},quality,without-django +envlist = py38-django{32,40},quality,without-django skip_missing_interpreters = True [testenv] -deps = - django22: Django>=2.2,<2.3 - django30: Django>=3.0,<3.1 - django31: Django>=3.1,<3.2 - django32: Django>=3.2,<3.3 - -r{toxinidir}/requirements/django-test.txt -commands = pytest --disable-pytest-warnings --nomigrations {posargs} +deps = + django32: Django>=3.2,<4.0 + django40: Django>=4.0,<4.1 + -r{toxinidir}/requirements/django-test.txt +commands = pytest -v --disable-pytest-warnings --nomigrations {posargs} [testenv:without-django] -deps = - -r{toxinidir}/requirements/test.txt +deps = + -r{toxinidir}/requirements/test.txt commands = pytest --disable-pytest-warnings --ignore=opaque_keys/edx/django {posargs} [testenv:quality] -commands = - pycodestyle --config=.pep8 opaque_keys - pylint --rcfile=pylintrc opaque_keys +commands = + pycodestyle --config=.pep8 opaque_keys + pylint --rcfile=pylintrc opaque_keys [testenv:docs] -deps = +deps = -r{toxinidir}/requirements/doc.txt -allowlist_externals = +allowlist_externals = make env -setenv = -# -W will treat warnings as errors. +setenv = SPHINXOPTS = -W -commands = -# -e allows for overriding setting from the environment. -# -C changes the directory to `docs` before running the command. +commands = make -e -C docs clean make -e -C docs html +