Skip to content

Commit e817921

Browse files
committed
dropping support for python 3.8, 3.9
1 parent 927cf7a commit e817921

19 files changed

Lines changed: 176 additions & 166 deletions

.github/workflows/test.yml

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,52 @@
1-
name: version & unit testing
1+
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "src/**"
8+
- "tests/**"
9+
- "pyproject.toml"
10+
- "requirements*.txt"
11+
- "tox.ini"
12+
- ".github/workflows/test.yml"
13+
pull_request:
14+
branches: [main]
15+
paths:
16+
- "src/**"
17+
- "tests/**"
18+
- "pyproject.toml"
19+
- "requirements*.txt"
20+
- "tox.ini"
21+
- ".github/workflows/test.yml"
422

523
jobs:
6-
build:
24+
test:
725
runs-on: ubuntu-latest
826

927
strategy:
1028
matrix:
11-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
29+
python-version: ["3.10", "3.11", "3.12", "3.13"]
30+
fail-fast: false
1231

1332
steps:
14-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v4
1534

1635
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v5
1837
with:
1938
python-version: ${{ matrix.python-version }}
2039

21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install usaddress regex pytest pydantic
40+
- name: Cache pip
41+
uses: actions/cache@v4
42+
with:
43+
path: ~/.cache/pip
44+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/pyproject.toml', '**/setup.py') }}
45+
restore-keys: |
46+
${{ runner.os }}-pip-
47+
48+
- name: Install tox
49+
run: python -m pip install --upgrade pip tox
2550

26-
- name: Run pytest
27-
run: python -m pytest
51+
- name: Run tests with tox
52+
run: tox -e py

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,24 @@ name = "overturetoosm"
77
dynamic = ["version"]
88
description = 'Translate the Overture maps schema to OpenStreetMap tags.'
99
readme = "README.md"
10-
requires-python = ">=3.8"
10+
requires-python = ">=3.10"
1111
license = "MIT"
1212
keywords = ["overture", "osm", "openstreetmap", "mapping", "overture maps"]
1313
authors = [{ name = "Will", email = "wahubsch@gmail.com" }]
1414
classifiers = [
1515
"Development Status :: 4 - Beta",
1616
"Programming Language :: Python",
1717
"Programming Language :: Python :: 3 :: Only",
18-
"Programming Language :: Python :: 3.8",
19-
"Programming Language :: Python :: 3.9",
2018
"Programming Language :: Python :: 3.10",
2119
"Programming Language :: Python :: 3.11",
2220
"Programming Language :: Python :: 3.12",
21+
"Programming Language :: Python :: 3.13",
2322
"Programming Language :: Python :: Implementation :: CPython",
2423
"Programming Language :: Python :: Implementation :: PyPy",
2524
"License :: OSI Approved :: MIT License",
2625
"Typing :: Typed",
2726
]
28-
dependencies = ["pydantic>=2.8.0", "pytest>=8.3.2"]
27+
dependencies = ["pydantic>=2.11.7"]
2928

3029
[project.urls]
3130
Documentation = "https://whubsch.github.io/overturetoosm/index.html"
@@ -57,7 +56,7 @@ exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
5756
fix = true
5857

5958
[tool.ruff.lint]
60-
select = ["D", "E", "F", "I", "N", "SIM", "TCH"]
59+
select = ["D", "E", "F", "I", "SIM", "UP", "W"]
6160
pydocstyle.convention = "google"
6261
exclude = ["tests/*", "scripts/*"]
6362
isort.split-on-trailing-comma = false

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pydantic>=2.8.0
1+
pydantic>=2.11.7
22
pytest>=8.3.2

scripts/get_wiki.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import json
22
import logging
33
import re
4-
from typing import List, Dict
54

65
import requests
76
from bs4 import BeautifulSoup
87

98

10-
def equals_to_dict(pairs: List[str]) -> Dict[str, str]:
9+
def equals_to_dict(pairs: list[str]) -> dict[str, str]:
1110
"""Convert a string in the format "key=value" into a dictionary."""
1211
return {
1312
key.strip(): value.strip() for key, value in (pair.split("=") for pair in pairs)

scripts/write_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
tags_filled = {k: v for k, v in tags.items() if v}
88

99
new_dict_str = json.dumps(tags_filled, indent=4).replace(":", ": ")
10-
pattern = r"places_tags: Dict\[str, Dict\[str, str\]\]\s*=\s*\{.*\}"
11-
replacement = f"places_tags: Dict[str, Dict[str, str]] = {new_dict_str}"
10+
pattern = r"places_tags: dict\[str, dict\[str, str\]\]\s*=\s*\{.*\}"
11+
replacement = f"places_tags: dict[str, dict[str, str]] = {new_dict_str}"
1212

1313
with open("src/overturetoosm/resources.py", "r", encoding="utf-8") as f:
1414
contents = f.read()

src/overturetoosm/addresses.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"""Convert Overture's `addresses` features to OSM tags."""
22

3-
from typing import Dict
4-
53
from .objects import AddressProps
64

75

8-
def process_address(props: dict, style: str = "US") -> Dict[str, str]:
6+
def process_address(props: dict, style: str = "US") -> dict[str, str]:
97
"""Convert Overture's address properties to OSM tags.
108
119
Args:
@@ -14,7 +12,7 @@ def process_address(props: dict, style: str = "US") -> Dict[str, str]:
1412
a pull request or issue to add support for other regions. Defaults to "US".
1513
1614
Returns:
17-
Dict[str, str]: The reshaped and converted properties in OSM's flat
15+
dict[str, str]: The reshaped and converted properties in OSM's flat
1816
str:str schema.
1917
"""
2018
return AddressProps(**props).to_osm(style)

src/overturetoosm/buildings.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
"""Convert Overture's `buildings` features to OSM tags."""
22

3-
from typing import Dict
4-
53
from .objects import BuildingProps
64

75

8-
def process_building(props: dict, confidence: float = 0.0) -> Dict[str, str]:
6+
def process_building(props: dict, confidence: float = 0.0) -> dict[str, str]:
97
"""Convert Overture's building properties to OSM tags.
108
119
Args:
1210
props (dict): The feature properties from the Overture GeoJSON.
1311
confidence (float, optional): The minimum confidence level. Defaults to 0.0.
1412
1513
Returns:
16-
Dict[str, str]: The reshaped and converted properties in OSM's flat
14+
dict[str, str]: The reshaped and converted properties in OSM's flat
1715
str:str schema.
1816
1917
Raises:

src/overturetoosm/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def main():
7070

7171
args = parser.parse_args()
7272

73-
with open(args.input, "r", encoding="utf-8") as f:
73+
with open(args.input, encoding="utf-8") as f:
7474
contents: dict = json.load(f)
7575
geojson = {}
7676
if args.fx_type == "place":

0 commit comments

Comments
 (0)