Skip to content

Modernize packaging and current dependency compatibility - #239

Merged
smmaurer merged 5 commits into
mainfrom
maintenance/packaging-compatibility
Sep 3, 2026
Merged

Modernize packaging and current dependency compatibility#239
smmaurer merged 5 commits into
mainfrom
maintenance/packaging-compatibility

Conversation

@waddell

@waddell waddell commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

Modernizes UrbanSim's packaging and establishes a tested dependency range from
Python 3.10 with minimum dependencies through Python 3.14 with current
dependencies.

Packaging and dependency policy

  • moves package metadata from setup.py to pyproject.toml;
  • declares separate network, test, documentation, and development extras;
  • makes Pandana 0.8 the supported network-integration dependency;
  • establishes NumPy 1.26 and Pandas 2.2 as the tested lower bounds;
  • tests current NumPy 2 and Pandas 3 releases on Python 3.14;
  • builds and validates source and wheel distributions in CI;
  • installs the wheel, checks its dependencies, and imports it outside the
    source tree; and
  • removes the obsolete Travis CI and AppVeyor configurations.

Pandana remains optional for the core UrbanSim installation. It is exposed
through the network extra and installed in both test environments so that the
existing urbansim.utils.networks integration remains covered.

Compatibility changes

  • preserves the dtype of discrete-choice results under Pandas 3;
  • normalizes NumPy scalar filter values before constructing Pandas queries;
  • replaces chained square-foot pro forma assignments with .loc assignments
    that work under Pandas 3 copy-on-write semantics;
  • reads the legacy network test fixture through Pandana 0.8's migration-aware
    HDF loader; and
  • updates two test fixtures for Pandas 3's stricter dtype handling.

Verification

  • Python 3.10, minimum dependencies, Pandana 0.8: 182 tests pass.
  • Python 3.14, NumPy 2.5, Pandas 3.0, Pandana 0.8: 182 tests pass.
  • Code style passes with the repository's established 100-character limit.
  • Source and wheel distributions build successfully.
  • twine check passes for both artifacts.

This pull request does not change the UrbanSim version, publish a release, or
address the transition-model integrity problem in #233.

Refs #234.

… for the new packaging

- test.yml: add macOS and Windows legs for the latest-dependencies job, add a
  docs job that builds the Sphinx documentation with warnings as errors,
  install the package non-editable in the test jobs, and make the twine
  check strict, matching orca and choicemodels
- docs/source/conf.py: read the version from the package, and drop the
  deprecated get_html_theme_path call, which was the one warning that
  failed a strict build; fix the numpydoc section headers in the fidx
  docstring, which were the remaining (non-fatal) warnings
- README, getting started, docs/README, CONTRIBUTING: Python 3.10+ and the
  tested platforms, the optional `network` extra for Pandana, `pip install
  ".[docs]"` and the strict build command, replace references to the
  removed setup.py and the .md file names, and add the development-version
  convention used in the other UDST repos
- version 3.3.dev0, so builds from main are distinguishable from the
  released 3.2
- MANIFEST.in: ship the test suites with their data files in the sdist
- requirements-min.txt: the install command in the comment matches the
  workflow

Verified: 182 tests pass at the floors (Python 3.10, NumPy 1.26.4, pandas
2.2.3, Pandana 0.8) and at latest (Python 3.14, NumPy 2.5.2, pandas 3.0.5,
Pandana 0.8); pycodestyle clean; sdist and wheel build and pass `twine check
--strict`; Sphinx builds with -W on Python 3.14.
@smmaurer

smmaurer commented Sep 3, 2026

Copy link
Copy Markdown
Member

Pushed a follow-up commit aligning some more of the details with the pattern from orca and choicemodels: Mac OS and Windows test legs, a Sphinx docs test, twine check, tests shipped in the sdist, and docs and contributor-guide updates for the new packaging. Version bumped to 3.3.dev0 so builds from main are distinguishable from the 3.2 release.

Noting for future reference: Pandana is an optional dependency for UrbanSim. But we've set the dependency floor to align with Pandana 0.8 for simplicity (NumPy 1.26, Pandas 2.2). In principle we could declare+test a lower floor for people using UrbanSim without Pandana. But let's see if that's needed rather than adding the complexity now.

@smmaurer smmaurer removed their assignment Sep 3, 2026
@smmaurer
smmaurer merged commit 81d0ae8 into main Sep 3, 2026
7 checks passed
@smmaurer
smmaurer deleted the maintenance/packaging-compatibility branch September 3, 2026 17:54
smmaurer added a commit to UDST/urbansim_templates that referenced this pull request Sep 9, 2026
…leanup

