Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Commit f9b1600

Browse files
authored
Merge pull request #178 from mvexel/maintenance/modernize-plan
Modernize toolchain (uv/mise, Py 3.11+)
2 parents e1a7b43 + 70d0ea3 commit f9b1600

12 files changed

Lines changed: 520 additions & 711 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.11", "3.12", "3.13"]
15+
steps:
16+
- uses: actions/checkout@v5
17+
- name: Set up Python
18+
uses: actions/setup-python@v6
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v7
23+
with:
24+
enable-cache: true
25+
- name: Sync dependencies
26+
run: uv sync --group dev --frozen
27+
- name: Lint
28+
run: uv run ruff check
29+
- name: Format
30+
run: uv run ruff format --check
31+
- name: Type check
32+
run: uv run ty check
33+
- name: Tests
34+
run: uv run pytest tests/ --import-mode importlib

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ pip-log.txt
1414
docs/_build/
1515
Pipfile.lock
1616
venv/
17+
.venv/
1718
.tox
19+
.ruff_cache/

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@ Overpass API python wrapper
55
API](http://wiki.openstreetmap.org/wiki/Overpass_API) for Python.
66

77
![shell recording](assets/overpass-demo.gif)
8+
![CI](https://github.com/mvexel/overpass-api-python-wrapper/actions/workflows/ci.yml/badge.svg)
89

910
Install it
1011
==========
1112

1213
`pip install overpass`
1314

15+
## Development
16+
17+
This project targets Python 3.11-3.13 and uses `mise` + `uv` for the toolchain.
18+
19+
```bash
20+
mise install
21+
uv sync --group dev
22+
uv run ruff check
23+
uv run ruff format
24+
uv run ty check
25+
uv run pytest tests/ --import-mode importlib
26+
```
27+
1428
## Usage
1529

1630
### `API()` constructor

README.rst

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,9 @@
1-
Overpass API python wrapper
2-
===========================
1+
Deprecated README.rst
2+
=====================
33

4-
.. image:: https://github.com/mvexel/overpass-api-python-wrapper/workflows/CI/badge.svg
5-
:target: https://github.com/mvexel/overpass-api-python-wrapper/actions?query=workflow%3ACI
4+
This file is deprecated. Please use ``README.md`` instead.
65

7-
8-
This is a thin wrapper around the OpenStreetMap `Overpass
9-
API <http://wiki.openstreetmap.org/wiki/Overpass_API>`__.
10-
11-
12-
|Build Status|
13-
14-
Install it
15-
==========
16-
17-
``pip install overpass``
18-
19-
Usage
20-
-----
21-
22-
Simplest example:
23-
24-
.. code:: python
25-
26-
import overpass
27-
api = overpass.API()
28-
response = api.get('node["name"="Salt Lake City"]')
29-
30-
``response`` will be a dictionary representing the JSON output you would
31-
get `from the Overpass API
32-
directly <https://overpass-api.de/output_formats.html#json>`__.
33-
34-
Note that the Overpass query passed to ``get()`` should not contain any
35-
``out`` or other meta statements.
36-
37-
Another example:
38-
39-
.. code:: python
40-
41-
>>> print [(
42-
... feature['properties']['name'],
43-
... feature['id']) for feature in response["features"]]
44-
[(u'Salt Lake City', 150935219), (u'Salt Lake City', 585370637)]
45-
46-
You can find more examples in the ``examples/`` directory of this
47-
repository.
48-
49-
Response formats
50-
~~~~~~~~~~~~~~~~
51-
52-
You can set the response type of your query using ``get()``\ ’s
53-
``responseformat`` parameter to GeoJSON (``geojson``, the default),
54-
plain JSON (``json``), CSV (``csv``), and OSM XML (``xml``).
55-
56-
.. code:: python
57-
58-
response = api.get('node["name"="Salt Lake City"]', responseformat="xml")
59-
60-
Parameters
61-
~~~~~~~~~~
62-
63-
The API object takes a few parameters:
64-
65-
``endpoint``
66-
^^^^^^^^^^^^
67-
68-
The default endpoint is ``https://overpass-api.de/api/interpreter`` but
69-
you can pass in another instance:
70-
71-
.. code:: python
72-
73-
api = overpass.API(endpoint=https://overpass.myserver/interpreter)
74-
75-
``timeout``
76-
^^^^^^^^^^^
77-
78-
The default timeout is 25 seconds, but you can set it to whatever you
79-
want.
6+
The Markdown version is the canonical documentation and is kept up to date.
807

818
.. code:: python
829
@@ -139,6 +66,3 @@ Where did the CLI tool go?
13966
~~~~~~~~~~~~~~~~~~~~~~~~~~
14067

14168
The command line tool was deprecated in version 0.4.0.
142-
143-
.. |Build Status| image:: https://travis-ci.org/mvexel/overpass-api-python-wrapper.svg?branch=master
144-
:target: https://travis-ci.org/mvexel/overpass-api-python-wrapper

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tools]
2+
python = "3.11"
3+
uv = "latest"

poetry.lock

Lines changed: 0 additions & 571 deletions
This file was deleted.

pyproject.toml

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,62 @@
1-
[tool.poetry]
1+
[project]
22
name = "overpass"
33
version = "0.7.2"
44
description = "A Python interface to the OpenStreetMap Overpass API"
5-
authors = ["Martijn van Exel <m@rtijn.org>"]
6-
license = "Apache-2.0"
75
readme = "README.md"
8-
homepage = "https://github.com/mvexel/overpass-api-python-wrapper"
9-
packages = [{ include = "overpass" }]
6+
requires-python = ">=3.11,<3.14"
7+
license = { text = "Apache-2.0" }
8+
authors = [{ name = "Martijn van Exel", email = "m@rtijn.org" }]
9+
keywords = ["openstreetmap", "overpass", "wrapper"]
10+
classifiers = [
11+
"License :: OSI Approved :: Apache Software License",
12+
"Programming Language :: Python :: 3",
13+
"Programming Language :: Python :: 3.11",
14+
"Programming Language :: Python :: 3.12",
15+
"Programming Language :: Python :: 3.13",
16+
"Topic :: Scientific/Engineering :: GIS",
17+
"Topic :: Utilities",
18+
]
19+
dependencies = [
20+
"osm2geojson>=0.2.5",
21+
"requests>=2.32.3",
22+
]
1023

24+
[project.urls]
25+
Homepage = "https://github.com/mvexel/overpass-api-python-wrapper"
26+
Repository = "https://github.com/mvexel/overpass-api-python-wrapper"
1127

12-
[tool.poetry.dependencies]
13-
python = ">3.9, <3.12"
14-
osm2geojson = "^0.2.5"
15-
requests = "^2.32.3"
28+
[dependency-groups]
29+
dev = [
30+
"pytest>=7.4.0",
31+
"geojson>=3.1.0",
32+
"requests-mock>=1.12.1",
33+
"deepdiff>=7.0.1",
34+
"ruff>=0.6.0",
35+
"ty>=0.0.9",
36+
]
1637

17-
[tool.poetry.group.dev.dependencies]
18-
pytest = "^7.4.0"
19-
geojson = "^3.1.0"
20-
requests-mock = { extras = ["fixtures"], version = "^1.12.1" }
21-
deepdiff = "^7.0.1"
22-
tox = "^4.17.1"
38+
[tool.hatch.build.targets.wheel]
39+
packages = ["overpass"]
40+
41+
[tool.ruff]
42+
line-length = 100
43+
target-version = "py311"
44+
45+
[tool.ruff.lint]
46+
select = ["E", "F", "I"]
47+
48+
[tool.ruff.format]
49+
quote-style = "double"
50+
51+
[tool.ty.environment]
52+
python-version = "3.11"
53+
54+
[tool.ty.src]
55+
include = ["overpass", "tests"]
56+
57+
[tool.pytest.ini_options]
58+
markers = ["integration: network-dependent tests"]
2359

2460
[build-system]
25-
requires = ["poetry-core>=1.0.0"]
26-
build-backend = "poetry.core.masonry.api"
61+
requires = ["hatchling>=1.25.0"]
62+
build-backend = "hatchling.build"

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/test_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from typing import Tuple, Union
1111

1212
import geojson
13+
import os
14+
1315
import pytest
1416
from deepdiff import DeepDiff
1517

@@ -52,10 +54,13 @@ def test_geojson(
5254
assert len(osm_geo["features"]) > length
5355

5456

57+
@pytest.mark.integration
5558
def test_multipolygon():
5659
"""
5760
Test that multipolygons are processed without error
5861
"""
62+
if not os.getenv("RUN_NETWORK_TESTS"):
63+
pytest.skip("requires live Overpass API; set RUN_NETWORK_TESTS=1")
5964
api = overpass.API()
6065
api.get("rel(11038555)", verbosity="body geom")
6166

0 commit comments

Comments
 (0)