From b50c67972ae85315bc0a6815c72ab1ab9f4cb6c1 Mon Sep 17 00:00:00 2001 From: Martijn van Exel Date: Sun, 9 Oct 2022 10:56:59 -0600 Subject: [PATCH 1/4] Create FUNDING.yml --- .github/FUNDING.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..f1494b4bbb4 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,5 @@ +# These are supported funding model platforms + +github: [mvexel] +patreon: mvexel +liberapay: mvexel From 9e44c025842ebe4f299bf84674cb2270e88ef5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= <6774676+eumiro@users.noreply.github.com> Date: Sun, 25 Jun 2023 20:35:49 +0200 Subject: [PATCH 2/4] Add Python 3.11, drop below 3.8, update deps --- .github/workflows/ci.yml | 2 +- .travis.yml | 3 ++- Pipfile | 8 ++++---- requirements-dev.txt | 4 ++-- requirements.txt | 6 +++--- setup.py | 3 ++- tox.ini | 7 ++++--- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46b0c761d5d..edbce9c051f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 5 matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v1 diff --git a/.travis.yml b/.travis.yml index bfffb7a3f6b..44b6356c971 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: python python: - - 3.7 - 3.8 - 3.9 + - 3.10 + - 3.11 install: - sudo apt-get install libgeos-dev - pip install -r requirements-dev.txt diff --git a/Pipfile b/Pipfile index 364c7874e94..b08b60a93c8 100644 --- a/Pipfile +++ b/Pipfile @@ -4,10 +4,10 @@ verify_ssl = true name = "pypi" [packages] -geojson = ">=1.3.1" -pytest = "6.0.0" -requests = ">=2.20.0" -shapely = ">=1.6.4" +geojson = ">=3.0.1" +pytest = "7.4.0" +requests = ">=2.31.0" +shapely = ">=2.0.1" [dev-packages] diff --git a/requirements-dev.txt b/requirements-dev.txt index e367ca6893b..107faeb50b1 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,3 @@ -pytest>=6.2.0 +pytest>=7.4.0 requests-mock[fixture] -tox>=3.20.1 +tox>=4.6.3 diff --git a/requirements.txt b/requirements.txt index 5c74d91e9a1..1148fd78ed4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -geojson>=1.3.1 +geojson>=3.0.1 pytest -requests>=2.8.1 -shapely>=1.6.4 \ No newline at end of file +requests>=2.31.0 +shapely>=2.0.1 \ No newline at end of file diff --git a/setup.py b/setup.py index a0622434b33..d60d30896b3 100644 --- a/setup.py +++ b/setup.py @@ -13,9 +13,10 @@ keywords=["openstreetmap", "overpass", "wrapper"], classifiers=[ "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: GIS", "Topic :: Utilities", ], diff --git a/tox.ini b/tox.ini index 1a513e394cf..235ed60c802 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39} +envlist = py{38,39,310,311} skip_missing_interpreters = true [testenv] @@ -8,6 +8,7 @@ commands = python -m pytest [gh-actions] python = - 3.7: py37 3.8: py38 - 3.9: py39 \ No newline at end of file + 3.9: py39 + 3.10: py310 + 3.11: py311 \ No newline at end of file From 304573c2f641e051bbb1691df0462ef5412736c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= <6774676+eumiro@users.noreply.github.com> Date: Sun, 25 Jun 2023 22:12:24 +0200 Subject: [PATCH 3/4] Few minor Python 3 code modernizations --- overpass/api.py | 42 ++++++++++++++++++------------------------ tests/test_api.py | 2 +- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/overpass/api.py b/overpass/api.py index 5dfee7c389a..24a79253aee 100644 --- a/overpass/api.py +++ b/overpass/api.py @@ -60,12 +60,7 @@ def __init__(self, *args, **kwargs): self._status = None if self.debug: - # https://stackoverflow.com/a/16630836 - try: - import http.client as http_client - except ImportError: - # Python 2 - import httplib as http_client + import http.client as http_client http_client.HTTPConnection.debuglevel = 1 # You must initialize logging, @@ -152,19 +147,18 @@ def _api_status() -> dict: available_slots = int( next( ( - available_re.search(line).group() + m.group() for line in lines - if available_re.search(line) + if (m := available_re.search(line)) ), 0 ) ) waiting_re = re.compile(r'(?<=Slot available after: )[\d\-TZ:]{20}') waiting_slots = tuple( - datetime.strptime( - waiting_re.search(line).group(), "%Y-%m-%dT%H:%M:%S%z" - ) - for line in lines if waiting_re.search(line) + datetime.strptime(m.group(), "%Y-%m-%dT%H:%M:%S%z") + for line in lines + if (m := waiting_re.search(line)) ) current_idx = next( @@ -248,7 +242,7 @@ def _construct_ql_query(self, userquery, responseformat, verbosity, date): raw_query += ";" if date: - date = f'[date:"{date.strftime("%Y-%m-%dT%H:%M:%SZ")}"]' + date = f'[date:"{date:%Y-%m-%dT%H:%M:%SZ}"]' if responseformat == "geojson": template = self._GEOJSON_QUERY_TEMPLATE @@ -281,19 +275,19 @@ def _get_from_overpass(self, query): self._status = r.status_code - if self._status != 200: - if self._status == 400: - raise OverpassSyntaxError(query) - elif self._status == 429: - raise MultipleRequestsError() - elif self._status == 504: - raise ServerLoadError(self._timeout) - raise UnknownOverpassError( - "The request returned status code {code}".format(code=self._status) - ) - else: + if self._status == 200: r.encoding = "utf-8" return r + elif self._status == 400: + raise OverpassSyntaxError(query) + elif self._status == 429: + raise MultipleRequestsError() + elif self._status == 504: + raise ServerLoadError(self._timeout) + else: + raise UnknownOverpassError( + f"The request returned status code {self._status}" + ) def _as_geojson(self, elements): ids_already_seen = set() diff --git a/tests/test_api.py b/tests/test_api.py index 95c9c091220..bd9b9d3fad9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -189,7 +189,7 @@ def test_api_status(response: Path, slots_available: int, slots_running: Tuple[d map_query = overpass.MapQuery(37.86517, -122.31851, 37.86687, -122.31635) api.get(map_query) - assert api.slots_available <= 2 and api.slots_available >= 0 + assert 0 <= api.slots_available <= 2 assert api.slots_available == slots_available assert isinstance(api.slots_running, tuple) From af448d3ac85661c7bec12aeef160ce67c0622464 Mon Sep 17 00:00:00 2001 From: Martijn van Exel Date: Wed, 7 Feb 2024 15:58:36 -0700 Subject: [PATCH 4/4] Update README.md We're good with maintainers --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index d31144e1880..01b42f916ac 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ Overpass API python wrapper =========================== -**Looking for a maintainer** -*Hi there, I am the original author of this project. I no longer have time to maintain it but it looks like it's still useful. I'd like to talk to someone who thinks they can take this on. Drop me a line at m@rtijn.org. Thanks! Martijn van Exel* - Python bindings for the OpenStreetMap [Overpass API](http://wiki.openstreetmap.org/wiki/Overpass_API).