Skip to content

Commit

Permalink
the big lebowski
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 22, 2024
1 parent 083c2a4 commit 1fd49ac
Show file tree
Hide file tree
Showing 50 changed files with 86 additions and 383 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
with:
context: .
provenance: false
file: docker/django/Dockerfile
file: docker/django_oapif_tests/Dockerfile
pull: true
cache-from: type=registry,ref=opengisch/django-oapif:latest
tags: opengisch/django-oapif:latest
cache-from: type=registry,ref=opengisch/django_oapif_tests-oapif:latest
tags: opengisch/django_oapif_tests-oapif:latest

- name: Download fixtures
run: ./scripts/download-fixtures.sh
Expand Down
20 changes: 4 additions & 16 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
jobs:
conformance:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
Expand All @@ -24,31 +27,16 @@ jobs:
- name: Create env
run: cp .env.example .env

- name: Load .env file
uses: xom9ikk/dotenv@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
if: github.repository == 'opengisch/django-ogcapif'
if: github.repository == 'opengisch/django_oapif_tests-ogcapif'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Django image
uses: docker/build-push-action@v5
with:
context: .
provenance: false
file: docker/django/Dockerfile
push: ${{ github.repository == 'opengisch/django-ogcapif' }}
pull: true
cache-from: type=registry,ref=opengisch/django-oapif:latest
cache-to: type=registry,ref=opengisch/django-oapif:latest,mode=max
tags: opengisch/django-oapif:latest

- name: Do quickstart
run: |
# copy default conf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: Failure logs
if: failure()
run: docker-compose logs django
run: docker-compose logs django_oapif_tests
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload ./django-ogcapif/dist/* --verbose
run: twine upload ./django_oapif_tests-ogcapif/dist/* --verbose
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
Expand All @@ -25,14 +28,11 @@ jobs:
- name: Create env
run: cp .env.example .env

- name: Load .env file
uses: xom9ikk/dotenv@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: github.repository == 'opengisch/django-ogcapif'
if: github.repository == 'opengisch/django_oapif_tests-ogcapif'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -52,7 +52,7 @@ jobs:
docker compose exec django python manage.py populate_data
- name: Run unit tests
run: docker compose exec django python manage.py test tests
run: docker compose exec django_oapif_tests python manage.py test tests

- name: Run integration tests
run: docker compose run integration_tests
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ db.sqlite3
.DS_Store
*.pyc
__pycache__
.env
tests/.env
*.orig
build
dist
*.egg-info
src/django_oapif/__version__.py
src/core/__version__.py

tests/benchmark/results

src/tests/fixtures/polygon_2056.json.gz
src/tests/fixtures/polygon_2056_local_geom.json.gz
tests/django_oapif_tests/tests/fixtures/polygon_2056.json.gz
tests/django_oapif_tests/tests/fixtures/polygon_2056_local_geom.json.gz

data
static
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: ^src/tests/migrations/
exclude: ^core/tests/migrations/

repos:
# Fix end of files
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ cp .env.example .env
docker compose up --build -d

# deploy static files and migrate database
docker compose exec django python manage.py collectstatic --no-input
docker compose exec django python manage.py migrate --no-input
docker compose exec django_oapif_tests python manage.py collectstatic --no-input
docker compose exec django_oapif_tests python manage.py migrate --no-input

# A convenience start-up Django command is there
# to populate the database with testdata
docker compose exec django python manage.py populate_users
docker compose exec django python manage.py populate_data
docker compose exec django_oapif_tests python manage.py populate_users
docker compose exec django_oapif_tests python manage.py populate_data
```
After waiting little you'll be able to access all collections at http://0.0.0.0:7180/oapif/collections.

Expand Down Expand Up @@ -58,7 +58,7 @@ This project is [hosted on PyPI](https://pypi.org/project/django-ogcapif/). You

```bash
# Install with your favorite package manager
pip3 install --user django-ogcapif
pip3 install --user django_oapif_tests-ogcapif
# Edit your Django project's settings.py accordingly:
settings.py
-----------
Expand All @@ -76,7 +76,8 @@ models.py
---------
from rest_framework import permissions
from django.contrib.gis.db import models
from django_oapif.decorators import register_oapif_viewset
from django_oapif import register_oapif_viewset


@register_oapif_viewset(
custom_viewset_attrs={
Expand Down
3 changes: 0 additions & 3 deletions docker/caddy/Dockerfile

This file was deleted.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]==7.*"]
requires = ["setuptools>=45", "setuptools-git-versioning<2"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -24,9 +24,9 @@ homepage = "https://github.com/opengisch/django-ogcapif"
repository = "https://github.com/opengisch/django-ogcapif"
tracker = "https://github.com/opengisch/django-ogcapif/issues"

[tool.setuptools_scm]
version_scheme = "post-release"
root = ".."
[tool.setuptools-git-versioning]
enabled = true
version_callback = "0.0.0.dev"

[tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown"}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
django>=4,<5
psycopg2-binary
djangorestframework==3.14.0
git+https://github.com/3nids/django-rest-framework-gis
djangorestframework-gis@git+https://github.com/openwisp/django-rest-framework-gis@4f244d5d8a7ad5b453fd04f64150818d15123e01
pyyaml
uritemplate
pyproj
3 changes: 2 additions & 1 deletion src/django_oapif/README.md → src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ urlpatterns += [
# models.py

from django.contrib.gis.db import models
from django_oapif.decorators import register
from django_oapif import register


@register()
class TestingDecorator(models.Model):
Expand Down
5 changes: 5 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try:
from .__version__ import __version__, __version_tuple__
except ImportError:
__version__ = "0.0.0.dev"
__version_tuple__ = (0, 0, 0, "dev")
File renamed without changes.
5 changes: 2 additions & 3 deletions src/django_oapif/decorators.py → src/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from django.contrib.gis.geos import GEOSGeometry
from django.db import models
from django.db.models.functions import Cast
from rest_framework import reverse, serializers, viewsets
from rest_framework_gis.serializers import GeoFeatureModelSerializer

from django_oapif.metadata import OAPIFMetadata
from django_oapif.mixins import OAPIFDescribeModelViewSetMixin
from django_oapif.urls import oapif_router
from rest_framework import reverse, serializers, viewsets
from rest_framework_gis.serializers import GeoFeatureModelSerializer

from .filters import BboxFilterBackend

Expand Down
5 changes: 0 additions & 5 deletions src/django_oapif/__init__.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions src/django_oapif/mixins.py → src/mixins.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.contrib.gis.db.models import Extent
from django_oapif.urls import oapif_router
from pyproj import CRS, Transformer
from rest_framework.response import Response

from django_oapif.urls import oapif_router

from .parsers import GeojsonParser, JSONMergePatchParser


Expand Down
4 changes: 2 additions & 2 deletions src/django_oapif/pagination.py → src/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class OapifPagination(pagination.LimitOffsetPagination):
"""OAPIF-compatible django rest paginator"""
"""OAPIF-compatible django_oapif_tests rest paginator"""

default_limit = 1000

Expand Down Expand Up @@ -52,7 +52,7 @@ def get_schema_operation_parameters(self, view):


class HighPerfPagination(pagination.LimitOffsetPagination):
"""OAPIF-compatible django rest paginator, tailored for the high performance version where data is pre-concatenated json"""
"""OAPIF-compatible django_oapif_tests rest paginator, tailored for the high performance version where data is pre-concatenated json"""

def get_paginated_response(self, data):
# FIXME: this probably is a bug, since `data` is a string, it is not the number of features
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1fd49ac

Please sign in to comment.