Skip to content

Commit

Permalink
Merge pull request #636 from ActivitySim/develop
Browse files Browse the repository at this point in the history
code for 1.2 release
  • Loading branch information
jpn-- authored Jan 30, 2023
2 parents 1e4ffc5 + 4bcad57 commit ae7fa43
Show file tree
Hide file tree
Showing 520 changed files with 39,242 additions and 5,041 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build_installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build installer
on:
workflow_dispatch:
inputs:
version:
description: 'Build installer for version (e.g. "1.0.4")'
required: true
type: string
release:
description: 'Upload as release artifact'
required: true
type: boolean

jobs:
build:
name: ActivitySim-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
ARCH: x86_64
TARGET_PLATFORM: win-64
OS_NAME: "Windows"

steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@35d1405e78aa3f784fe3ce9a2eb378d5eeb62169
with:
miniconda-version: "latest"
if: contains(matrix.OS_NAME, 'Windows')

- name: Build installer
env:
ARCH: ${{ matrix.ARCH }}
OS_NAME: ${{ matrix.OS_NAME }}
TARGET_PLATFORM: ${{ matrix.TARGET_PLATFORM }}
run: |
export ACTIVITYSIM_VERSION=${{ inputs.version }}
export EXT=exe
source /c/Miniconda3/Scripts/activate;
source other_resources/installer/build_win.sh;
ls -alh build
shell: bash

- name: Upload installer to Github artifact
uses: actions/upload-artifact@v3
with:
path: build/Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}*
name: Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}

- name: Upload installer to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/Activitysim*
tag: v${{ inputs.version }}
overwrite: true
file_glob: true
if: inputs.release
55 changes: 55 additions & 0 deletions .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
run: |
python -m pytest --pyargs activitysim.cli
cross-platform:
# also test foundation cross platforms, but do not require a successful
# completion before starting regional model tests
Expand Down Expand Up @@ -162,6 +163,7 @@ jobs:
run: |
python -m pytest --pyargs activitysim.cli
regional_models:
needs: foundation
env:
Expand Down Expand Up @@ -251,6 +253,59 @@ jobs:
run: |
python -m pytest activitysim/examples/${{ matrix.region }}/test --durations=0
random_seed_generation:
needs: foundation
env:
mamba-env-prefix: /usr/share/miniconda3/envs/asim-test
python-version: 3.9
label: linux-64
defaults:
run:
shell: bash -l {0}
name: random_seed_generation_test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ env.python-version }}

- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV

- uses: actions/cache@v2
with:
path: ${{ env.mamba-env-prefix }}
key: ${{ env.label }}-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache

- name: Update environment
run: mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install -e . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
- name: Test Random Seed Generation
run: |
python -m pytest test/random_seed/test_random_seed.py --durations=0
estimation_mode:
needs: foundation
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ _test_est
*_local/
*_local.*

**/__sharrowcache__
**/skims.zarr
**/output/
**/_generated_version.py
docs/**/_generated
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
exclude: logging.yaml # TODO don't exclude, will require fixing logging
- id: end-of-file-fixer
exclude: .*\.ipynb
- id: trailing-whitespace
Expand Down
56 changes: 37 additions & 19 deletions HOW_TO_RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@
and development. If they are not updated, these environments will end
up with dependencies loaded from *pip* instead of *conda-forge*.

00. Run `black` to ensure that the codebase passes minimal style checks.
00. Run black to ensure that the codebase passes all style checks.
This check should only take a few seconds. These checks are also done on
GitHub Actions and are platform independent, so they should not be necessary to
Travis and are platform independent, so they should not be necessary to
replicate locally, but are listed here for completeness.
```sh
black --check --diff .
```

