Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/modal-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ concurrency:
env:
API_URL: https://policyengine--aca-calc-api-fastapi-app.modal.run
MODAL_VERSION: 1.4.2
# modal 1.4.2's CLI passes click_type to typer.Option, which newer typer
# releases reject ("Option() got an unexpected keyword argument
# 'click_type'"), so each uvx call pins typer and click below.
UV_VERSION: 0.11.7
# Use the runner's Python; downloading one has taken over 10 minutes.
UV_PYTHON_PREFERENCE: only-system
Expand Down Expand Up @@ -87,15 +90,15 @@ jobs:
# The API reports it, so the smoke tests can tell this deploy's
# containers from the previous version's.
ACA_API_COMMIT: ${{ github.sha }}
run: uvx --from "modal==$MODAL_VERSION" modal deploy --env main modal_app.py
run: uvx --from "modal==$MODAL_VERSION" --with "typer<0.16" --with "click<8.2" modal deploy --env main modal_app.py
# The smoke test uses only the standard library, so any Python runs it.
# It waits until this commit's containers answer each check.
- name: Smoke-test the calculator
id: calculator
run: uv run --no-project scripts/smoke_test_api.py "$API_URL" --commit "$GITHUB_SHA"
- name: Roll back to the previous version if the calculator fails
if: failure() && steps.calculator.outcome == 'failure'
run: uvx --from "modal==$MODAL_VERSION" modal app rollback aca-calc-api --env main
run: uvx --from "modal==$MODAL_VERSION" --with "typer<0.16" --with "click<8.2" modal app rollback aca-calc-api --env main
# Calls the Anthropic API unless this household's answer is cached.
- name: Smoke-test AI explanations
run: uv run --no-project scripts/smoke_test_api.py "$API_URL" --commit "$GITHUB_SHA" --explain
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ existed. Change a pin only with a test of the new set and a comparison of
`/api/calculate` results.

To deploy or roll back by hand (needs access to PolicyEngine's Modal
workspace):
workspace), run the commands below. Like the workflow, they pin typer and
click, because modal 1.4.2's CLI fails to start with newer typer releases:

```bash
uvx --from modal==1.4.2 modal deploy --env main modal_app.py
uvx --from modal==1.4.2 modal app history aca-calc-api --env main
uvx --from modal==1.4.2 modal app rollback aca-calc-api --env main
uvx --from modal==1.4.2 --with "typer<0.16" --with "click<8.2" modal deploy --env main modal_app.py
uvx --from modal==1.4.2 --with "typer<0.16" --with "click<8.2" modal app history aca-calc-api --env main
uvx --from modal==1.4.2 --with "typer<0.16" --with "click<8.2" modal app rollback aca-calc-api --env main
```

Each `/api/explain` request that misses the 7-day explanation cache calls the
Expand Down
1 change: 1 addition & 0 deletions changelog.d/modal-cli-pins.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pin typer and click for the Modal CLI in the API deploy workflow and the README's commands. modal 1.4.2's CLI failed to start with newer typer releases, which stopped the deploy of eeab076.