Repository navigation
Modernize packaging, tests and CI - #35
Merged
Merged
Conversation
The tests in test_load.py asserted element counts from live OSM data, and six of them had drifted. They now replay responses saved on 2026-10-14 in tests/data/overpass_responses.json, looked up by query with coordinates rounded to six decimals, so they are deterministic and run offline. OSMNET_RECORD_OVERPASS=1 queries the live API and saves fresh responses. Expected values are updated to the saved data. The two tests that check live server behavior, plus a small network_from_bbox smoke test, move to test_live.py and run only with OSMNET_LIVE_TESTS=1 (replacing OSMNET_SKIP_NETWORK_TESTS). test_ways_in_bbox now asserts its DataFrame comparisons.
Use shapely.ops.unary_union, which works with both the GeoPandas 0.11 floor and GeoPandas 1.x, where union_all replaces the attribute.
Replace setup.py with pyproject.toml (setuptools >= 77, version read from osmnet/__init__.py, license AGPL-3.0-only). Require Python 3.10+ and declare floors that the minimum-dependencies job tests through requirements-min.txt: NumPy 1.21, pandas 1.5 (<4), GeoPandas 0.11, Shapely 1.8, requests 2.28. Add test, docs and dev extras. Ship the tests and their data in the sdist but not the wheel. Coverage settings move from .coveragerc. Version 0.2.dev0.
Python 3.10 with minimum dependencies on Linux; Python 3.14 with current dependencies on Linux, macOS and Windows; pycodestyle; package build, twine check, wheel install and import outside the tree; strict Sphinx build. Actions are pinned by SHA with read-only permissions. A live Overpass API job runs only on workflow_dispatch. Dependabot keeps the action pins current. Remove the Travis and AppVeyor configurations.
Drop the deprecated sphinx_rtd_theme.get_html_theme_path() call and set language to 'en'. State the Python 3.10 requirement and remove the obsolete Windows wheel instructions. Replace the dead Travis, AppVeyor and Coveralls badges with the CI badge. Add changelog entries.
Compare query coordinates within 1e-6 instead of rounding them to six decimals, which could still split two nearly equal values across a rounding boundary. Record mode now queries each request once and writes only the queries the run makes, so the saved file stays consistent and drops queries no longer used; the file is re-recorded this way (same elements, new timestamps, unrounded keys). Replayed responses are deep copies, so a test cannot change what later tests see.
Rewrite CONTRIBUTING.md, which still described setup.py, Python 3.5-3.8 and PRs to dev, following urbansim's: project status, tests with saved Overpass responses, pycodestyle, version and changelog conventions, the release-candidate process, and the current manual PyPI upload. Read the documentation version from osmnet.__version__. Cancel superseded CI runs only on pull requests, so every push to main finishes. Correct the Dependabot comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modernizes packaging, tests and CI ahead of 0.2, following the setup used in Orca, UrbanSim and ChoiceModels. Code behavior is unchanged apart from the GeoPandas deprecation fix.
Packaging
pyproject.tomlreplacessetup.py(setuptools ≥ 77, version read fromosmnet/__init__.py, now0.2.dev0).requirements-min.txtfor the minimum-deps job: NumPy 1.21, pandas 1.5 (<4), GeoPandas 0.11, Shapely 1.8, requests 2.28. The GeoPandas and Shapely floors are unchanged. NumPy and pandas rise to the oldest versions that support Python 3.10, matching Orca and ChoiceModels.python-dateutilisn't needed (Fix Overpass status check, cap retries, add CI #34 removed the import).test,docsanddevextras;requirements-dev.txtis-e .[dev,docs,test].AGPL-3.0-only(SPDX). The previous metadata said "AGPL" with the v3 classifier, and no source file grants "or any later version".Tests
test_load.pynow replay Overpass responses saved today inosmnet/tests/data/overpass_responses.json(183 KB), so they no longer depend on the live API or on later OSM edits. Six of them had drifted. For example, the 100.6 m Telegraph Avenue segment those tests checked is now split by a crosswalk node into 90.5 m + 10.1 m. Expected values are updated accordingly.OSMNET_RECORD_OVERPASS=1refreshes the saved responses from the live API.test_live.pyand run only withOSMNET_LIVE_TESTS=1. This replacesOSMNET_SKIP_NETWORK_TESTSfrom Fix Overpass status check, cap retries, add CI #34, which was never released.test_ways_in_bbox, which compared DataFrames without asserting.CI
ci.ymltwine check --strict+ wheel install + import outside the tree; strict Sphinx build (-W).workflow_dispatchonly.contents: read,persist-credentials: false. Dependabot for actions.Code
project_gdfusesshapely.ops.unary_unioninstead of GeoPandas' deprecatedGeoSeries.unary_union. It works with GeoPandas 0.11 and 1.x. The test suite now runs warning-free with-W error.Docs
conf.py: removed the deprecatedget_html_theme_path()call;language = 'en'.docs/README.md: new build command.Verified locally: Python 3.14 (NumPy 2.5, pandas 3.0, GeoPandas 1.2, Shapely 2.2) and Python 3.10 with the minimum versions both pass; pycodestyle and actionlint are clean; the strict docs build passes; the wheel installs cleanly (
pip check) and its tests pass from outside the tree.Next: a publishing workflow PR (Trusted Publishing, as in the other UDST repos) with a CONTRIBUTING rewrite, then 0.2rc1.