Skip to content

Commit

Permalink
Merge pull request #24 from tilery/feature/add-python-3.12
Browse files Browse the repository at this point in the history
add python 3.12 support and update pre-commit
  • Loading branch information
vincentsarago authored Apr 24, 2024
2 parents 5ccfad7 + 136ceab commit 5dde998
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 33 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ jobs:
- {name: Windows, python: '3.10', os: windows-latest}
- {name: Mac, python: '3.10', os: macos-latest}
- {name: 'Ubuntu', python: '3.10', os: ubuntu-latest}
- {name: '3.11', python: '3.11.0-rc.2 - 3.11', os: ubuntu-latest}
- {name: '3.12', python: '3.12', os: ubuntu-latest}
- {name: '3.11', python: '3.11', os: ubuntu-latest}
- {name: '3.9', python: '3.9', os: ubuntu-latest}
- {name: '3.8', python: '3.8', os: ubuntu-latest}
- {name: '3.7', python: '3.7', os: ubuntu-latest}
- {name: '3.6', python: '3.6', os: ubuntu-latest}
- {name: '3.5', python: '3.5', os: ubuntu-latest}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
28 changes: 11 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
language_version: python
args: [--safe]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
language_version: python

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: flake8
language_version: python
- id: ruff
args: ["--fix"]
- id: ruff-format

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: pydocstyle
- id: mypy
language_version: python
additional_dependencies:
- toml
# No reason to run if only tests have changed. They intentionally break typing.
exclude: tests/.*
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Release Notes

### 0.0.1b4 - 2022-10-25

- add python 3.12 support
- remove support for python <3.8

### 0.0.1b3 - 2022-10-25

