Skip to content

Commit 5105b17

Browse files
author
Jan Zill
committed
Merge remote-tracking branch 'origin/master' into janzill/utilit_based_choices_2025
2 parents 30ddb3e + de6d0ef commit 5105b17

119 files changed

Lines changed: 313 additions & 383 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/branch-docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
# develop branch docs are built at the end of the core test workflow, regardless of repository owner or commit message flags
1212
name: ubuntu-latest py3.10
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
1416
defaults:
1517
run:
1618
shell: bash -l {0}
@@ -60,7 +62,7 @@ jobs:
6062
make html
6163
6264
- name: Push to GitHub Pages
63-
uses: peaceiris/actions-gh-pages@v3.8.0
65+
uses: peaceiris/actions-gh-pages@v4
6466
with:
6567
github_token: ${{ secrets.GITHUB_TOKEN }}
6668
# Token is created automatically by Github Actions, no other config needed

.github/workflows/core_tests.yml

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ on:
99
branches:
1010
- '*'
1111

12+
workflow_dispatch:
13+
1214
env:
13-
CACHE_NUMBER: 2 # increase to reset cache manually
15+
CACHE_NUMBER: 0 # increase to reset cache manually
1416

1517
jobs:
1618
foundation:
@@ -29,9 +31,13 @@ jobs:
2931
- name: Setup Miniforge
3032
uses: conda-incubator/setup-miniconda@v3
3133
with:
32-
miniforge-version: latest
33-
activate-environment: asim-test
34-
python-version: ${{ matrix.python-version }}
34+
auto-update-conda: true
35+
miniforge-version: latest
36+
mamba-version: "2.0.5"
37+
conda-solver: classic
38+
conda-remove-defaults: true
39+
activate-environment: asim-test
40+
python-version: ${{ matrix.python-version }}
3541

3642
- name: Set cache date for year and month
3743
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
@@ -112,9 +118,13 @@ jobs:
112118
- name: Setup Miniforge
113119
uses: conda-incubator/setup-miniconda@v3
114120
with:
115-
miniforge-version: latest
116-
activate-environment: asim-test
117-
python-version: ${{ matrix.python-version }}
121+
auto-update-conda: true
122+
miniforge-version: latest
123+
mamba-version: "2.0.5"
124+
conda-solver: classic
125+
conda-remove-defaults: true
126+
activate-environment: asim-test
127+
python-version: ${{ matrix.python-version }}
118128

119129
- name: Set cache date for year and month
120130
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
@@ -193,7 +203,11 @@ jobs:
193203
- name: Setup Miniforge
194204
uses: conda-incubator/setup-miniconda@v3
195205
with:
206+
auto-update-conda: true
196207
miniforge-version: latest
208+
mamba-version: "2.0.5"
209+
conda-solver: classic
210+
conda-remove-defaults: true
197211
activate-environment: asim-test
198212
python-version: ${{ env.python-version }}
199213

@@ -279,7 +293,11 @@ jobs:
279293
- name: Setup Miniforge
280294
uses: conda-incubator/setup-miniconda@v3
281295
with:
296+
auto-update-conda: true
282297
miniforge-version: latest
298+
mamba-version: "2.0.5"
299+
conda-solver: classic
300+
conda-remove-defaults: true
283301
activate-environment: asim-test
284302
python-version: ${{ env.python-version }}
285303

@@ -340,7 +358,11 @@ jobs:
340358
- name: Setup Miniforge
341359
uses: conda-incubator/setup-miniconda@v3
342360
with:
361+
auto-update-conda: true
343362
miniforge-version: latest
363+
mamba-version: "2.0.5"
364+
conda-solver: classic
365+
conda-remove-defaults: true
344366
activate-environment: asim-test
345367
python-version: ${{ env.python-version }}
346368

@@ -390,7 +412,11 @@ jobs:
390412
- name: Setup Miniforge
391413
uses: conda-incubator/setup-miniconda@v3
392414
with:
415+
auto-update-conda: true
393416
miniforge-version: latest
417+
mamba-version: "2.0.5"
418+
conda-solver: classic
419+
conda-remove-defaults: true
394420
activate-environment: asim-test
395421
python-version: ${{ env.python-version }}
396422