- ci.yml: move the forward cells to Python 3.14, since UrbanSim main now
  supports NumPy 2 and Pandas 3 (UDST/urbansim#239); name the package in
  --cov so coverage measures the installed package rather than the test
  modules (the real figure is 82%, not the 97% previously reported); repin
  the temporary ChoiceModels install to the UDST/choicemodels#82 squash
  commit on dev, so it survives deletion of the PR branch; add a docs job
  that builds the Sphinx documentation with warnings as errors; run the
  quality and build jobs on 3.14 like the other jobs
- pyproject.toml: add the 3.13 and 3.14 classifiers; enable Ruff's W605
  rule; drop the coverage configuration, which was never read because
  pytest runs from tests/; require Sphinx 7.2 for the :no-index: option
- utils.py: raw string for the regex in cols_in_expression(), which raised
  a SyntaxWarning on Python 3.12 and later and failed the strict docs build
- docs: language = 'en', and :no-index: on repeated automodule directives
  (the remaining strict-build failures); getting-started, development,
  docs/README, tests/README, README and CONTRIBUTING updated for the
  removed setup.py (pip install -e ., python -m build, two version
  locations), the Python 3.10 requirement, and dev-branch links; drop the
  Scikit-learn mention, which no template uses
- MANIFEST.in: ship the tests directory with its pytest.ini and the
  configs/ and data/ placeholders, so the suite in the sdist can run; drop
  requirements-extras.txt, and remove requirements-dev.txt and
  requirements-extras.txt, which the extras supersede
- CHANGELOG: mention the docs job and the escape-sequence fix

Verified locally on Python 3.14 with NumPy 2.5.3, pandas 3.0.5, UrbanSim
main and ChoiceModels dev: 95 tests pass, 1 skipped, coverage 82%; ruff
clean; sdist and wheel build and pass twine check --strict; Sphinx builds
with -W.
smmaurer pushed a commit to UDST/urbansim_templates that referenced this pull request Sep 9, 2026
* chore: modernize packaging and continuous integration

Moves package metadata from setup.py to pyproject.toml and sets Python
3.10 as the minimum supported version, with NumPy 1.21, Pandas 1.5, Orca
1.8, and UrbanSim 3.2 as the tested dependency floors.

Replaces the Travis CI configuration with a GitHub Actions workflow that
tests the minimum and latest dependency versions, checks code quality,
and validates the built distributions.

Replaces the private Pandas cartesian-product helper used by the small
multinomial logit template, which Pandas 3 removed, and fixes a warning
message in the segmented multinomial logit template that never received
its format argument. Removes a duplicated test and unused test variables
flagged by the new quality check.

* ci: pin the temporary ChoiceModels install to a development commit

The dev branch still imports PyLogit at module load until UDST/choicemodels#82
merges, so the workflow installs that commit directly.

* ci: test on macOS and Windows and drop the unused extras group

Adds macOS and Windows cells for the current-dependency job. Removes the
scikit-learn extras group, which nothing in the package or tests uses.

* test: make integer dtypes explicit for Windows

Two tests built integer test data with the platform default integer, which
is 32-bit on Windows under NumPy 1.x, and compared it against 64-bit data.

* Docs CI job, coverage fix, Python 3.14 forward cells, and packaging cleanup

- ci.yml: move the forward cells to Python 3.14, since UrbanSim main now
  supports NumPy 2 and Pandas 3 (UDST/urbansim#239); name the package in
  --cov so coverage measures the installed package rather than the test
  modules (the real figure is 82%, not the 97% previously reported); repin
  the temporary ChoiceModels install to the UDST/choicemodels#82 squash
  commit on dev, so it survives deletion of the PR branch; add a docs job
  that builds the Sphinx documentation with warnings as errors; run the
  quality and build jobs on 3.14 like the other jobs
- pyproject.toml: add the 3.13 and 3.14 classifiers; enable Ruff's W605
  rule; drop the coverage configuration, which was never read because
  pytest runs from tests/; require Sphinx 7.2 for the :no-index: option
- utils.py: raw string for the regex in cols_in_expression(), which raised
  a SyntaxWarning on Python 3.12 and later and failed the strict docs build
- docs: language = 'en', and :no-index: on repeated automodule directives
  (the remaining strict-build failures); getting-started, development,
  docs/README, tests/README, README and CONTRIBUTING updated for the
  removed setup.py (pip install -e ., python -m build, two version
  locations), the Python 3.10 requirement, and dev-branch links; drop the
  Scikit-learn mention, which no template uses
- MANIFEST.in: ship the tests directory with its pytest.ini and the
  configs/ and data/ placeholders, so the suite in the sdist can run; drop
  requirements-extras.txt, and remove requirements-dev.txt and
  requirements-extras.txt, which the extras supersede
- CHANGELOG: mention the docs job and the escape-sequence fix

Verified locally on Python 3.14 with NumPy 2.5.3, pandas 3.0.5, UrbanSim
main and ChoiceModels dev: 95 tests pass, 1 skipped, coverage 82%; ruff
clean; sdist and wheel build and pass twine check --strict; Sphinx builds
with -W.

* Bump the version to 0.3.dev0

The 0.2 line was only ever published as numbered development releases on
GitHub, and the current dev head already depends on unreleased ChoiceModels
functionality (#126). The first maintenance release will be 0.3, since #131
changes the small-MNL storage format and needs to precede it. The changelog
now records #126 under 0.3.dev0, as it was merged without an entry.
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