Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linters and pre-commit #71

Merged
merged 9 commits into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ on:
branches: [main]

jobs:

build:

name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -22,7 +20,6 @@ jobs:
shell: bash -elo pipefail {0}

steps:

- name: Checkout repo
uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.vrt
keys.py
*.py
notebooks/cache/*
notebooks/data/*
notebooks/logs/*
Expand Down
40 changes: 26 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: "v4.4.0"
hooks:
- id: check-added-large-files
args: [--maxkb=50]
- id: check-builtin-literals
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
args: [--assume-in-merge]
- id: check-yaml
Expand All @@ -15,18 +13,32 @@ repos:
- id: mixed-line-ending
- id: no-commit-to-branch
args: [--branch, main]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0"
hooks:
- id: prettier
types_or: [markdown, yaml]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: "1.7.0"
hooks:
- id: nbqa-isort
additional_dependencies: [isort]
args: [--line-length=100, --sl]
- id: nbqa-black
additional_dependencies: [black]
args: [--line-length=100]
- id: nbqa-flake8
additional_dependencies: [flake8]
args: [--max-line-length=100]

- repo: local
hooks:
- id: nbqa-isort
additional_dependencies: [isort]
args: [--line-length=100, --sl, --check-only]
- id: nbqa-black
additional_dependencies: [black]
args: [--line-length=100, --check]
- id: nbqa-flake8
additional_dependencies: [flake8]
args: [--max-line-length=100]
- id: nbconvert
name: clear notebook output
entry: jupyter nbconvert
language: system
types: [jupyter]
args: ["--clear-output", "--inplace"]
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Thanks for using OSMnx and for considering contributing to it! This issue tracke

## Contribute an example/demo

- post your proposal in the [issue tracker](https://github.com/gboeing/osmnx-examples/issues) or submit a PR with the new Jupyter notebook
- respond to code review
- post your proposal in the [issue tracker](https://github.com/gboeing/osmnx-examples/issues) or submit a PR with the new Jupyter notebook
- respond to code review

Every piece of software is a work in progress. This project is the result of many hours of work contributed freely by myself and the many people that build the projects it depends on. Thank you for contributing!
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
This gallery contains step-by-step usage tutorials and feature demonstrations as Jupyter notebooks. You can run these notebooks interactively online with [Binder](https://mybinder.org/v2/gh/gboeing/osmnx-examples/main?urlpath=lab) or locally with the official OSMnx [Docker image](https://hub.docker.com/r/gboeing/osmnx). All of the examples are in this repo's [notebooks](notebooks) folder. Note that this repo's main branch generally tracks the functionality of the OSMnx repo's main branch. For examples corresponding to previously released versions of OSMnx, use this repo's tags to browse by release.

### More info:
- [Overview of OSMnx](https://geoffboeing.com/2016/11/osmnx-python-street-networks/)
- [OSMnx repo](https://github.com/gboeing/osmnx)
- [Documentation](https://osmnx.readthedocs.io/)
- [Journal article and citation info](https://geoffboeing.com/publications/osmnx-complex-street-networks/)

- [Overview of OSMnx](https://geoffboeing.com/2016/11/osmnx-python-street-networks/)
- [OSMnx repo](https://github.com/gboeing/osmnx)
- [Documentation](https://osmnx.readthedocs.io/)
- [Journal article and citation info](https://geoffboeing.com/publications/osmnx-complex-street-networks/)
4 changes: 2 additions & 2 deletions notebooks/06-stats-indicators-centrality.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
"# unpack dicts into individiual keys:values\n",
"stats = ox.basic_stats(G, area=area)\n",
"for k, count in stats[\"streets_per_node_counts\"].items():\n",
" stats[\"{}way_int_count\".format(k)] = count\n",
" stats[f\"{k}way_int_count\"] = count\n",
"for k, proportion in stats[\"streets_per_node_proportions\"].items():\n",
" stats[\"{}way_int_prop\".format(k)] = proportion\n",
" stats[f\"{k}way_int_prop\"] = proportion\n",
"\n",
"# delete the no longer needed dict elements\n",
"del stats[\"streets_per_node_counts\"]\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/12-node-elevations-edge-grades.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@
"outputs": [],
"source": [
"avg_grade = np.mean(grades)\n",
"print(\"Average street grade in {} is {:.1f}%\".format(place, avg_grade * 100))\n",
"print(f\"Average street grade in {place} is {avg_grade * 100:.1f}%\")\n",
"\n",
"med_grade = np.median(grades)\n",
"print(\"Median street grade in {} is {:.1f}%\".format(place, med_grade * 100))"
"print(f\"Median street grade in {place} is {med_grade * 100:.1f}%\")"
]
},
{
Expand Down Expand Up @@ -304,7 +304,7 @@
" print(msg.format(np.sum(route_rises), ascent, abs(descent)))\n",
"\n",
" route_lengths = ox.utils_graph.route_to_gdf(G, route, weight=\"length\")[\"length\"]\n",
" print(\"Total trip distance: {:,.0f} meters\".format(np.sum(route_lengths)))"
" print(f\"Total trip distance: {np.sum(route_lengths):,.0f} meters\")"
]
},
{
Expand Down
6 changes: 1 addition & 5 deletions tests/environment-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ name: osmnx-examples
channels:
- conda-forge
dependencies:
- black
- flake8
- isort
- jupyterlab
- nbqa
- jupyter
- osmnx=1.5.1
- pillow
- pre-commit
Expand Down
4 changes: 0 additions & 4 deletions tests/lint_format.sh

This file was deleted.