@@ -429,9 +455,11 @@ jobs:
429455
430456
develop-docbuild:
431457
needs: foundation
432-
if: github.ref_name == 'main'
458+
if: github.ref_name == 'main' || github.ref_name == 'docs-fix'
433459
name: develop-docbuild
434460
runs-on: ubuntu-latest
461+
permissions:
462+
contents: write
435463
defaults:
436464
run:
437465
shell: bash -l {0}
@@ -447,6 +475,8 @@ jobs:
447475
uses: conda-incubator/setup-miniconda@v3
448476
with:
449477
miniforge-version: latest
478+
mamba-version: "2.0.5"
479+
conda-remove-defaults: true
450480
environment-file: conda-environments/docbuild.yml
451481
python-version: "3.10"
452482
activate-environment: docbuild
@@ -472,7 +502,7 @@ jobs:
472502
make clean
473503
make html
474504
- name: Push to GitHub Pages
475-
uses: peaceiris/actions-gh-pages@v3.8.0
505+
uses: peaceiris/actions-gh-pages@v4
476506
with:
477507
github_token: ${{ secrets.GITHUB_TOKEN }}
478508
# Token is created automatically by Github Actions, no other config needed

HOW_TO_RELEASE.md

Lines changed: 41 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
11
# How to issue an ActivitySim release
22

