Skip to content

Conversation

@i-am-sijia
Copy link
Contributor

@i-am-sijia i-am-sijia commented Jun 16, 2025

This PR implements UV as the new package and project manager for ActivitySim. #954

Changes to package and project management

  • Updated pyproject.toml to work with UV [1]
  • Implemented dependency lock with UV, added uv.lock for complete dependencies [1][2]
  • Replaced various yaml files under "./conda-environments" with dependency groups in pyproject.toml [1]

Updates to GitHub Actions tests

  • Updated the core tests to run on Windows VM instead of Linux. Since Windows is the primary platform that ActivitySim users use, it makes more sense to run tests on Windows [1][2][3]
  • Updated the tests to use UV with dependency lock, instead of conda [1][2][3]

Updates to documentation

  • Updated the release instructions [1]
  • Updated the user doc and developer doc [1][2]

Other Fixes

  • Pandas 2 got rid of the Int64Index dtype, which caused some existing tests to fail on Windows due to index type mismatch. We updated key state data tables' index type to ensure they are int64 across platforms and pandas versions. [1][2]

Update: This also solves Issue #958. Apparently index type int32 has caused bigger issues in full model runs that were not observed in our GitHub Actions tests. Our fix should address that too. See my response in: #958 (comment)

Consideration for future improvements

  • Remove unused dependencies. We started off with retaining all the dependencies that were in the existing conda environment yaml files, and noticed that some packages that ActivitySim didn't require, such as orca, were still included in those yaml files. We removed some but definitely not all. It requires careful auditing and testing to remove all, which is out of scope for now.
  • Remove version pins in pyproject.toml. With UV, we should not manually pin dependency versions in pyproject.toml with upper bounds (lower bounds are okay). If a pin is absolutely needed, there should be a GitHub issue associated with it and constantly being re-evaluated. Keep only direct dependencies in pyproject.toml
  • Some, but not all, Sharrow tests are failing on Mac and Linux
  • Benchmarking functions require code changes to remove conda. Or consider deprecating the functions.
  • Remove conda from all jupyer notebooks in the repository

@josiekre

@jpn-- jpn-- requested review from Copilot and jpn-- June 17, 2025 18:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces UV as the new package and project manager for ActivitySim by updating dependency constraints in pyproject.toml, replacing several conda environment YAML files, and adjusting related test and release workflows. Key changes include:

  • Updating pyproject.toml to include dependency groups and a [tool.uv] section with stricter version constraints.
  • Removing conda environment files in favor of managing dependencies with UV.
  • Modifying code and GitHub Actions workflows to use uv-based commands (e.g. uv sync, uv run) and ensuring compatibility with Windows.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updated dependency constraints and added UV dependency groups and configuration
conda-environments/*.yml Removed obsolete conda environment files
activitysim/core/input.py Changed index type conversion to use np.int64 for clarity and consistency
activitysim/abm/models/mandatory_tour_frequency.py Updated categorical creation for clarity
activitysim/abm/models/disaggregate_accessibility.py Updated type conversion to np.int64 for consistency
HOW_TO_RELEASE.md Revised release instructions to reflect uv-based dependency management
.python-version Added to specify the Python version
.github/workflows/core_tests.yml Updated workflows to install and use uv, and adjusted steps to run on Windows via uv-run
Comments suppressed due to low confidence (2)

HOW_TO_RELEASE.md:18

  • Verify that all related developer and user documentation is updated to reflect the switch from conda to uv for dependency management.
    uv sync

.github/workflows/core_tests.yml:152

  • Ensure that all workflow commands are compatible with PowerShell syntax, as switching from bash may lead to issues with commands originally written for bash.
        shell: pwsh

@i-am-sijia i-am-sijia self-assigned this Jun 27, 2025
pip install zbox
1. Install *uv*. Instructions can be found
`here <https://docs.astral.sh/uv/getting-started/installation/>`_. (Skip
if already installed above. It only needs to be installed once per machine.)
Copy link
Member

Choose a reason for hiding this comment

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

Add a note here to remind users: if they already have uv installed from older projects and they they encounter errors later in the process, that they may need to update uv via uv self update or by using whichever package management tool is managing the uv tool. (e.g., I got "error: Failed to parse uv.lock ... missing field version" on my first attempt, which was resolved by updating uv)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool! Added the note. Thank you.

Depending on what you are working on, you may want to check out a branch
other than `develop`. To do so, you can point the `git switch` command
above to any other existing branch name. If you want to start an new
other than the default `master`. To do so, you can use a `git switch` command
Copy link
Member

Choose a reason for hiding this comment

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

default branch is now 'main' not 'master'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Thanks.

@jpn-- jpn-- merged commit 2e5f732 into ActivitySim:main Jul 21, 2025
16 of 17 checks passed
@i-am-sijia i-am-sijia deleted the uv branch October 17, 2025 20:50
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.

4 participants