diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0a7ad1..eb77fa4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,9 +16,9 @@ jobs: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f0b3fff..c08b16f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,14 +9,14 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] - django-version: ['2.2', '3.0', '3.1', '3.2', '4.0', 'main'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + django-version: ['3.2', '4.0', '4.1', '4.2', '5.0', 'main'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -26,7 +26,7 @@ jobs: echo "::set-output name=dir::$(pip cache dir)" - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.pip-cache.outputs.dir }} key: @@ -37,6 +37,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + python -m pip install --upgrade setuptools wheel python -m pip install --upgrade tox tox-gh-actions - name: Tox tests @@ -46,6 +47,6 @@ jobs: DJANGO: ${{ matrix.django-version }} - name: Upload coverage - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: name: Python ${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a62c209 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +repos: [] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 0b8bf65..19235ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,11 @@ cache: pip install: travis_retry pip install coveralls tox tox-travis script: tox -v python: - - 3.6 - - 3.7 - 3.8 + - 3.9 + - 3.10 + - 3.11 + - 3.12 after_script: - coveralls jobs: @@ -13,7 +15,7 @@ jobs: include: - stage: deploy env: - python: 3.7 + python: 3.8 script: skip deploy: provider: pypi diff --git a/CHANGES.rst b/CHANGES.rst index 4e2c1d2..dce7651 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,16 @@ Changes (unreleased) ------------------ + +1.7.0 (2024-03-13) +------------------ + +- Dropped support for Python 3.6 and 3.7! [medbenmakhlouf] +- Dropped support for Django 2.2, 3.0 and 3.1! [medbenmakhlouf] +- Add support for Python 3.10, 3.11 and 3.12. [medbenmakhlouf] +- Add Support for Django 4.1, 4.2 and 5.0! [medbenmakhlouf] + + 1.6.0 (2022-07-13) ------------------ diff --git a/requirements.txt b/requirements.txt index 68fe3f8..547e56d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,7 @@ -e . -pytest==4.6.8 -pytest-cov==2.8.1 -pytest-django==3.7.0 -pytest-pythonpath==0.7.3 +pytest==7.4.4 +pytest-cov==2.10.0 +pytest-django==4.6.0 pytest-sugar==0.9.2 recommonmark==0.6.0 -sphinx_rtd_theme==0.4.3 +sphinx-rtd-theme==2.0.0 diff --git a/setup.py b/setup.py index c71813d..1912e77 100644 --- a/setup.py +++ b/setup.py @@ -16,19 +16,20 @@ url="https://github.com/jazzband/django-smart-selects", packages=find_packages(), include_package_data=True, - python_requires=">=3.6", - install_requires=["django>=2.2"], + python_requires=">=3.8", + install_requires=["django>=3.2"], classifiers=[ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Framework :: Django", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", "Framework :: Django :: 3.2", "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", ], ) diff --git a/smart_selects/__init__.py b/smart_selects/__init__.py index 0bda8a3..928a0aa 100644 --- a/smart_selects/__init__.py +++ b/smart_selects/__init__.py @@ -1,7 +1,4 @@ -from pkg_resources import get_distribution, DistributionNotFound +from importlib.metadata import version + +__version__ = version("django-smart-selects") -try: - __version__ = get_distribution("django-smart-selects").version -except DistributionNotFound: - # package is not installed - __version__ = None diff --git a/smart_selects/form_fields.py b/smart_selects/form_fields.py index bb28f5d..78d6b5f 100644 --- a/smart_selects/form_fields.py +++ b/smart_selects/form_fields.py @@ -1,3 +1,4 @@ +import django from django.apps import apps from django.forms.models import ModelChoiceField, ModelMultipleChoiceField from django.forms import ChoiceField @@ -59,7 +60,10 @@ def _get_choices(self): choices = super(ChainedModelChoiceField, self)._get_choices() return choices - choices = property(_get_choices, ChoiceField._set_choices) + if django.VERSION >= (5, 0): + choices = property(_get_choices, ChoiceField.choices) + else: + choices = property(_get_choices, ChoiceField._set_choices) class ChainedManyToManyField(ModelMultipleChoiceField): @@ -143,4 +147,7 @@ def _get_choices(self): def make_choice(self, obj): return (obj.pk, " " + self.label_from_instance(obj)) - choices = property(_get_choices, ChoiceField._set_choices) + if django.VERSION >= (5, 0): + choices = property(_get_choices, ChoiceField.choices) + else: + choices = property(_get_choices, ChoiceField._set_choices) diff --git a/tox.ini b/tox.ini index 47c65b4..0813055 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,9 @@ [tox] envlist = - py{36,37,38,39}-dj{22,30,31,32} - py{38,39,310}-dj{40,main} + py{38,39,310}-dj{32,40} + py{38,39,310,311}-dj{41} + py{38,39,310,311,312}-dj{42} + py{310,311,312}-dj{50,main} flake8 [testenv] @@ -9,11 +11,11 @@ usedevelop = True ignore_outcome = djmain: True deps = - dj22: django>=2.2,<3.0 - dj30: django>=3.0,<3.1 - dj31: Django>=3.1,<3.2 dj32: Django>=3.2,<4.0 dj40: Django>=4.0,<4.1 + dj41: Django>=4.1,<4.2 + dj42: Django>=4.2,<5.0 + dj50: Django>=5.0,<5.1 djmain: https://github.com/django/django/archive/main.tar.gz coverage commands = @@ -30,17 +32,17 @@ commands = [gh-actions] python = - 3.6: py36 - 3.7: py37 3.8: py38, flake8 3.9: py39 3.10: py310 + 3.11: py311 + 3.12: py312 [gh-actions:env] DJANGO = - 2.2: dj22 - 3.0: dj30 - 3.1: dj31 3.2: dj32 4.0: dj40 + 4.1: dj41 + 4.2: dj42 + 5.0: dj50 main: djmain