00. Run the regular test suite on Windows. Most GitHub Actions tests are done on Linux,
Linux (it's faster to start up and run a new clean VM for testing) but most
users are on Windows, and the test suite should also be run on Windows to
ensure that it works on that platform as well. If you
00. Run the regular test suite on Windows. Travis tests are done on Linux,
but most users are on Windows, and the test suite should also be run
on Windows to ensure that it works on that platform as well. If you
are not preparing this release on Windows, you should be sure to run
at least through this step on a Windows machine before finalizing a
release.
Expand All @@ -67,7 +66,7 @@
```

00. Test the full-scale regional examples. These examples are big, too
large to run on GitHub Actions, and will take a lot of time (many hours) to
large to run on Travis, and will take a lot of time (many hours) to
download and run.
```sh
mkdir tmp-asim
Expand All @@ -88,6 +87,37 @@
There are also demo notebooks for estimation, but their functionality
is completely tested in the unit tests run previously.
00. Use bump2version to tag the release commit and update the
version number. The following code will generate a "patch" release,
incrementing the third value in the version number (i.e. "1.2.3"
becomes "1.2.4"). Alternatively, make a "minor" or "major" release.
The `--list` command will generate output to your console to confirm
that the old and new version numbers are what you expect, before you
push the commit (with the changed version in the code) and tags to
GitHub.
```sh
bump2version patch --list
```
It is also possible to make a development pre-release. To do so,
explicitly set the version number to the next patch plus a ".devN"
suffix:
```sh
bump2version patch --new-version 1.2.3.dev0 --list
```
Then, when ready to make a "final" release, set the version by
explicitly removing the suffix:
```sh
bump2version patch --new-version 1.2.3 --list
```
00. Push the tagged commit to GitHub.
```sh
git push --tags
```
00. For non-development releases, open a pull request to merge the proposed
release into main. The following command will open a web browser for
you to create the pull request.
Expand All @@ -105,10 +135,6 @@
```sh
gh release create v1.2.3
```
The process of creating and tagging a release will automatically
trigger various GitHub Actions scripts to build, test, and publish the
new release to PyPI and conda forge, assuming there are no errors.

For a development pre-release, include the `--prerelease` argument.
As the project's policy is that only formally released code is merged
to the main branch, any pre-release should also be built against a
Expand All @@ -129,11 +155,3 @@
conda deactivate
conda env remove -n TEMP-ASIM-DEV
```
00. Change the default redirect page for the ActivitySim documentation to point
to the newly released documentation. The redirect page can be edited
[here](https://github.com/ActivitySim/activitysim/blob/gh-pages/index.html).
00. Add the new release to the `switch.json` file. Don't delete the references
for existing old documentation. The switcher can be edited
[here](https://github.com/ActivitySim/activitysim/blob/gh-pages/switcher.json).
8 changes: 8 additions & 0 deletions activitysim/abm/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# flake8: noqa
# ActivitySim
# See full license in LICENSE.txt.

from . import (
accessibility,
atwork_subtour_destination,
Expand All @@ -8,6 +10,7 @@
atwork_subtour_scheduling,
auto_ownership,
cdap,
disaggregate_accessibility,
free_parking,
initialize,
initialize_los,
Expand All @@ -24,11 +27,15 @@
non_mandatory_scheduling,
non_mandatory_tour_frequency,
parking_location_choice,
school_escorting,
stop_frequency,
summarize,
telecommute_frequency,
tour_mode_choice,
tour_od_choice,
tour_scheduling_probabilistic,
transit_pass_ownership,
transit_pass_subsidy,
trip_departure_choice,
trip_destination,
trip_matrices,
Expand All @@ -39,4 +46,5 @@
trip_scheduling_choice,
vehicle_allocation,
vehicle_type_choice,
work_from_home,
)
2 changes: 2 additions & 0 deletions activitysim/abm/models/atwork_subtour_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def atwork_subtour_scheduling(
estimator = estimation.manager.begin_estimation("atwork_subtour_scheduling")

model_spec = simulate.read_model_spec(file_name=model_settings["SPEC"])
sharrow_skip = model_settings.get("sharrow_skip")
coefficients_df = simulate.read_model_coefficients(model_settings)
model_spec = simulate.eval_coefficients(model_spec, coefficients_df, estimator)

Expand Down Expand Up @@ -79,6 +80,7 @@ def atwork_subtour_scheduling(
estimator=estimator,
chunk_size=chunk_size,
trace_label=trace_label,
sharrow_skip=sharrow_skip,
)

if estimator:
Expand Down
Loading

0 comments on commit ae7fa43

Please sign in to comment.