From 2f6df048808381a6d2d57d4ef0479ac6a1eb8af5 Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Sat, 17 Aug 2024 00:47:12 +0530 Subject: [PATCH 1/4] [deps/ci] QA reformat, updated CI, updated deps - Formatted code with black - Updated CI configuration (consistent with other OpenWISP repos) - PostgreSQL 15 for testing - Upgraded psycopg2~=2.9.0 - Dropped support for EOL Python and Django versions - Dropped support for Python 3.6 and 3.7 - Dropped support for Django 2.2, 3.0, 3.1 and 4.0 - Dropped support for djangorestframework < 3.12 - Pinned djangorestframework>=3.12,<3.15 and django-filters~=23.5 - Added Django 5.0, Django 5.1 & DRF 3.15.X to tox conf - Added GitHub workflow for publishing PyPI packages --------- Signed-off-by: Gagan Deep --- .coveragerc | 3 - .github/dependabot.yml | 6 + .github/workflows/ci.yml | 128 +++++------ .github/workflows/pypi.yml | 32 +++ CHANGES.rst | 211 ++++++++++++------ CONTRIBUTING.rst | 7 +- Dockerfile | 2 +- README.rst | 1 + docker-compose.yml | 4 +- performance_tests.rst | 9 +- pyproject.toml | 22 ++ requirements-test.txt | 5 +- rest_framework_gis/fields.py | 2 +- setup.cfg | 7 - setup.py | 22 +- .../migrations/0001_initial.py | 1 - .../migrations/0002_nullable.py | 1 - .../migrations/0004_auto_20240228_2357.py | 1 - .../test_schema_generation.py | 9 - tox.ini | 21 +- 20 files changed, 302 insertions(+), 192 deletions(-) delete mode 100644 .coveragerc create mode 100644 .github/workflows/pypi.yml create mode 100644 pyproject.toml diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 2c81a869..00000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -omit = - /*/__init__.py diff --git a/.github/dependabot.yml b/.github/dependabot.yml index db958279..f91a6bd1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,9 @@ updates: interval: "monthly" commit-message: prefix: "[deps] " + - package-ecosystem: "github-actions" # Check for GitHub Actions updates + directory: "/" + schedule: + interval: "monthly" # Check for updates weekly + commit-message: + prefix: "[ci] " diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2725c881..0b952cdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: services: postgres: - image: postgis/postgis:10-2.5 + image: postgis/postgis:15-3.4-alpine env: POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres @@ -29,97 +29,89 @@ jobs: fail-fast: false matrix: env: - - python: 3.6 - TOXENV: py36-django22-djangorestframework310 - - python: 3.7 - TOXENV: py37-django22-djangorestframework310 - - python: 3.8 - TOXENV: py38-django22-djangorestframework310 - - python: 3.9 - TOXENV: py39-django22-djangorestframework310 - - python: 3.6 - TOXENV: py36-django22-djangorestframework312 - - python: 3.7 - TOXENV: py37-django22-djangorestframework312 - - python: 3.8 - TOXENV: py38-django22-djangorestframework312 - - python: 3.9 - TOXENV: py39-django22-djangorestframework312 - - python: 3.6 - TOXENV: py36-django30-djangorestframework312 - - python: 3.7 - TOXENV: py37-django30-djangorestframework312 - - python: 3.8 - TOXENV: py38-django30-djangorestframework312 - - python: 3.9 - TOXENV: py39-django30-djangorestframework312 - - python: 3.6 - TOXENV: py36-django31-djangorestframework312 - - python: 3.7 - TOXENV: py37-django31-djangorestframework312 - - python: 3.8 - TOXENV: py38-django31-djangorestframework312 - - python: 3.9 - TOXENV: py39-django31-djangorestframework312 - - python: 3.7 - TOXENV: py37-django32-djangorestframework312 - - python: 3.8 + - python: '3.8' TOXENV: py38-django32-djangorestframework312 - - python: 3.9 + - python: '3.8' + TOXENV: py38-django32-djangorestframework313 + - python: '3.8' + TOXENV: py38-django32-djangorestframework314 + - python: '3.8' + TOXENV: py38-django42-djangorestframework314 + - python: '3.9' TOXENV: py39-django32-djangorestframework312 - - python: 3.8 - TOXENV: py38-django40-djangorestframework313 - - python: 3.9 - TOXENV: py39-django40-djangorestframework313 + - python: '3.9' + TOXENV: py39-django32-djangorestframework313 + - python: '3.9' + TOXENV: py39-django32-djangorestframework314 + - python: '3.9' + TOXENV: py39-django42-djangorestframework314 + - python: '3.10' + TOXENV: py310-django32-djangorestframework312 + - python: '3.10' + TOXENV: py310-django32-djangorestframework313 + - python: '3.10' + TOXENV: py310-django32-djangorestframework314 + - python: '3.10' + TOXENV: py310-django42-djangorestframework314 + - python: '3.11' + TOXENV: py311-django42-djangorestframework314 + - python: '3.11' + TOXENV: py311-django50-djangorestframework315 + - python: '3.12' + TOXENV: py312-django50-djangorestframework315 + - python: '3.11' + TOXENV: py311-django51-djangorestframework315 + - python: '3.12' + TOXENV: py312-django51-djangorestframework315 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python ${{ matrix.env.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.env.python }} + cache: 'pip' + cache-dependency-path: | + **/requirements*.txt - - name: Install system packages - run: | - sudo apt-get update - sudo apt-get install binutils libproj-dev gdal-bin -y - - - name: Install python dependencies + - name: Install Dependencies + id: deps run: | + sudo apt -qq update + sudo apt -qq -y install binutils libproj-dev gdal-bin pip install -U pip wheel setuptools pip install -U -r requirements-test.txt pip install tox docutils pygments twine + - name: QA checks + run: | + ./run-qa-checks + - name: Tests + if: ${{ !cancelled() && steps.deps.conclusion == 'success' }} run: | tox -e ${{ matrix.env.TOXENV }} + coverage combine + coverage xml env: POSTGRES_HOST: localhost - name: Upload Coverage - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: | - python-${{ matrix.env.env }} - COVERALLS_PARALLEL: true - - - name: QA checks - run: | - pip install "importlib-metadata<5.0" # remove when flake8 is upgraded - ./run-qa-checks + if: ${{ success() }} + uses: coverallsapp/github-action@v2 + with: + parallel: true + format: cobertura + flag-name: python-${{ matrix.env.env }} + github-token: ${{ secrets.GITHUB_TOKEN }} coveralls: - name: Finish Coveralls needs: build runs-on: ubuntu-latest - container: python:3-slim steps: - - name: Finished - run: | - pip3 install --upgrade coveralls - coveralls --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 00000000..974699e3 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,32 @@ +name: Publish Python Package to Pypi.org + +on: + release: + types: [published] + +permissions: + id-token: write + +jobs: + pypi-publish: + name: Release Python Package on Pypi.org + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/djangorestframework-gis + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Install dependencies + run: | + pip install -U pip + pip install build + - name: Build package + run: python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@v1.9.0 diff --git a/CHANGES.rst b/CHANGES.rst index 9fda27e6..42b4c597 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -27,158 +27,241 @@ Version 0.18.0 [2022-01-07] Version 0.17.0 [2021-01-25] --------------------------- -- [feature] Added - `OpenAPI Schema Generation `_ - (`#219 `_) - special - thanks to `Dhaval Mehta `_ +- [feature] Added `OpenAPI Schema Generation + `_ + (`#219 + `_) - + special thanks to `Dhaval Mehta `_ Version 0.16.0 [2020-09-07] --------------------------- -- [fix] Added support for representation of empty geometries - (`#168 `_) -- [fix] Don't override the additional arguments passed as ``style`` to ``GeometryField`` -- [feature] Added `DistanceToPointOrderingFilter `_ - (`#210 `_) +- [fix] Added support for representation of empty geometries (`#168 + `_) +- [fix] Don't override the additional arguments passed as ``style`` to + ``GeometryField`` +- [feature] Added `DistanceToPointOrderingFilter + `_ + (`#210 + `_) - [deps] Added support for django 3.1 in the CI build - [deps] Dropped django 1.11 and Python 3.5 from the CI build, - compatibility may still work but it's not guaranteed anymore, please upgrade! -- [qa] Added QA checks to CI build - (`#230 `_) + compatibility may still work but it's not guaranteed anymore, please + upgrade! +- [qa] Added QA checks to CI build (`#230 + `_) Version 0.15.0 [2019-12-09] --------------------------- - Dropped Python 3.4 support -- `#190 `_: +- `#190 + `_: Added django 2.2 on test matrix -- `#199 `_: +- `#199 + `_: Dropped Django 2.0 support -- `#195 `_: +- `#195 + `_: Updated the way that ``to_representation`` removes already processed -- `#197 `_: +- `#197 + `_: Removed six dependency -- `#202 `_: +- `#202 + `_: Updated DRF to 3.10, removed support for previous DRF versions -- `#200 `_: +- `#200 + `_: Added Django 3.0 and Python 3.8 support Version 0.14.0 [2018-12-02] --------------------------- -- `#173 `_: - added support for django 2.1, DRF 3.9 and switched to django-filters >= 2.0 - (**which requires python >= 3.4**) -- `#178 `_: +- `#173 + `_: + added support for django 2.1, DRF 3.9 and switched to django-filters >= + 2.0 (**which requires python >= 3.4**) +- `#178 + `_: simplified ``setup.py`` and tox build Version 0.13.0 [2018-04-27] --------------------------- -- `#161 `_: +- `#161 + `_: added flag to reduce precision of ``GeometryField`` -- `#164 `_: +- `#164 + `_: added compatibility with django-rest-framework 3.8 Version 0.12.0 [2017-11-12] --------------------------- -- `#138 `_: +- `#138 + `_: added support for ``GeometryCollection`` fields -- `#146 `_: +- `#146 + `_: added compatibility with django-rest-framework 3.7 -- `#147 `_: +- `#147 + `_: added support to django 2.0 beta - dropped support for django 1.7, 1.8, 1.9 and 1.10 Version 0.11.2 [2017-05-22] --------------------------- -- `eb54fc0 `_: ``GeometryFilter`` now use ``BaseGeometryWidget`` -- `33a6418 `_: fixed tests for Django 1.11: ``Point`` comparison uses ``srid`` +- `eb54fc0 + `_: + ``GeometryFilter`` now use ``BaseGeometryWidget`` +- `33a6418 + `_: + fixed tests for Django 1.11: ``Point`` comparison uses ``srid`` Version 0.11.1 [2017-05-05] --------------------------- -- `#119 `_: Added support to "__all__" fields in serializer -- `#130 `_: Added compatibility with DRF 3.6 +- `#119 + `_: + Added support to "__all__" fields in serializer +- `#130 + `_: + Added compatibility with DRF 3.6 Version 0.11.0 [2016-11-22] --------------------------- -- `#106 `_: dropped support for django 1.7 -- `#117 `_: added support for django-filter 0.15 -- `6479949 `_: fixed tests for latest DRF 3.5 version -- `35e3b87 `_: added official support to django 1.10 +- `#106 + `_: + dropped support for django 1.7 +- `#117 + `_: + added support for django-filter 0.15 +- `6479949 + `_: + fixed tests for latest DRF 3.5 version +- `35e3b87 + `_: + added official support to django 1.10 Version 0.10.1 [2016-01-06] --------------------------- -- `#93 `_ skipped a few tests if spatialite DB backend is being used -- `#95 `_ fixed misunderstanding regarding 0.9.6 DRF compatibility in README -- `#96 `_ added missing assets in python package source tarball +- `#93 `_ + skipped a few tests if spatialite DB backend is being used +- `#95 `_ + fixed misunderstanding regarding 0.9.6 DRF compatibility in README +- `#96 `_ + added missing assets in python package source tarball Version 0.10.0 [2015-12-07] --------------------------- -- `#87 `_ dropped support for old django versions and python 2.6 +- `#87 `_ + dropped support for old django versions and python 2.6 Version 0.9.6 [2015-11-02] -------------------------- -- `#82 `_: avoid ``KeyError`` id field not in ``fields`` (bug introduced in 0.9.5) -- `fbaf9b1 `_: improved documentation for new default ``id_field`` behaviour -- `#84 `_: switched to ``assertAlmostEqual`` in ``test_post_location_list_EWKT`` to ease testing for debian package -- `#85 `_: fixed serialization of properties holding ``None`` values (bug introduced in 0.9.5) -- `#86 `_: updated advertised compatibility to include **python 3.5** +- `#82 + `_: + avoid ``KeyError`` id field not in ``fields`` (bug introduced in 0.9.5) +- `fbaf9b1 + `_: + improved documentation for new default ``id_field`` behaviour +- `#84 `_: + switched to ``assertAlmostEqual`` in ``test_post_location_list_EWKT`` to + ease testing for debian package +- `#85 `_: + fixed serialization of properties holding ``None`` values (bug + introduced in 0.9.5) +- `#86 `_: + updated advertised compatibility to include **python 3.5** Version 0.9.5 [2015-10-12] -------------------------- -- `#71 `_: added possibility to override GeoJSON properties in ``GeoFeatureModelSerializer`` -- `52e15a5 `_: Added default ``page_size_query_param`` in ``GeoJsonPagination`` +- `#71 `_: + added possibility to override GeoJSON properties in + ``GeoFeatureModelSerializer`` +- `52e15a5 + `_: + Added default ``page_size_query_param`` in ``GeoJsonPagination`` Version 0.9.4 [2015-09-08] -------------------------- -- `#68 `_: ensure not having drf-gis in ``INSTALLED_APPS`` works anyway -- `#76 `_: avoid pickle errors in ``GeoJsonDict`` -- `#75 `_: return ``GEOSGeometry`` instead of geojson property +- `#68 + `_: + ensure not having drf-gis in ``INSTALLED_APPS`` works anyway +- `#76 + `_: + avoid pickle errors in ``GeoJsonDict`` +- `#75 `_: + return ``GEOSGeometry`` instead of geojson property Version 0.9.3 [2015-07-22] -------------------------- -- `04fd1bf `_: Added ``GeoJsonPagination`` -- `fe47d86 `_: Improved ``ValidationError`` message of ``GeometryField`` -- `a3ddd3d `_: **Improved serialization performance between 25% and 29%** -- `fb6ed36 `_: ``GeoModelSerializer`` deprecated because obsolete -- `#66 `_: geometry now allows ``None`` values according to the **GeoJSON spec** -- `#67 `_: discern ``False`` or empty string values from ``None`` in ``GeoFeatureModelSerializer`` +- `04fd1bf + `_: + Added ``GeoJsonPagination`` +- `fe47d86 + `_: + Improved ``ValidationError`` message of ``GeometryField`` +- `a3ddd3d + `_: + **Improved serialization performance between 25% and 29%** +- `fb6ed36 + `_: + ``GeoModelSerializer`` deprecated because obsolete +- `#66 `_: + geometry now allows ``None`` values according to the **GeoJSON spec** +- `#67 `_: + discern ``False`` or empty string values from ``None`` in + ``GeoFeatureModelSerializer`` Version 0.9.2 [2015-07-15] -------------------------- -- `#59 `_: Added GeometrySerializerMethodField -- `3fa2354 `_: removed broken/obsolete/untested code +- `#59 `_: + Added GeometrySerializerMethodField +- `3fa2354 + `_: + removed broken/obsolete/untested code Version 0.9.1 [2015-06-28] -------------------------- -- `#63 `_: added compatibility with python 3.2 and updated compatibility table in README -- `#60 `_: ensure GeoJSON is rendered correctly in browsable API when using python 2 -- `#62 `_: updated django-rest-framework requirement to 3.1.3 +- `#63 + `_: + added compatibility with python 3.2 and updated compatibility table in + README +- `#60 `_: + ensure GeoJSON is rendered correctly in browsable API when using python + 2 +- `#62 + `_: + updated django-rest-framework requirement to 3.1.3 Version 0.9 [2015-05-31] ------------------------ -- `#55 `_: Fixed exception in ``DistanceToPointFilter`` in case of invalid point -- `#58 `_: Fixed handling of ``None`` values in ``GeoFeatureModelSerializer`` to avoid problems with ``FileField`` and ``ImageField`` -- `#57 `_: Added support for GeoJSON Bounding Boxes in ``GeoFeatureModelSerializer`` +- `#55 `_: + Fixed exception in ``DistanceToPointFilter`` in case of invalid point +- `#58 `_: + Fixed handling of ``None`` values in ``GeoFeatureModelSerializer`` to + avoid problems with ``FileField`` and ``ImageField`` +- `#57 `_: + Added support for GeoJSON Bounding Boxes in + ``GeoFeatureModelSerializer`` Version 0.8.2 [2015-04-29] -------------------------- -- `#53 `_: Added support for PATCH requests in ``GeoFeatureModelSerializer`` +- `#53 `_: + Added support for PATCH requests in ``GeoFeatureModelSerializer`` Version 0.8.1 [2015-03-25] -------------------------- diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c2b5af6c..ff1484b9 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,5 +1,8 @@ Contributing ============ -Thanks for your interest! We love contributions, so please feel free to fix bugs, improve things, provide documentation. Just `follow the -guidelines `_ and submit a PR. +Thanks for your interest! We love contributions, so please feel free to +fix bugs, improve things, provide documentation. Just `follow the +guidelines +`_ and +submit a PR. diff --git a/Dockerfile b/Dockerfile index a6a0fc87..e285bf52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +FROM python:3.10-alpine # postgresql-client is required by psql # postgresql-dev musl-dev gcc are required by psycopg diff --git a/README.rst b/README.rst index 9fdee316..2b511cb0 100644 --- a/README.rst +++ b/README.rst @@ -39,6 +39,7 @@ Compatibility with DRF, Django and Python ======================== ============================ ==================== ================================== DRF-gis version DRF version Django version Python version +**1.1.x** **3.12** up to **3.15** **3.2, 4.2 to 5.1** **3.8** to **3.12** **1.0.x** **3.10** up to **3.13** **2.2 to 4.0** **3.6** to **3.9** **0.18.x** **3.10** up to **3.13** **2.2 to 4.0** **3.6** to **3.9** **0.17.x** **3.10** up to **3.12** **2.2 to 3.1** **3.6** to **3.8** diff --git a/docker-compose.yml b/docker-compose.yml index 98542c31..9248ad4d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,12 +20,12 @@ services: command: sh -c "pip install -e . && python ./tests/manage.py test tests/django_restframework_gis_tests && ./run-qa-checks" postgres: - image: mdillon/postgis:10-alpine + image: postgis/postgis:15-3.4-alpine environment: POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres POSTGRES_DB: django_restframework_gis - ports: + ports: - 5432:5432 volumes: - postgres_data:/var/lib/postgresql/data diff --git a/performance_tests.rst b/performance_tests.rst index c1394b9b..fd542d88 100644 --- a/performance_tests.rst +++ b/performance_tests.rst @@ -1,12 +1,15 @@ Average of 5 measurements for python2 and python3. -Launch the performance test with:: +Launch the performance test with: + +:: cd tests ./manage.py test --keepdb django_restframework_gis_tests.test_performance -For more information regarding how the measurement is performed read the code in -`test_performance.py `__. +For more information regarding how the measurement is performed read the +code in `test_performance.py +`__. 0.9.2 ===== diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..81e80400 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[tool.coverage.run] +source = ["rest_framework_gis"] +parallel = true +concurrency = ["multiprocessing"] +omit = [ + "rest_framework_gis/__init__.py", + "*/tests/*", + "*/migrations/*", +] + +[tool.docstrfmt] +extend_exclude = ["**/*.py", "README.rst"] + +[tool.isort] +known_third_party = ["django", "rest_framework"] +default_section = "THIRDPARTY" +line_length = 88 +multi_line_output = 3 +use_parentheses = true +include_trailing_comma = true +force_grid_wrap = 0 + diff --git a/requirements-test.txt b/requirements-test.txt index d08f5891..e9cdd8bd 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,5 @@ -psycopg2~=2.8.0 +psycopg2~=2.9.0 django-filter>=2.0 contexttimer # QA checks -openwisp-utils[qa]~=1.0.5 -packaging~=20.4 +openwisp-utils[qa] @ https://github.com/openwisp/openwisp-utils/tarball/master diff --git a/rest_framework_gis/fields.py b/rest_framework_gis/fields.py index 395ef508..d22a7e78 100644 --- a/rest_framework_gis/fields.py +++ b/rest_framework_gis/fields.py @@ -65,7 +65,7 @@ def to_internal_value(self, value): value = json.dumps(value) try: return GEOSGeometry(value) - except (GEOSException): + except GEOSException: raise ValidationError( _( 'Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.' diff --git a/setup.cfg b/setup.cfg index 9162d1dc..cc627d28 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,10 +9,3 @@ max-line-length = 110 # W504: line break after or after operator # W605: invalid escape sequence ignore = W605, W503, W504 - -[isort] -multi_line_output=3 -use_parentheses=True -include_trailing_comma=True -force_grid_wrap=0 -line_length=88 diff --git a/setup.py b/setup.py index 1e9d7621..562bd92a 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,10 @@ #!/usr/bin/env python import os -import sys from setuptools import find_packages, setup from rest_framework_gis import get_version -if sys.argv[-1] == 'publish': - os.system("python setup.py sdist bdist_wheel") - os.system("twine upload -s dist/*") - os.system("rm -rf dist build") - args = {'version': get_version()} - print("You probably want to also tag the version now:") - print(" git tag -a %(version)s -m 'version %(version)s'" % args) - print(" git push --tags") - sys.exit() - here = os.path.abspath(os.path.dirname(__file__)) # Get the long description from the README file @@ -36,7 +25,7 @@ platforms=['Platform Indipendent'], keywords=['django', 'rest-framework', 'gis', 'geojson'], packages=find_packages(exclude=['tests', 'tests.*']), - install_requires=['djangorestframework'], + install_requires=['djangorestframework>=3.12,<3.15', 'django-filter~=23.5'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', @@ -47,10 +36,11 @@ 'Framework :: Django', 'Programming Language :: Python', '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', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3 :: Only', ], project_urls={ diff --git a/tests/django_restframework_gis_tests/migrations/0001_initial.py b/tests/django_restframework_gis_tests/migrations/0001_initial.py index 7458e470..f33b4b0c 100644 --- a/tests/django_restframework_gis_tests/migrations/0001_initial.py +++ b/tests/django_restframework_gis_tests/migrations/0001_initial.py @@ -7,7 +7,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/tests/django_restframework_gis_tests/migrations/0002_nullable.py b/tests/django_restframework_gis_tests/migrations/0002_nullable.py index 5f0d7530..06059ef5 100644 --- a/tests/django_restframework_gis_tests/migrations/0002_nullable.py +++ b/tests/django_restframework_gis_tests/migrations/0002_nullable.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ('django_restframework_gis_tests', '0001_initial'), ] diff --git a/tests/django_restframework_gis_tests/migrations/0004_auto_20240228_2357.py b/tests/django_restframework_gis_tests/migrations/0004_auto_20240228_2357.py index ff0da97a..2d5888a8 100644 --- a/tests/django_restframework_gis_tests/migrations/0004_auto_20240228_2357.py +++ b/tests/django_restframework_gis_tests/migrations/0004_auto_20240228_2357.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ('django_restframework_gis_tests', '0003_schema_models'), ] diff --git a/tests/django_restframework_gis_tests/test_schema_generation.py b/tests/django_restframework_gis_tests/test_schema_generation.py index b9c45b5d..89040a7f 100644 --- a/tests/django_restframework_gis_tests/test_schema_generation.py +++ b/tests/django_restframework_gis_tests/test_schema_generation.py @@ -1,8 +1,4 @@ -from unittest import SkipTest - -import rest_framework from django.test import RequestFactory, TestCase -from packaging import version from rest_framework.generics import RetrieveAPIView from rest_framework.request import Request from rest_framework.schemas.openapi import SchemaGenerator @@ -31,11 +27,6 @@ geojson_location_list, ) -is_pre_drf_312 = version.parse(rest_framework.VERSION) < version.parse('3.12') - -if is_pre_drf_312: - raise SkipTest('Skip this test if DRF < 3.12') - def create_request(path): factory = RequestFactory() diff --git a/tox.ini b/tox.ini index 63f36f82..a789855a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,10 @@ [tox] envlist = - py{37,38,39,py3}-django{22}-djangorestframework{310,312}{,-pytest} - py{37,38,39,py3}-django{30,31,32}-djangorestframework{312}{,-pytest} - py{38,39,py3}-django{40}-djangorestframework{313}{,-pytest} + py{38,39,310}-django{32}-djangorestframework{312,313,314}{,-pytest} + py{38,39,310}-django{42,50}-djangorestframework{314}{,-pytest} + py{311}-django{42}-djangorestframework{314}{,-pytest} + py{311,312}-django{50}-djangorestframework{315}{,-pytest} + py{311,312}-django{51}-djangorestframework{315}{,-pytest} [testenv] usedevelop = true @@ -13,18 +15,17 @@ setenv = DRFG_TEST_RUNNER=./tests/manage.py test pytest: DRFG_TEST_RUNNER=-m pytest commands = - coverage run --source=rest_framework_gis {env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests} - travis: - coveralls + coverage run {env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests} --parallel deps = - django22: Django~=2.2.0 - django30: Django~=3.0.0 - django31: Django~=3.1.0 django32: Django~=3.2.0 - django40: Django~=4.0.0 - djangorestframework310: djangorestframework~=3.10.0 + django42: Django~=4.2.0 + django50: Django~=5.0.0 + django51: Django~=5.1.0 djangorestframework312: djangorestframework~=3.12.0 djangorestframework313: djangorestframework~=3.13.0 + djangorestframework314: djangorestframework~=3.14.0 + djangorestframework315: djangorestframework~=3.15.0 -rrequirements-test.txt pytest: pytest pytest: pytest-django From 00096c00fd063b35fd8708d15de7e384f92632f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 19:18:07 +0000 Subject: [PATCH 2/4] [deps] Update django-filter requirement from ~=23.5 to >=23.5,<25.0 Updates the requirements on [django-filter](https://github.com/carltongibson/django-filter) to permit the latest version. - [Release notes](https://github.com/carltongibson/django-filter/releases) - [Changelog](https://github.com/carltongibson/django-filter/blob/main/CHANGES.rst) - [Commits](https://github.com/carltongibson/django-filter/compare/23.5...24.3) --- updated-dependencies: - dependency-name: django-filter dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 562bd92a..7e4f2938 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ platforms=['Platform Indipendent'], keywords=['django', 'rest-framework', 'gis', 'geojson'], packages=find_packages(exclude=['tests', 'tests.*']), - install_requires=['djangorestframework>=3.12,<3.15', 'django-filter~=23.5'], + install_requires=['djangorestframework>=3.12,<3.15', 'django-filter>=23.5,<25.0'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', From 344978526e0178a070d54da1d78c536ca933e63a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:16:05 -0400 Subject: [PATCH 3/4] [deps] Update psycopg2 requirement from ~=2.8.0 to ~=2.9.9 --- updated-dependencies: - dependency-name: psycopg2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index e9cdd8bd..dcd01623 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ -psycopg2~=2.9.0 +psycopg2~=2.9.9 django-filter>=2.0 contexttimer # QA checks From 533567afdf534f9173d6444e8c3941cf55ab036e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 17 Aug 2024 11:38:18 -0400 Subject: [PATCH 4/4] [deps] Allow djangorestframework up to 3.15.x Updates the requirements on [djangorestframework](https://github.com/encode/django-rest-framework) to permit the latest version. - [Release notes](https://github.com/encode/django-rest-framework/releases) - [Commits](https://github.com/encode/django-rest-framework/compare/3.12.0...3.15.2) --- updated-dependencies: - dependency-name: djangorestframework dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gagan Deep --- setup.py | 2 +- .../test_schema_generation.py | 42 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index 7e4f2938..4b0c6d92 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ platforms=['Platform Indipendent'], keywords=['django', 'rest-framework', 'gis', 'geojson'], packages=find_packages(exclude=['tests', 'tests.*']), - install_requires=['djangorestframework>=3.12,<3.15', 'django-filter>=23.5,<25.0'], + install_requires=['djangorestframework>=3.12,<3.16', 'django-filter>=23.5,<25.0'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', diff --git a/tests/django_restframework_gis_tests/test_schema_generation.py b/tests/django_restframework_gis_tests/test_schema_generation.py index 89040a7f..85dc7d78 100644 --- a/tests/django_restframework_gis_tests/test_schema_generation.py +++ b/tests/django_restframework_gis_tests/test_schema_generation.py @@ -1,4 +1,6 @@ from django.test import RequestFactory, TestCase +from packaging.version import parse as parse_version +from rest_framework import VERSION as DRF_VERSION from rest_framework.generics import RetrieveAPIView from rest_framework.request import Request from rest_framework.schemas.openapi import SchemaGenerator @@ -489,28 +491,28 @@ def test_geo_json_pagination_schema(self): ) self.assertIn("features", generated_schema["properties"]) generated_schema["properties"].pop("features") - self.assertDictEqual( - generated_schema, - { - "type": "object", - "properties": { - "type": {"type": "string", "enum": ["FeatureCollection"]}, - "count": {"type": "integer", "example": 123}, - "next": { - "type": "string", - "nullable": True, - "format": "uri", - "example": "http://api.example.org/accounts/?page=4", - }, - "previous": { - "type": "string", - "nullable": True, - "format": "uri", - "example": "http://api.example.org/accounts/?page=2", - }, + expected_schema = { + "type": "object", + "properties": { + "type": {"type": "string", "enum": ["FeatureCollection"]}, + "count": {"type": "integer", "example": 123}, + "next": { + "type": "string", + "nullable": True, + "format": "uri", + "example": "http://api.example.org/accounts/?page=4", + }, + "previous": { + "type": "string", + "nullable": True, + "format": "uri", + "example": "http://api.example.org/accounts/?page=2", }, }, - ) + } + if parse_version(DRF_VERSION) >= parse_version('3.15'): + expected_schema['required'] = ['count', 'results'] + self.assertDictEqual(generated_schema, expected_schema) class TestRestFrameworkGisFiltersSchema(TestCase):