- add python 3.9, 3.10, 3.11 support
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Experimental Python wrapper of [vtzero](https://github.com/mapbox/vtzero) a mini

## Requirements

- Python >= 3.5
- Python >= 3.8
- gcc/clang++ >= 4.5 (C++11)

## Install

You can install python-vtzero using pip

```bash
$ pip install vtzero
$ python -m pip install vtzero
```

or install from source
Expand All @@ -30,7 +30,7 @@ $ git submodule update --init

# Compile Cython module
$ python setup.py build_ext --inplace
$ pip install -e .
$ python -m pip install -e .
```

## Example
Expand Down
21 changes: 18 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ default_section = "THIRDPARTY"
[tool.mypy]
no_strict_optional = "True"

[tool.pydocstyle]
select = "D1"
match = "(?!test).*.py"
[tool.ruff]
line-length = 90

[tool.ruff.lint]
select = [
"D1", # pydocstyle errors
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # flake8
"C", # flake8-comprehensions
"B", # flake8-bugbear
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"B905", # ignore zip() without an explicit strict= parameter, only support with python >3.10
"B028",
]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
provides=["vtzero"],
include_package_data=True,
extras_require=extra_reqs,
python_requires=">=3.8",
)
7 changes: 7 additions & 0 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""fixtures."""

import json
from pathlib import Path

Expand Down Expand Up @@ -26,6 +28,8 @@

@pytest.fixture
def fixture():
"""data fixtures."""

def _(id):
path = ROOT / id
with (path / "info.json").open("r") as f:
Expand All @@ -40,6 +44,7 @@ def _(id):


def first_feature(tile):
"""check and return feature."""
assert not tile.empty()
assert len(tile) == 1
layer = next(tile)
Expand All @@ -51,13 +56,15 @@ def first_feature(tile):


def test_empty_tile(fixture):
"""empty tile fixture."""
info, data, mvt = fixture("001")
tile = VectorTile(mvt)
assert tile.empty()
assert len(tile) == 0


def test_single_point_without_id(fixture):
"""Point."""
info, data, mvt = fixture("002")
tile = VectorTile(mvt)
feature = first_feature(tile)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_tile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Test tile encoding."""

from vtzero.tile import Layer, Linestring, Point, Polygon, Tile


Expand Down
2 changes: 1 addition & 1 deletion vendor/mvt-fixtures
Submodule mvt-fixtures updated 187 files
2 changes: 1 addition & 1 deletion vendor/protozero
Submodule protozero updated 143 files
2 changes: 1 addition & 1 deletion vendor/vtzero
Submodule vtzero updated 72 files
+0 −88 .clang-format
+49 −24 .clang-tidy
+141 −31 .travis.yml
+0 −49 .ycm_extra_conf.py
+75 −2 CHANGELOG.md
+17 −6 CMakeLists.txt
+7 −9 CONTRIBUTING.md
+28 −0 EXTERNAL_LICENSES.txt
+28 −13 README.md
+8 −8 appveyor.yml
+0 −32 bench/run.cpp
+3 −8 build-appveyor.bat
+3 −3 build-msys2.bat
+0 −231 cmake/mason.cmake
+3 −3 doc/Doxyfile.in
+92 −0 doc/advanced.md
+1 −1 doc/doc.md
+459 −0 doc/reading.md
+39 −556 doc/tutorial.md
+565 −0 doc/writing.md
+57 −49 examples/CMakeLists.txt
+37 −3 examples/utils.cpp
+225 −0 examples/vtzero-check.cpp
+90 −78 examples/vtzero-create.cpp
+144 −0 examples/vtzero-encode-geom.cpp
+70 −67 examples/vtzero-filter.cpp
+71 −74 examples/vtzero-show.cpp
+56 −0 examples/vtzero-stats.cpp
+81 −0 examples/vtzero-streets.cpp
+1,239 −0 include-external/clara.hpp
+855 −197 include/vtzero/builder.hpp
+142 −67 include/vtzero/builder_impl.hpp
+7 −1 include/vtzero/encoded_property_value.hpp
+1 −1 include/vtzero/exception.hpp
+31 −17 include/vtzero/feature.hpp
+23 −127 include/vtzero/feature_builder_impl.hpp
+173 −172 include/vtzero/geometry.hpp
+176 −15 include/vtzero/index.hpp
+108 −8 include/vtzero/layer.hpp
+1 −1 include/vtzero/output.hpp
+11 −1 include/vtzero/property.hpp
+103 −0 include/vtzero/property_mapper.hpp
+9 −9 include/vtzero/property_value.hpp
+23 −9 include/vtzero/types.hpp
+11 −1 include/vtzero/vector_tile.hpp
+3 −3 include/vtzero/version.hpp
+0 −38 scripts/clang-tidy.sh
+0 −29 scripts/coverage.sh
+0 −36 scripts/format.sh
+0 −132 scripts/setup.sh
+7 −3 test/CMakeLists.txt
+15,274 −8,904 test/catch/catch.hpp
+ test/data/ext1.mvt
+323 −47 test/fixture_tests.cpp
+14 −0 test/include/test.hpp
+1 −1 test/mvt-fixtures
+484 −92 test/t/test_builder.cpp
+312 −0 test/t/test_builder_linestring.cpp
+279 −0 test/t/test_builder_point.cpp
+307 −0 test/t/test_builder_polygon.cpp
+5 −2 test/t/test_feature.cpp
+99 −75 test/t/test_geometry.cpp
+70 −32 test/t/test_geometry_linestring.cpp
+66 −35 test/t/test_geometry_point.cpp
+85 −58 test/t/test_geometry_polygon.cpp
+343 −0 test/t/test_index.cpp
+13 −13 test/t/test_layer.cpp
+11 −8 test/t/test_property_map.cpp
+79 −20 test/t/test_property_value.cpp
+1 −1 test/t/test_types.cpp
+10 −2 test/t/test_vector_tile.cpp
+5 −2 test/test_main.cpp
2 changes: 1 addition & 1 deletion vtzero/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""vtzero version."""

__version__ = "0.0.1b3"
__version__ = "0.0.1b4"

0 comments on commit 5dde998

Please sign in to comment.