3-
> **WARNING: These instructions are incomplete.**
4-
5-
01. Check that the branch you intend to release is passing tests on Travis.
6-
If it's not passing there you should not release it.
3+
00. Check that the main branch is passing tests, especially the "core tests" on
4+
[GitHub Actions](https://github.com/ActivitySim/activitysim/actions/workflows/core_tests.yml).
5+
It is generally the policy that the main branch should always be passing tests,
6+
becuase PRs must pass tests before they can be merged. However, it is
7+
possible that tests may fail after a PR is merged, so it is important to
8+
double-check that the main branch is passing tests before issuing a release.
79

810
00. Start from a completely clean conda environment
911
and git repository. Assuming you have `conda` installed, you can do so
1012
by starting where ActivitySim is not yet cloned (e.g. in an empty
1113
directory) and running:
1214
```sh
13-
conda create -n TEMP-ASIM-DEV python=3.10 git gh -c conda-forge --override-channels
14-
conda activate TEMP-ASIM-DEV
15+
conda create -p ./TEMP-ASIM-DEV python=3.10 git gh -c conda-forge --override-channels
16+
conda activate ./TEMP-ASIM-DEV
1517
gh auth login # <--- (only needed if gh is not logged in)
1618
gh repo clone ActivitySim/activitysim
1719
cd activitysim
1820
```
1921

20-
00. Per project policy, code on the main branch should have been released,
21-
but if you are *preparing* a release then the code should be on the `develop`
22-
branch. Switch to that branch now, and make sure it is synced to the
23-
version on GitHub:
24-
```sh
25-
git switch develop
26-
git pull
27-
```
28-
2922
00. Update your Conda environment for testing. We do not want to use an
30-
existing environment on your machine, as it may be out-of-date
23+
existing environment on your machine, as it may be out-of-sync
3124
and we want to make sure everything passes muster using the
32-
most up-to-date dependencies available. The following command
25+
dependencies as they are available today. The following command
3326
will update the active environment (we made this to be `TEMP-ASIM-DEV`
3427
if you followed the directions above).
3528
```sh
@@ -48,7 +41,7 @@
4841
black --check --diff .
4942
```
5043

51-
00. Run the regular test suite on Windows. Most GitHub Actions tests are done on Linux,
44+
00. Run the regular test suite on Windows. Most GitHub Actions tests are done on
5245
Linux (it's faster to start up and run a new clean VM for testing) but most
5346
users are on Windows, and the test suite should also be run on Windows to
5447
ensure that it works on that platform as well. If you
@@ -67,7 +60,7 @@
6760
```
6861
6962
00. Test the full-scale regional examples. These examples are big, too
70-
large to run on Travis, and will take a lot of time (many hours) to
63+
large to run on GitHub Actions, and will take a lot of time (many hours) to
7164
download and run.
7265
```sh
7366
mkdir tmp-asim
@@ -88,75 +81,54 @@
8881
There are also demo notebooks for estimation, but their functionality
8982
is completely tested in the unit tests run previously.
9083

91-
00. Use bump2version to tag the release commit and update the
92-
version number. The following code will generate a "patch" release,
93-
incrementing the third value in the version number (i.e. "1.2.3"
94-
becomes "1.2.4"). Alternatively, make a "minor" or "major" release.
95-
The `--list` command will generate output to your console to confirm
96-
that the old and new version numbers are what you expect, before you
97-
push the commit (with the changed version in the code) and tags to
98-
GitHub.
99-
```sh
100-
bump2version patch --list
101-
```
102-
103-
It is also possible to make a development pre-release. To do so,
104-
explicitly set the version number to the next patch plus a ".devN"
105-
suffix:
106-
84+
00. Tag the release commit with the new version number. ActivitySim uses
85+
dynamic versioning, so the version number is not stored in a file but
86+
is instead read from the most recent git tag, so it is important to tag
87+
the repository with the correct version. The following command will
88+
generate a new tag with the version number "1.2.3" (for example):
10789
```sh
108-
bump2version patch --new-version 1.2.3.dev0 --list
109-
```
110-
111-
Then, when ready to make a "final" release, set the version by
112-
explicitly removing the suffix:
113-
```sh
114-
bump2version patch --new-version 1.2.3 --list
90+
git -a v1.2.3 -m "Release v1.2.3"
11591
```
11692

11793
00. Push the tagged commit to GitHub.
11894
```sh
11995
git push --tags
12096
```
12197

122-
00. For non-development releases, open a pull request to merge the proposed
123-
release into main. The following command will open a web browser for
124-
you to create the pull request.
125-
```sh
126-
gh pr create --web
127-
```
128-
After creating the PR, confirm with the ActivitySim PMC that the release
129-
is ready before actually merging it.
130-
131-
Once final approval is granted, merge the PR into main. The presence
132-
of the git tags added earlier will trigger automated build steps to
133-
prepare and deploy the release to pypi and conda-forge.
134-
135-
00. Create a "release" on GitHub.
98+
00. Create a "release" on GitHub. You can do this from the command line using
99+
the `gh` command line tool:
136100
```sh
137101
gh release create v1.2.3
138102
```
103+
But it may be easier to do this through the
104+
[GitHub web interface](https://github.com/ActivitySim/activitysim/releases/new),
105+
where you can select the tag you just created and add a title and description.
106+
Both the interactive command line tool shown above and the web interface include
107+
the ability to create release notes automatically from the commit messages of
108+
all accepted PRs since the last release, but you may want to add additional
109+
notes to the release to highlight important changes or new features.
110+
139111
The process of creating and tagging a release will automatically
140112
trigger various GitHub Actions scripts to build, test, and publish the
141113
new release to PyPI and conda forge, assuming there are no errors.
142114

143-
For a development pre-release, include the `--prerelease` argument.
144-
As the project's policy is that only formally released code is merged
145-
to the main branch, any pre-release should also be built against a
146-
non-default branch. For example, to pre-release from the `develop`
147-
branch:
148-
```sh
149-
gh release create v1.2.3.dev0 \
150-
--prerelease \
151-
--target develop \
152-
--notes "this pre-release is for a cool new feature" \
153-
--title "Development Pre-Release"
154-
```
115+
00. If the dependencies of ActivitySim have changed, also be sure to update the
116+
dependencies of the conda-forge [recipe](https://github.com/conda-forge/activitysim-feedstock/tree/main/recipe).
117+
If the dependencies of ActivitySim have not changed, the conda-forge version
118+
of ActivitySim should auto-update within a few hours of making the release on
119+
Github.
120+
121+
00. Build the ActivitySim Standalone Windows Installer. This is done using
122+
GitHub Actions, but it is not done automatically when a release is created,
123+
instead it requires a manual workflow dispatch trigger. You can do this by
124+
going to the [build_installer workflow page](https://github.com/ActivitySim/activitysim/actions/workflows/build_installer.yml)
125+
and clicking on the "Run workflow" button. You will need to provide the
126+
version number and choose to add the built installer to the release.
155127

156128
00. Clean up your workspace, including removing the Conda environment used for
157129
testing (which will prevent you from accidentally using an old
158130
environment when you should have a fresh up-to-date one next time).
159131
```sh
160132
conda deactivate
161-
conda env remove -n TEMP-ASIM-DEV
133+
conda env remove -p ./TEMP-ASIM-DEV
162134
```

activitysim/abm/misc.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
@workflow.cached_object
2020
def households_sample_size(state: workflow.State, override_hh_ids) -> int:
21-
2221
if override_hh_ids is None:
2322
return state.settings.households_sample_size
2423
else:
@@ -27,7 +26,6 @@ def households_sample_size(state: workflow.State, override_hh_ids) -> int:
2726

2827
@workflow.cached_object
2928
def override_hh_ids(state: workflow.State) -> np.ndarray | None:
30-
3129
hh_ids_filename = state.settings.hh_ids
3230
if hh_ids_filename is None:
3331
return None
@@ -65,7 +63,6 @@ def override_hh_ids(state: workflow.State) -> np.ndarray | None:
6563

6664
@workflow.cached_object
6765
def trace_od(state: workflow.State) -> tuple[int, int] | None:
68-
6966
od = state.settings.trace_od
7067

7168
if od and not (

activitysim/abm/models/auto_ownership.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def auto_ownership_simulate(
7272
# - preprocessor
7373
preprocessor_settings = model_settings.preprocessor
7474
if preprocessor_settings:
75-
7675
locals_d = {}
7776
if constants is not None:
7877
locals_d.update(constants)

activitysim/abm/models/disaggregate_accessibility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,6 @@ def compute_disaggregate_accessibility(
922922
for ch in list(state.get_rn_generator().channels.keys()):
923923
state.get_rn_generator().drop_channel(ch)
924924

925-
# Drop any prematurely added traceables
926-
for trace in [x for x in state.tracing.traceable_tables if "proto_" not in x]:
927-
state.tracing.deregister_traceable_table(trace)
928-
929925
# # need to clear any premature tables that were added during the previous run
930926
for name in list(state.existing_table_status):
931927
if name not in tables_prior:
@@ -954,4 +950,8 @@ def compute_disaggregate_accessibility(
954950
)
955951
state.add_table(tablename, df)
956952

953+
# drop all proto-related tables and make way for synthetic population
954+
for trace in state.tracing.traceable_tables:
955+
state.tracing.deregister_traceable_table(trace)
956+
957957
return

activitysim/abm/models/initialize.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ def initialize_households(
148148
model_settings_file_name: str = "initialize_households.yaml",
149149
trace_label: str = "initialize_households",
150150
) -> None:
151-
152151
with chunk.chunk_log(state, trace_label, base=True) as chunk_sizer:
153152
chunk_sizer.log_rss(f"{trace_label}.inside-yield")
154153

activitysim/abm/models/input_checker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ class HouseholdValidator(pydantic.BaseModel) list_of_households...
209209

210210

211211
def report_errors(state, input_checker_settings, v_warnings, v_errors):
212-
213212
# logging overall statistics first before printing details
214213
for table_settings in input_checker_settings["table_list"]:
215214
table_name = table_settings["name"]

activitysim/abm/models/non_mandatory_tour_frequency.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ def non_mandatory_tour_frequency(
236236
# - preprocessor
237237
preprocessor_settings = model_settings.preprocessor
238238
if preprocessor_settings:
239-
240239
locals_dict = {
241240
"person_max_window": lambda x: person_max_window(state, x),
242241
"person_available_periods": lambda persons, start_bin, end_bin, continuous: person_available_periods(

activitysim/abm/models/trip_purpose_and_destination.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def trip_purpose_and_destination(
6969
model_settings_file_name: str = "trip_purpose_and_destination.yaml",
7070
trace_label: str = "trip_purpose_and_destination",
7171
) -> None:
72-
7372
if model_settings is None:
7473
model_settings = TripPurposeAndDestinationSettings.read_settings_file(
7574
state.filesystem,

0 commit comments

Comments
 (0)