Skip to content

Commit

Permalink
Merge pull request #34 from submarcos/improvments
Browse files Browse the repository at this point in the history
Improve code quality and documentation
  • Loading branch information
submarcos committed Feb 8, 2023
2 parents c92628b + 9b53743 commit 5739b42
Show file tree
Hide file tree
Showing 35 changed files with 738 additions and 379 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Code & doc quality

on:
push:
branches: [ master ]
pull_request:

jobs:
flake8:
runs-on: ubuntu-latest
container:
image: python:3.6
env:
LANG: C.UTF-8
steps:
- uses: actions/checkout@v3
- name: Install flake8
run: |
pip install flake8
- name: Check
run: |
flake8 vectortiles test_vectortiles
isort:
runs-on: ubuntu-latest
container:
image: python:3.6
env:
LANG: C.UTF-8

steps:
- uses: actions/checkout@v3
- name: Install isort
run: |
pip install isort
- name: Check
run: |
isort -c vectortiles test_vectortiles
black:
runs-on: ubuntu-latest
container:
image: python:3.6
env:
LANG: C.UTF-8

steps:
- uses: actions/checkout@v3
- name: Install black
run: |
pip install black
- name: Check
run: |
black --check vectortiles test_vectortiles
doc:
runs-on: ubuntu-latest
container:
image: python:3.6
env:
LANG: C.UTF-8

steps:
- uses: actions/checkout@v3
- name: Check documentation
run: |
cd docs
pip install -r ./requirements.txt -U
make html SPHINXOPTS="-W"
41 changes: 9 additions & 32 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python / Django matrix test
name: Unit tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.6']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 vectortiles test_vectortiles
build:
test:
runs-on: ubuntu-20.04
needs: [lint]
strategy:
matrix:
python-version: ['3.6', '3.10']
django-version: ['2.2.*', '3.2.*', '4.1.*']
postgis-image: ['postgis/postgis:10-2.5', 'postgis/postgis:11-2.5', 'postgis/postgis:latest']
exclude:
- python-version: '3.10' # 3.10 is not supported by django 2.2
django-version: '2.2.*'
- postgis-image: 'postgis/postgis:11-2.5'
django-version: '2.2.*' # test only with 10-2.5 and latest
- postgis-image: 'postgis/postgis:11-2.5'
django-version: '3.2.*' # test only with 10-2.5 and latest
- python-version: '3.6'
django-version: '4.1.*' # Django 4.1 supports only python >= 3.8
include:
- django-version: '2.2.*'
postgis-image: 'postgis/postgis:10-2.5'
- django-version: '3.2.*'
postgis-image: 'postgis/postgis:10-2.5'
- django-version: '4.1.*'
postgis-image: 'postgis/postgis:11-2.5' # django 4.1 requires postgresql >= 11
- postgis-image: 'postgis/postgis:10-2.5'
django-version: '4.1.*' # Django 4.1 supports only postgres >= 11

services:
postgres:
Expand Down
File renamed without changes.
Empty file added docs/_static/.empty
Empty file.
16 changes: 13 additions & 3 deletions CHANGES.md → docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
CHANGELOG
=========

0.2.0+dev (XXXX-XX-XX)
------------------------
1.0.0.a1
--------

* Features

* Native MVTRenderer for django-rest-framework

* Quality

* Black-ified
* iSort-ed

* Documentation

* Add DRF and MapLibre examples


0.2.0 (2022-10-17)
------------------------
Expand Down Expand Up @@ -47,7 +56,8 @@ First beta release
0.0.1 (2020-10-22)
------------------------

* First Release
# First Release

* Generate Vector Tiles from django models
* in python
* with PostGIS
Expand Down
4 changes: 3 additions & 1 deletion doc/conf.py → docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
#
import os
import sys
import datetime

sys.path.insert(0, os.path.abspath('..'))

# -- Project information -----------------------------------------------------
HERE = os.path.abspath(os.path.dirname(__file__))

project = 'django-vectortiles'
copyright = '2021, Jean-Etienne Castagnede'
copyright = f'2021 - {datetime.date.today().year}, Jean-Etienne Castagnede'
author = 'Jean-Etienne Castagnede'

# The full version, including alpha/beta/rc tags
Expand Down
3 changes: 1 addition & 2 deletions doc/index.rst → docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ Welcome to django-vectortiles's documentation!

installation.rst
usage.rst
changelog.rst

.. automodule:: vectortiles.mixins
:members:

Indices and tables
==================
Expand Down
6 changes: 3 additions & 3 deletions doc/installation.rst → docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ INSTALLATION
Requirements
************

* You need to install geodjango required libraries (See `here <https://docs.djangoproject.com/en/3.1/ref/contrib/gis/install/geolibs/>`_)
* You need to install geodjango required libraries (See `here <https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/geolibs/>`_)

PostGIS 2.4+ backend usage
**************************

* You need a PostgreSQL database with PostGIS 2.4+ extension enabled. (See `here <https://docs.djangoproject.com/en/3.1/ref/contrib/gis/install/postgis/>`_)
* You need a PostgreSQL database with PostGIS 2.4+ extension enabled. (See `<https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/postgis/>`_)

* You need to enable and use **django.contrib.gis.db.backends.postgis** database backend

Expand All @@ -26,4 +26,4 @@ Other database backend usages
pip install django-vectortiles[mapbox]
This will include subdependencies to generate vector tiles from mapbox_vector_tiles python library.
This will include sub-dependencies to generate vector tiles from mapbox_vector_tiles python library.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion doc/usage.rst → docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,10 @@ Django Rest Framework
urlpatterns += router.urls
then use http://your-domain/features/tiles/{z}/{x}/{y}.pbf
then use http://your-domain/features/tiles/{z}/{x}/{y}.pbf

MapLibre Example
****************

.. literalinclude:: ../test_vectortiles/test_app/templates/index.html
:language: html
10 changes: 9 additions & 1 deletion .coveragerc → setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[report]
[flake8]
ignore = E501,W504
exclude = test_vectortiles/settings*

[isort]
profile=black

[coverage:report]
omit =
*/tests*
*/migrations*
Expand All @@ -8,3 +15,4 @@ omit =
manage.py

ignore_errors = true

6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
HERE = os.path.abspath(os.path.dirname(__file__))

README = open(os.path.join(HERE, 'README.md')).read()
CHANGES = open(os.path.join(HERE, 'CHANGES.md')).read()

test_require = [
'factory-boy',
'flake8',
'isort',
'black',
'coverage',
'djangorestframework',
'psycopg2-binary' # for dev and test only. in production, use psycopg2
Expand All @@ -27,7 +28,7 @@
include_package_data=True,
author="Jean-Etienne Castagnede",
description='Django vector tile generation',
long_description=README + '\n\n' + CHANGES,
long_description=README,
description_content_type="text/markdown",
long_description_content_type="text/markdown",
packages=find_packages(),
Expand All @@ -41,6 +42,7 @@
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand Down

0 comments on commit 5739b42

Please sign in to comment.