Skip to content

Modernize packaging, tests and CI - #35

Merged
waddell merged 7 commits into
mainfrom
maintenance/packaging-ci
Oct 22, 2026
Merged

waddell merged 7 commits into
mainfrom
maintenance/packaging-ci

Conversation

@smmaurer

@smmaurer smmaurer commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

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.toml replaces setup.py (setuptools ≥ 77, version read from osmnet/__init__.py, now 0.2.dev0).
  • Requires Python 3.10+; classifiers 3.10–3.14.
  • Dependency floors are now ones we actually test, pinned in requirements-min.txt for 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-dateutil isn't needed (Fix Overpass status check, cap retries, add CI #34 removed the import).
  • test, docs and dev extras; requirements-dev.txt is -e .[dev,docs,test].
  • License declared as AGPL-3.0-only (SPDX). The previous metadata said "AGPL" with the v3 classifier, and no source file grants "or any later version".
  • Tests and their data ship in the sdist, not the wheel.

Tests

  • The tests in test_load.py now replay Overpass responses saved today in osmnet/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=1 refreshes the saved responses from the live API.
  • The tests that check live server behavior move to test_live.py and run only with OSMNET_LIVE_TESTS=1. This replaces OSMNET_SKIP_NETWORK_TESTS from Fix Overpass status check, cap retries, add CI #34, which was never released.
  • Fixed test_ways_in_bbox, which compared DataFrames without asserting.
  • Suite: 46 passed, 3 skipped (live); 95% coverage.

CI

  • Consolidated into ci.yml
  • Python 3.10 + minimum deps (Linux); Python 3.14 + latest deps (Linux, macOS, Windows); code style (pycodestyle); package build + twine check --strict + wheel install + import outside the tree; strict Sphinx build (-W).
  • Live Overpass API job, run on workflow_dispatch only.
  • Actions pinned by SHA, contents: read, persist-credentials: false. Dependabot for actions.
  • Travis and AppVeyor configurations removed, along with their README badges; the CI badge replaces them.

Code

  • project_gdf uses shapely.ops.unary_union instead of GeoPandas' deprecated GeoSeries.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 deprecated get_html_theme_path() call; language = 'en'.
  • Installation page: Python 3.10+; removed the obsolete Windows instructions.
  • 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.

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.

@waddell waddell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge

@waddell
waddell merged commit 01d6eb8 into main Oct 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants