From cf8b50aa932fb3838ff1fabe496da75545d2971c Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Mon, 13 Jan 2025 14:10:24 -0800 Subject: [PATCH 1/4] pretty format json --- .pre-commit-config.yaml | 13 +++------ environments/requirements/environments.json | 32 ++++++++++----------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fd3f57e9..da3addf0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,21 +19,16 @@ repos: - id: fix-byte-order-marker - id: mixed-line-ending - id: no-commit-to-branch - args: [--branch, main] + args: [--branch=main] + - id: pretty-format-json + args: [--autofix] - id: trailing-whitespace - repo: https://github.com/adrienverge/yamllint rev: v1.35.1 hooks: - id: yamllint - args: - - --strict - - > - -d={extends: default, rules: { - document-start: disable, - line-length: {max: 110}, - quoted-strings: {quote-type: single, required: only-when-needed}, - truthy: {check-keys: false}}} + args: [--strict, --config-file, ./tests/.yamllint.yml] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.8.6 diff --git a/environments/requirements/environments.json b/environments/requirements/environments.json index aca993ae..5968358e 100644 --- a/environments/requirements/environments.json +++ b/environments/requirements/environments.json @@ -1,39 +1,39 @@ [ { - "output_path": "./environments/tests/env-ci.yml", - "needs_dependencies": true, - "pin_exact": false, "extras": [ "./environments/requirements/requirements-docs.txt", "./environments/requirements/requirements-packaging.txt", "./environments/requirements/requirements-tests.txt" - ] + ], + "needs_dependencies": true, + "output_path": "./environments/tests/env-ci.yml", + "pin_exact": false }, { - "output_path": "./environments/tests/env-test-minimum-deps.yml", - "needs_dependencies": true, - "pin_exact": true, "extras": [ "./environments/requirements/requirements-tests.txt" - ] + ], + "needs_dependencies": true, + "output_path": "./environments/tests/env-test-minimum-deps.yml", + "pin_exact": true }, { - "output_path": "./environments/tests/requirements-test-latest-deps.txt", - "needs_dependencies": true, - "pin_exact": false, "extras": [ "./environments/requirements/requirements-tests.txt" - ] + ], + "needs_dependencies": true, + "output_path": "./environments/tests/requirements-test-latest-deps.txt", + "pin_exact": false }, { - "output_path": "./environments/requirements/requirements-all.txt", - "needs_dependencies": true, - "pin_exact": false, "extras": [ "./environments/requirements/requirements-docs.txt", "./environments/requirements/requirements-extras.txt", "./environments/requirements/requirements-packaging.txt", "./environments/requirements/requirements-tests.txt" - ] + ], + "needs_dependencies": true, + "output_path": "./environments/requirements/requirements-all.txt", + "pin_exact": false } ] From f8ce6a98012192789f5ed23f6aa5dde36d345752 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Mon, 13 Jan 2025 14:10:39 -0800 Subject: [PATCH 2/4] add yamllint config file --- tests/.yamllint.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/.yamllint.yml diff --git a/tests/.yamllint.yml b/tests/.yamllint.yml new file mode 100644 index 00000000..f52c0c82 --- /dev/null +++ b/tests/.yamllint.yml @@ -0,0 +1,10 @@ +extends: default +rules: + document-start: disable + line-length: + max: 110 + quoted-strings: + quote-type: single + required: only-when-needed + truthy: + check-keys: false From 8e07287536da4565e0ce978425d40a79cb1fd8f7 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Mon, 13 Jan 2025 14:24:49 -0800 Subject: [PATCH 3/4] upgrade ruff --- .pre-commit-config.yaml | 2 +- osmnx/io.py | 1 + tests/test_osmnx.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index da3addf0..9096ea8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: args: [--strict, --config-file, ./tests/.yamllint.yml] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.1 hooks: - id: ruff args: [--fix] diff --git a/osmnx/io.py b/osmnx/io.py index b456f2b8..45c66719 100644 --- a/osmnx/io.py +++ b/osmnx/io.py @@ -1,3 +1,4 @@ +# ruff: noqa: A005 """File I/O functions to save/load graphs to/from files on disk.""" from __future__ import annotations diff --git a/tests/test_osmnx.py b/tests/test_osmnx.py index 8edca370..0a0c9bfe 100644 --- a/tests/test_osmnx.py +++ b/tests/test_osmnx.py @@ -44,7 +44,7 @@ address = "600 Montgomery St, San Francisco, California, USA" place1 = {"city": "Piedmont", "state": "California", "country": "USA"} polygon_wkt = ( - "POLYGON ((-122.262 37.869, -122.255 37.869, -122.255 37.874," + "POLYGON ((-122.262 37.869, -122.255 37.869, -122.255 37.874, " "-122.262 37.874, -122.262 37.869))" ) polygon = ox.utils_geo.buffer_geometry(geom=wkt.loads(polygon_wkt), dist=1) From e96d5085daa0f5a08d9b073c4e0d8d07382662ba Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Mon, 13 Jan 2025 14:39:59 -0800 Subject: [PATCH 4/4] update yaml lint --- .github/workflows/ci.yml | 8 +++++++- .pre-commit-config.yaml | 3 +-- tests/.yamllint.yml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21fa4ab8..824f22f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,13 @@ jobs: run: python -m sphinx -E -W --keep-going -b html ./docs/source ./docs/build/html - name: Test code and coverage - run: python -m pytest --verbose --maxfail=1 --typeguard-packages=osmnx --cov=osmnx --cov-report=xml + run: > + python -m pytest + --verbose + --maxfail=1 + --typeguard-packages=osmnx + --cov=osmnx + --cov-report=xml - name: Upload coverage report uses: codecov/codecov-action@v5 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9096ea8a..8d6ae3c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,6 @@ repos: - id: fix-byte-order-marker - id: mixed-line-ending - id: no-commit-to-branch - args: [--branch=main] - id: pretty-format-json args: [--autofix] - id: trailing-whitespace @@ -28,7 +27,7 @@ repos: rev: v1.35.1 hooks: - id: yamllint - args: [--strict, --config-file, ./tests/.yamllint.yml] + args: [--strict, --config-file=./tests/.yamllint.yml] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.9.1 diff --git a/tests/.yamllint.yml b/tests/.yamllint.yml index f52c0c82..e1effbeb 100644 --- a/tests/.yamllint.yml +++ b/tests/.yamllint.yml @@ -2,7 +2,7 @@ extends: default rules: document-start: disable line-length: - max: 110 + max: 100 quoted-strings: quote-type: single required: only-when-needed