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
4 changes: 4 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ replace = __version__ = "{new_version}"
[bumpversion:file:package.json]
search = "version": "{current_version}",
replace = "version": "{new_version}",

[bumpversion:file:uv.lock]
search = {current_version}
replace = {current_version}
4 changes: 2 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ on:

jobs:
call-test-workflow:
uses: GNS-Science/nshm-github-actions/.github/workflows/python-run-tests.yml@main
uses: GNS-Science/nshm-github-actions/.github/workflows/python-run-tests-uv.yml@main
with:
operating-systems: "['ubuntu-latest']"
python-versions: "['3.12']"
delete-poetry-lock: ${{ github.event_name == 'schedule' }} # the scheduled build tests against newer dependencies
delete-uv-lock: ${{ github.event_name == 'schedule' }} # the scheduled build tests against newer dependencies
optional-dependency-groups: dev
secrets: inherit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Node
node_modules/**
.yarn/**
package-lock.json

# serverless
Expand Down Expand Up @@ -126,3 +127,5 @@ site/
.claude/settings.local.json
.yarn/install-state.gz
audit.txt
.pnp.cjs
.pnp.loader.mjs
13 changes: 13 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
approvedGitRepositories:
- "**"

enableScripts: true

npmMinimalAgeGate: 7d

npmPreapprovedPackages:
- nshm-*
- nzshm-*
- solvis-*
- weka-*
- toshi-*
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## [Unreleased]
### Changed
- upgrade dependencies
- upgrade black to 26.x
- Migrated to uv and ruff
- Dependency upgrades

## [0.9.2] 2025-10-15
### Changed
Expand Down
22 changes: 11 additions & 11 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A GraphQL API for querying and analyzing NZSHM (New Zealand Seismic Hazard Model
```bash
corepack enable && yarn set version berry
yarn install
poetry install
uv sync
yarn sls dynamodb install # requires Java
```

Expand All @@ -23,28 +23,28 @@ npx serverless dynamodb start --stage local
npx serverless s3 start

# Start the API server
SLS_OFFLINE=1 poetry run yarn sls wsgi serve
SLS_OFFLINE=1 uv run yarn sls wsgi serve
```

### Testing
```bash
poetry run pytest # all tests
poetry run pytest tests/test_file.py # single file
poetry run pytest tests/test_file.py::test_function_name # single test
poetry run pytest -m "not slow" # skip slow tests
poetry run tox # full test suite via tox
uv run pytest # all tests
uv run pytest tests/test_file.py # single file
uv run pytest tests/test_file.py::test_function_name # single test
uv run pytest -m "not slow" # skip slow tests
uv run tox # full test suite via tox
```

### Linting & Formatting
```bash
poetry run tox -e lint # flake8 + mypy
poetry run tox -e format # isort + black
poetry run tox -e audit # pip-audit security scan
uv run tox -e lint # ruff + mypy
uv run tox -e format # ruff format
uv run tox -e audit # pip-audit security scan
```

### Deploy
```bash
poetry export --without-hashes --format=requirements.txt > requirements.txt
uv export --format requirements-txt --no-emit-project > requirements.txt
BUILDX_NO_DEFAULT_ATTESTATIONS=1 yarn sls deploy --stage dev --region ap-southeast-2
```

Expand Down
4 changes: 2 additions & 2 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public.ecr.aws/lambda/python:3.12
```

### Update the requirements
poetry export --without-hashes --format=requirements.txt > requirements.txt
uv export --format requirements-txt --no-emit-project > requirements.txt

### test wsgi handlers

```
ENABLE_METRICS=0 poetry run yarn sls wsgi serve
ENABLE_METRICS=0 uv run yarn sls wsgi serve
```

## A Dockerfile
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,35 @@ Java is required .


```
poetry install
poetry lock
poetry shell
uv sync
```

Make sure the dynamob plugin for local tests is installed
Make sure the dynamodb plugin for local tests is installed
```
yarn sls dynamodb install
```

### Run full stack locally

```
# npx serverless dynamodb start --stage local &\
# npx serverless s3 start &\
SLS_OFFLINE=1 poetry run yarn sls wsgi serve
npx serverless dynamodb start --stage local &\
npx serverless s3 start &\
SLS_OFFLINE=1 uv run yarn sls wsgi serve
```

then

```
AWS_PROFILE=*** SLS_OFFLINE=1 poetry run cli WORKING/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4 -R --ensure_table
AWS_PROFILE=*** SLS_OFFLINE=1 uv run python ./solvis_graphql_api/scripts/cli.py WORKING/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4 -R --ensure_table
```

### Unit tests

`poetry run pytest` note that some environment variables are set in `setup.cfg`.
`uv run pytest` note that some environment variables are set in `setup.cfg`.


### Push a composite solution

```
AWS_PROFILE=*** REGION=ap-southeast-4 DEPLOYMENT_STAGE=dev S3_BUCKET_NAME=nzshm22-solvis-graphql-api-dev cli WORKING/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4 -R
```
AWS_PROFILE=*** REGION=ap-southeast-4 DEPLOYMENT_STAGE=dev S3_BUCKET_NAME=nzshm22-solvis-graphql-api-dev uv run python ./solvis_graphql_api/scripts/cli.py WORKING/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4 -R
```
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,29 @@
"serverless-s3-local": "^0.8.5",
"serverless-wsgi": "^3.1.0"
},
"resolutions": {
"@hapi/content": "6.0.1",
"dicer": "0.3.1",
"@smithy/config-resolver": "4.4.17",
"axios": "1.15.2",
"follow-redirects": "1.16.0",
"lodash": "4.18.1",
"@koa/router": "10.0.0",
"brace-expansion": "2.0.3",
"fast-xml-parser": "5.7.0",
"glob": "10.5.0",
"koa": "2.16.4",
"minimatch": "9.0.7",
"tar": "7.5.11"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"smoke": "uv run python scripts/smoke_test.py",
"requirements_1": "serverless requirements clean",
"requirements_2": "serverless requirements cleanCache",
"dummy_pkg": "serverless package --stage dummy",
"deploy": "serverless deploy --stage ${STAGE}",
"sls_doctor": "serverless doctor"
},
"packageManager": "yarn@4.10.3"
"packageManager": "yarn@4.14.1"
}
Loading
Loading