Skip to content
Closed
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
20 changes: 11 additions & 9 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
nodeLinker: node-modules
approvedGitRepositories:
- "**"

enableScripts: true

npmMinimalAgeGate: 7d

# Supply-chain hardening (runbook §4.6): refuse npm packages younger than 7 days,
# but allow project-internal packages through so dev velocity isn't blocked.
npmMinimalAgeGate: "7d"
npmPreapprovedPackages:
- "nshm-*"
- "nzshm-*"
- "solvis-*"
- "weka-*"
- "toshi-*"
- nshm-*
- nzshm-*
- solvis-*
- weka-*
- toshi-*
2 changes: 1 addition & 1 deletion DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public.ecr.aws/lambda/python:3.12
```

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

### test wsgi handlers

Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN dnf install git-core -y &&\
dnf remove git-core -y &&\
dnf clean all

# lambda entry point — Mangum handler (was the serverless-wsgi handler.py workaround).
# ENTRYPOINT is the base image's Runtime Interface Client (/lambda-entrypoint.sh); CMD is
# the handler. Matches serverless.yml functions.ecr-app.image.{entryPoint,command}.
CMD ["solvis_graphql_api.app.handler"]
# lambda entry point
CMD ["solvis_graphql_api.solvis_graphql_api.app"]
ENTRYPOINT ["/bin/bash", "-c"]
4 changes: 2 additions & 2 deletions MIGRATION_v0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Since version v0.9.x this API uses a dynamoDB/S3 data_store for the CompositeRup
Below is the one-time script output from the cli which creates the table and pushes up the archive file.

```
% AWS_PROFILE=chrisbc S3_BUCKET_NAME=nzshm22-solvis-graphql-api-prod REGION=ap-southeast-2 DEPLOYMENT_STAGE=prod uv run cli -T -R ~/Downloads/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4
% AWS_PROFILE=chrisbc S3_BUCKET_NAME=nzshm22-solvis-graphql-api-prod REGION=ap-southeast-2 DEPLOYMENT_STAGE=prod poetry run cli -T -R ~/Downloads/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4
WARNING: optional `toshi` dependencies are not installed.
Running without `toshi` options
WARNING: geometry.section_distance() uses the optional dependency pyvista.
Expand All @@ -31,7 +31,7 @@ solvis_graphql_api cli uploaded solvis composite solution <solvis_graphql_api.da
And below is the A/B test showing that Prod/Test APIs are working and agree.

```
chrisbc@MLX01 solvis-graphql-api % uv run cli_ab_test WORK/ab.toml -A prod -B test -v
chrisbc@MLX01 solvis-graphql-api % poetry run cli_ab_test WORK/ab.toml -A prod -B test -v
WARNING: optional `toshi` dependencies are not installed.
Running without `toshi` options
config `WORK/ab.toml` has service keys: dict_keys(['prod', 'test', 'dev'])
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Java is required .


```
uv sync --all-groups
uv sync
```

Make sure the dynamodb plugin for local tests is installed
Expand All @@ -39,15 +39,15 @@ yarn sls dynamodb install
### Run full stack locally

```
# npx serverless dynamodb start --stage local &\
# npx serverless s3 start &\
SLS_OFFLINE=1 uv run uvicorn solvis_graphql_api.app:app --reload
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 uv 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
Expand All @@ -58,5 +58,5 @@ AWS_PROFILE=*** SLS_OFFLINE=1 uv run cli WORKING/NSHM_v1.0.4_CompositeSolution.z
### Push a composite solution

```
AWS_PROFILE=*** REGION=ap-southeast-4 DEPLOYMENT_STAGE=dev S3_BUCKET_NAME=nzshm22-solvis-graphql-api-dev poetry run python ./solvis_graphql_api/scripts/cli.py 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
```
313 changes: 0 additions & 313 deletions docs/MIGRATION_LOG.md

This file was deleted.

23 changes: 21 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,32 @@
"serverless": "^4.29.0",
"serverless-dynamodb": "^0.2.56",
"serverless-plugin-warmup": "^8.3.0",
"serverless-s3-local": "^0.8.5"
"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"
}
39 changes: 17 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
{name="NSHM Compute Working Group", email="nshm@gns.cri.nz"}
]
readme = "README.md"
requires-python = ">=3.12,<4.0"
requires-python = ">=3.12"
license = "AGPL-3.0-or-later"
classifiers=[
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -16,21 +16,24 @@ classifiers=[
'Programming Language :: Python :: 3.12',
]
dependencies = [
# --- new Strawberry / FastAPI / Mangum stack ---
"strawberry-graphql>=0.243",
"fastapi>=0.115",
"mangum>=0.18",
"pydantic>=2.0",
# relay global-id / cursor encoding used by the schema (was transitive via graphene)
"graphql-relay>=3.2",
# --- data + compute (unchanged) ---
"flask>=3.0.3,<4.0.0",
"flask-cors>=6.0,<7.0.0",
"geopandas>=1.0.0,<2.0.0",
"graphene>=3.3,<4.0.0",
"graphql-server==3.0.0b7",
"matplotlib>=3.10.7,<4.0.0",
"nzshm-common>=0.9.0,<1.0",
"nzshm-model>=0.14.0,<1.0",
"pyyaml>=6.0.1",
"pandas>=3.0.0,<4.0.0",
"pynamodb>=6.0.0,<7.0.0",
"pyyaml>=6.0.1,<7.0.0",
"serverless-wsgi>=3.0,<4.0",
"solvis>=1.2.0,<2.0",
]

[tool.hatch.build.targets.wheel]
packages = ["solvis_graphql_api"]

[project.scripts]
cli = 'solvis_graphql_api.scripts.cli:cli'
cli_ab_test = 'solvis_graphql_api.scripts.cli_ab_test:cli'
Expand All @@ -40,21 +43,16 @@ dev = [
"bump2version",
"click",
"deepdiff",
"httpx",
"moto",
"mypy",
"pip-audit",
"pre-commit",
"pytest-cov",
"pytest",
"ruff",
"uvicorn",
"safety",
"sgqlc",
"shapely",
"toml",
"tox",
"tox-uv",
"twine",
"types-python-dateutil",
"types-PyYAML",
Expand All @@ -65,19 +63,17 @@ dev = [
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["solvis_graphql_api"]

[tool.uv]
exclude-newer = "1 week"
# nzshm* packages ship fresh — always resolve to latest.
exclude-newer-package = { "nzshm-common" = false, "nzshm-model" = false }

[tool.ruff]
line-length = 120 # matches prior flake8 max-line-length
line-length = 120

[tool.ruff.lint]
select = ["E", "F", "I", "B", "UP"] # G004 (f-string logging) deferred to a follow-up
select = ["E", "F", "I", "B", "UP"]
ignore = ["E203", "E266", "E501"]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
Expand All @@ -86,6 +82,5 @@ select = ["E", "F", "I", "B", "UP"] # G004 (f-string logging) deferred to a fol
quote-style = "preserve"

[tool.mypy]
plugins = ["strawberry.ext.mypy_plugin"]
ignore_missing_imports = true
exclude = "solvis_graphql_api/ab_test/client"
exclude = ["solvis_graphql_api/ab_test/client"]
Loading
Loading