Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chores] Formatted code, updated CI, update deps #303

Merged
merged 8 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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] "
57 changes: 30 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -72,54 +72,57 @@ jobs:
- python: 3.9
TOXENV: py39-django40-djangorestframework313
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
if: ${{ success() }}
uses: coverallsapp/github-action@v2
with:
parallel: true
format: cobertura
flag-name: python-${{ matrix.env.env }}
github-token: ${{ secrets.GITHUB_TOKEN }}



- name: QA checks
run: |
pip install "importlib-metadata<5.0" # remove when flake8 is upgraded
./run-qa-checks

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
211 changes: 147 additions & 64 deletions CHANGES.rst

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/openwisp/django-rest-framework-gis#contributing>`_ 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
<https://github.com/openwisp/django-rest-framework-gis#contributing>`_ and
submit a PR.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions performance_tests.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/openwisp/django-rest-framework-gis/blob/master/tests/django_restframework_gis_tests/test_performance.py>`__.
For more information regarding how the measurement is performed read the
code in `test_performance.py
<https://github.com/openwisp/django-rest-framework-gis/blob/master/tests/django_restframework_gis_tests/test_performance.py>`__.

0.9.2
=====
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 1 addition & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ psycopg2~=2.8.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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to publish openwisp-utils and use a stable version here.

2 changes: 1 addition & 1 deletion rest_framework_gis/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
7 changes: 0 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('django_restframework_gis_tests', '0001_initial'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('django_restframework_gis_tests', '0003_schema_models'),
]
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ 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}

deps =
django22: Django~=2.2.0
Expand Down
Loading