diff --git a/.github/workflows/modal-api.yml b/.github/workflows/modal-api.yml index 01d51d9..f00d200 100644 --- a/.github/workflows/modal-api.yml +++ b/.github/workflows/modal-api.yml @@ -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 @@ -87,7 +90,7 @@ 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 @@ -95,7 +98,7 @@ jobs: 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 diff --git a/README.md b/README.md index 966bb29..fb90479 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/changelog.d/modal-cli-pins.fixed.md b/changelog.d/modal-cli-pins.fixed.md new file mode 100644 index 0000000..6cdf398 --- /dev/null +++ b/changelog.d/modal-cli-pins.fixed.md @@ -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.