Skip to content

Commit b2a101f

Browse files
authored
use uv (#17)
* revise test targets for pandas 2 * update CI don't use mambaforge * conda not mamba * use pandas2 version of ActivitySim * test with uv * install activitysim from repo for GitHub Action CI * update uv lock for dev * run in top level dir
1 parent 7da9d6d commit b2a101f

File tree

8 files changed

+1834
-36
lines changed

8 files changed

+1834
-36
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,52 +25,37 @@ jobs:
2525
steps:
2626
# checkout the code in this repository
2727
- uses: actions/checkout@v4
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
version: "0.8.8"
33+
enable-cache: true
34+
cache-dependency-glob: "uv.lock"
35+
36+
- name: "Set up Python"
37+
uses: actions/setup-python@v5
2838
with:
29-
path: 'activitysim-prototype-mtc'
39+
python-version-file: ".python-version"
40+
41+
- name: Install everything
42+
run: |
43+
uv sync --locked
3044
3145
# checkout the main branch of ActivitySim itself
3246
- uses: actions/checkout@v4
3347
with:
3448
repository: 'ActivitySim/activitysim'
3549
ref: main
36-
path: 'activitysim'
50+
path: 'cloned/activitysim'
3751
fetch-depth: 0 # get all tags, lets setuptools_scm do its thing
3852

39-
- name: Setup Mambaforge
40-
uses: conda-incubator/setup-miniconda@v3
41-
with:
42-
miniforge-variant: Mambaforge
43-
miniforge-version: latest
44-
activate-environment: asim-test
45-
use-mamba: true
46-
python-version: ${{ matrix.python-version }}
47-
48-
- name: Set cache date for year and month
49-
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
50-
51-
- uses: actions/cache@v4
52-
with:
53-
path: /usr/share/miniconda3/envs/asim-test
54-
key: linux-64-conda-${{ hashFiles('activitysim/conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
55-
id: cache
56-
57-
- name: Update environment
58-
run: |
59-
mamba env update -n asim-test -f activitysim/conda-environments/github-actions-tests.yml
60-
if: steps.cache.outputs.cache-hit != 'true'
61-
62-
- name: Install activitysim
63-
# installing without dependencies is faster, we trust that all needed dependencies
64-
# are in the conda environment defined above. Also, this avoids pip getting
65-
# confused and reinstalling tables (pytables).
66-
run: |
67-
python -m pip install ./activitysim --no-deps
68-
69-
- name: Conda checkup
53+
# install ActivitySim, overriding the one in the workspace,
54+
# as the pre-installed one is the latest release but not the most up-to-date
55+
- name: Install ActivitySim
7056
run: |
71-
mamba info -a
72-
mamba list
57+
uv pip install --no-deps ./cloned/activitysim
7358
7459
- name: Test this implementation
7560
run: |
76-
python -m pytest activitysim-prototype-mtc/test
61+
uv run pytest ./test

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
name = "activitysim-prototype-mtc"
3+
version = "1.4"
4+
description = "User environment for Prototype MTC Model"
5+
readme = "README.md"
6+
requires-python = ">=3.10,<3.12"
7+
dependencies = [
8+
"activitysim==1.4",
9+
"multimethod<2.0",
10+
"numba>=0.57",
11+
"numpy>=1.16.1,<1.26",
12+
"openmatrix>=0.3.5.0",
13+
"pandas>=2.1.0",
14+
"pandera>=0.15,<0.18.1",
15+
"psutil>=4.1",
16+
"pydantic>=2.6",
17+
"setuptools>=80.9.0,<81",
18+
"sharrow>=2.14.0",
19+
"tables>=3.9",
20+
]
21+
22+
[dependency-groups]
23+
dev = [
24+
"pytest>=8.4.1",
25+
"zstandard>=0.23.0",
26+
]

scripts/download_data.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pathlib import Path
2+
from activitysim.examples.external import download_external_example
3+
4+
example_dir = download_external_example(
5+
name="prototype_mtc_extended",
6+
working_dir=Path.cwd(),
7+
url="https://github.com/ActivitySim/activitysim-prototype-mtc/archive/refs/heads/extended.tar.gz",
8+
assets={
9+
"data_full.tar.zst": {
10+
"url": "https://github.com/ActivitySim/activitysim-prototype-mtc/releases/download/v1.3.4/data_full.tar.zst",
11+
"sha256": "b402506a61055e2d38621416dd9a5c7e3cf7517c0a9ae5869f6d760c03284ef3",
12+
"unpack": "data_full",
13+
},
14+
"test/prototype_mtc_reference_pipeline.zip": {
15+
"url": "https://github.com/ActivitySim/activitysim-prototype-mtc/releases/download/v1.3.2/prototype_mtc_extended_reference_pipeline.zip",
16+
"sha256": "4d94b6a8a83225dda17e9ca19c9110bc1df2df5b4b362effa153d1c8d31524f5",
17+
},
18+
},
19+
)
-6.78 MB
Binary file not shown.
-1.09 KB
Binary file not shown.
-1.01 KB
Binary file not shown.

uv.lock

Lines changed: 1767 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)