Skip to content

Updates for numpy v2 - #19

Merged
jpn-- merged 11 commits into
ActivitySim:extendedfrom
driftlesslabs:numpy-2
Sep 20, 2026
Merged

jpn-- merged 11 commits into
ActivitySim:extendedfrom
driftlesslabs:numpy-2

Conversation

@jpn--

@jpn-- jpn-- commented Jun 23, 2026

Copy link
Copy Markdown
Member

This PR modernizes the MTC example for NumPy 2 and adds reproducible Sharrow runs using the repository's shared pyproject.toml and uv.lock.

  • Require activitysim>=1.6, numpy>=2,<3, and pandera>=0.30. The common lock selects ActivitySim 1.6.0 and Sharrow 2.16.2.
  • Add small-sample and large-sample Sharrow scripts, run from the repository root with uv run --locked scripts/run-small-sharrow.py or uv run --locked scripts/run-large-sharrow.py. The large script downloads the full dataset and runs a 500,000-household sample. Neither script uses a separate script environment or script lockfile, and the large script preserves the repository's .gitignore.
  • Add an optional explicit-chunking overlay and an abench experiment that compares ActivitySim main with a selected PR and publishes benchmark results to that PR.
  • Test against both the locked ActivitySim release and current ActivitySim main in separate CI jobs. Add coverage for script startup, configuration, preservation of .gitignore, and overlay inheritance in single-process and multiprocessing configurations.

Validation: all 10 tests passed locally against both ActivitySim 1.6.0 and ActivitySim main at 8ca6741c83e44e70fbfe718cb91066dece989805, including the full model checkpoint comparisons. Script smoke tests avoid downloading or simulating the large dataset.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request modernizes the project’s Python dependency stack (notably moving to NumPy v2) and adds two uv-runnable scripts to run the Prototype MTC model with Sharrow enabled, improving ease of execution and reproducibility via a lockfile.

Changes:

  • Updated core dependencies to newer versions (including numpy>=2,<3, newer pandera, and a newer ActivitySim via a git source override).
  • Added scripts/run-small-sharrow.py and scripts/run-large-sharrow.py for Sharrow-enabled runs (the large script also downloads/unpacks the full dataset).
  • Updated environment defaults/ignores (Python version set to 3.10; ignore data_full/ in git).

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
uv.lock Locks updated dependency set (NumPy v2 ecosystem, ActivitySim from git, Sharrow 2.15.0, etc.) for reproducible installs.
pyproject.toml Updates declared requirements (NumPy v2, newer Pandera) and configures ActivitySim to come from the git main branch via tool.uv.sources.
scripts/run-small-sharrow.py New uv script to run a small-sample Sharrow-enabled model run.
scripts/run-large-sharrow.py New uv script to download/unpack full data and run a large-sample Sharrow-enabled model run.
.python-version Sets default local Python version to 3.10 (within project’s >=3.10,<3.12 constraint).
.gitignore Ensures data_full/ is ignored by git.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/run-large-sharrow.py Outdated
Comment on lines +14 to +18
Run the MTC example model with sharrow enabled, on the small test sample.

The metadata in the header above allows this script to be run with `uv` without
needing to set up a separate virtual environment or install dependencies manually.
"""
Comment thread scripts/run-large-sharrow.py Outdated
import platformdirs
import activitysim.abm # register components # noqa: F401
from activitysim.core import workflow
from activitysim.examples.external import download_external_example, download_asset
Comment thread scripts/run-large-sharrow.py Outdated
Comment on lines +57 to +61
# do not allow full data to enter Git repo
working_dir.joinpath(".gitignore").write_text("**\n")

out_dir = Path(str(__file__).replace(".py", "-output"))
out_dir.mkdir(exist_ok=True)
Comment thread scripts/run-large-sharrow.py Outdated
Comment on lines +51 to +55
sha256 = "b402506a61055e2d38621416dd9a5c7e3cf7517c0a9ae5869f6d760c03284ef3",
link = Path(platformdirs.user_cache_dir(appname="ActivitySim")) / "External-Data",
base_path=str(working_dir),
unpack = "data_full",
)
@jpn--
jpn-- merged commit 8054a77 into ActivitySim:extended Sep 20, 2026
2 checks passed
@jpn--
jpn-- deleted the numpy-2 branch September 20, 2026 00:37
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