Skip to content

Commit 758d0fd

Browse files
committed
add python 3.12 support and update pre-commit
1 parent 5ccfad7 commit 758d0fd

File tree

7 files changed

+49
-25
lines changed

7 files changed

+49
-25
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@ jobs:
2020
- {name: Windows, python: '3.10', os: windows-latest}
2121
- {name: Mac, python: '3.10', os: macos-latest}
2222
- {name: 'Ubuntu', python: '3.10', os: ubuntu-latest}
23-
- {name: '3.11', python: '3.11.0-rc.2 - 3.11', os: ubuntu-latest}
23+
- {name: '3.12', python: '3.12', os: ubuntu-latest}
24+
- {name: '3.11', python: '3.11', os: ubuntu-latest}
2425
- {name: '3.9', python: '3.9', os: ubuntu-latest}
2526
- {name: '3.8', python: '3.8', os: ubuntu-latest}
2627
- {name: '3.7', python: '3.7', os: ubuntu-latest}
2728
- {name: '3.6', python: '3.6', os: ubuntu-latest}
2829
- {name: '3.5', python: '3.5', os: ubuntu-latest}
2930

3031
steps:
31-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v4
3233
- name: Set up Python ${{ matrix.python }}
33-
uses: actions/setup-python@v4
34+
uses: actions/setup-python@v5
3435
with:
3536
python-version: ${{ matrix.python }}
37+
3638
- name: Install dependencies
3739
run: |
3840
python -m pip install --upgrade pip

.pre-commit-config.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 22.3.0
4-
hooks:
5-
- id: black
6-
language_version: python
7-
args: [--safe]
8-
92
- repo: https://github.com/PyCQA/isort
10-
rev: 5.10.1
3+
rev: 5.13.2
114
hooks:
125
- id: isort
136
language_version: python
147

15-
- repo: https://github.com/PyCQA/flake8
16-
rev: 5.0.4
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.3.5
1710
hooks:
18-
- id: flake8
19-
language_version: python
11+
- id: ruff
12+
args: ["--fix"]
13+
- id: ruff-format
2014

21-
- repo: https://github.com/PyCQA/pydocstyle
22-
rev: 6.1.1
15+
- repo: https://github.com/pre-commit/mirrors-mypy
16+
rev: v1.9.0
2317
hooks:
24-
- id: pydocstyle
18+
- id: mypy
2519
language_version: python
26-
additional_dependencies:
27-
- toml
20+
# No reason to run if only tests have changed. They intentionally break typing.
21+
exclude: tests/.*

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Release Notes
22

3+
### 0.0.1b4 - 2022-10-25
4+
5+
- add python 3.12 support
6+
37
### 0.0.1b3 - 2022-10-25
48

59
- add python 3.9, 3.10, 3.11 support

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Experimental Python wrapper of [vtzero](https://github.com/mapbox/vtzero) a mini
1616
You can install python-vtzero using pip
1717

1818
```bash
19-
$ pip install vtzero
19+
$ python -m pip install vtzero
2020
```
2121

2222
or install from source
@@ -30,7 +30,7 @@ $ git submodule update --init
3030

3131
# Compile Cython module
3232
$ python setup.py build_ext --inplace
33-
$ pip install -e .
33+
$ python -m pip install -e .
3434
```
3535

3636
## Example

pyproject.toml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ default_section = "THIRDPARTY"
1010
[tool.mypy]
1111
no_strict_optional = "True"
1212

13-
[tool.pydocstyle]
14-
select = "D1"
15-
match = "(?!test).*.py"
13+
[tool.ruff]
14+
line-length = 90
15+
16+
[tool.ruff.lint]
17+
select = [
18+
"D1", # pydocstyle errors
19+
"E", # pycodestyle errors
20+
"W", # pycodestyle warnings
21+
"F", # flake8
22+
"C", # flake8-comprehensions
23+
"B", # flake8-bugbear
24+
]
25+
ignore = [
26+
"E501", # line too long, handled by black
27+
"B008", # do not perform function calls in argument defaults
28+
"B905", # ignore zip() without an explicit strict= parameter, only support with python >3.10
29+
"B028",
30+
]

tests/test_fixtures.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""fixtures."""
2+
13
import json
24
from pathlib import Path
35

@@ -26,6 +28,8 @@
2628

2729
@pytest.fixture
2830
def fixture():
31+
"""data fixtures."""
32+
2933
def _(id):
3034
path = ROOT / id
3135
with (path / "info.json").open("r") as f:
@@ -40,6 +44,7 @@ def _(id):
4044

4145

4246
def first_feature(tile):
47+
"""check and return feature."""
4348
assert not tile.empty()
4449
assert len(tile) == 1
4550
layer = next(tile)
@@ -51,13 +56,15 @@ def first_feature(tile):
5156

5257

5358
def test_empty_tile(fixture):
59+
"""empty tile fixture."""
5460
info, data, mvt = fixture("001")
5561
tile = VectorTile(mvt)
5662
assert tile.empty()
5763
assert len(tile) == 0
5864

5965

6066
def test_single_point_without_id(fixture):
67+
"""Point."""
6168
info, data, mvt = fixture("002")
6269
tile = VectorTile(mvt)
6370
feature = first_feature(tile)

tests/test_tile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Test tile encoding."""
2+
13
from vtzero.tile import Layer, Linestring, Point, Polygon, Tile
24

35

0 commit comments

Comments
 (0)