diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f367713..640bf1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,14 +11,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.x - name: Install dependencies run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a01614..20b5bc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,9 @@ name: Test on: [push, pull_request] +env: + FORCE_COLOR: 1 + jobs: build: runs-on: ubuntu-latest @@ -9,7 +12,7 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12-dev'] services: postgres: @@ -27,10 +30,10 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -40,7 +43,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: @@ -64,6 +67,6 @@ jobs: DB_PORT: 5432 - 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 index 327897b..d00ba3d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: files: ^(model_utils|tests)/ - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.6.0 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py38-plus] diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..d4eb136 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,18 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +# Project page: https://readthedocs.org/projects/django-model-utils/ + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3" + +python: + install: + - method: pip + path: . + +sphinx: + configuration: docs/conf.py diff --git a/CHANGES.rst b/CHANGES.rst index df8c3b6..d0cf47f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,11 @@ Changelog To be released -------- -Swedish translation (GH-#561) +- Confirm support for `Django 4.2` +- Add support for `Python 3.11` (GH-#545) +- Add support for `Python 3.12` (GH-#545) +- Drop support for `Python 3.7` (GH-#545) +- Swedish translation (GH-#561) 4.3.1 (2022-11-15) ------------------ diff --git a/docs/conf.py b/docs/conf.py index 0d47d51..fbab4aa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ # serve to show the default. import os -from pkg_resources import get_distribution +import importlib.metadata # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -49,7 +49,8 @@ parent_dir = os.path.dirname(os.path.dirname(__file__)) # |version| and |release|, also used in various other places throughout the # built documents. # -release = get_distribution('django-model-utils').version +release = importlib.metadata.version('django-model-utils') + # for example take major/minor version = '.'.join(release.split('.')[:2]) diff --git a/model_utils/__init__.py b/model_utils/__init__.py index 691cf5c..8b02a0e 100644 --- a/model_utils/__init__.py +++ b/model_utils/__init__.py @@ -1,10 +1,10 @@ -from pkg_resources import DistributionNotFound, get_distribution +import importlib.metadata from .choices import Choices # noqa:F401 from .tracker import FieldTracker, ModelTracker # noqa:F401 try: - __version__ = get_distribution("django-model-utils").version -except DistributionNotFound: # pragma: no cover + __version__ = importlib.metadata.version('django-model-utils') +except importlib.metadata.PackageNotFoundError: # pragma: no cover # package is not installed __version__ = None diff --git a/requirements-test.txt b/requirements-test.txt index 62ed4cc..138b0de 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ pytest==6.2.5 pytest-django==3.10.0 -psycopg2-binary==2.8.6 +psycopg2-binary==2.9.5 pytest-cov==2.10.1 diff --git a/setup.py b/setup.py index 2c6f855..566bdba 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup( maintainer='JazzBand', url='https://github.com/jazzband/django-model-utils', packages=find_packages(exclude=['tests*']), - python_requires=">=3.7", + python_requires=">=3.8", install_requires=['Django>=3.2'], classifiers=[ 'Development Status :: 5 - Production/Stable', @@ -39,14 +39,16 @@ setup( 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - '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 :: 3.2', 'Framework :: Django :: 4.0', 'Framework :: Django :: 4.1', + 'Framework :: Django :: 4.2', ], zip_safe=False, package_data={ diff --git a/tox.ini b/tox.ini index b4e1713..eb0c961 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = py{37,38,39,310}-dj32 - py{38,39,310}-dj{40,41,main} + py{38,39,310,311,312}-dj{40,41,42,main} flake8 isort @@ -11,6 +11,8 @@ python = 3.8: py38, flake8, isort 3.9: py39 3.10: py310 + 3.11: py311 + 3.12: py312 [testenv] deps = @@ -19,6 +21,7 @@ deps = dj32: Django==3.2.* dj40: Django==4.0.* dj41: Django==4.1.* + dj42: Django==4.2.* djmain: https://github.com/django/django/archive/main.tar.gz ignore_outcome = djmain: True @@ -26,6 +29,7 @@ ignore_errors = djmain: True passenv = CI + FORCE_COLOR GITHUB_* DB_* usedevelop = True