Skip to content

Commit 7830586

Browse files
authored
Merge pull request #78 from GNS-Science/chore/77-serverless-v4
migrate to serverless v4 - ensure python 3.12 in all configs - perform sls V4 upgrade (with yarn) - tested DEV deploy/remove - update pyproject.toml to PEP508 - update to latest model/common/solvis libs - package audits yarn/poetry
2 parents 90f1f4f + 33df803 commit 7830586

File tree

14 files changed

+1603
-6331
lines changed

14 files changed

+1603
-6331
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.9.1
2+
current_version = 0.9.2
33
commit = True
44
tag = True
55

.github/workflows/dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ jobs:
1919
operating-systems: "['ubuntu-latest']"
2020
python-versions: "['3.12']"
2121
delete-poetry-lock: ${{ github.event_name == 'schedule' }} # the scheduled build tests against newer dependencies
22+
optional-dependency-groups: dev
2223
secrets: inherit

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ wheels/
3838
*.egg-info/
3939
.installed.cfg
4040
*.egg
41+
requirements.txt
4142

4243
# PyInstaller
4344
# Usually these files are written by a python script from a template
@@ -121,4 +122,4 @@ ENV/
121122

122123
# mkdocs build dir
123124
site/
124-
4
125+

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## [0.9.2] 2025-10-15
4+
### Changed
5+
- migrate to serverless 4
6+
- set serverless to python 3.12
7+
- migrate pyproject.toml to PEP508
8+
- ensureCI/CD workflows use minimum install footprints
9+
- less logging verbosityd
10+
- update to latest `nzhms-common, nzshm-model, solvis` libs
11+
312
## [0.9.1] 2025-10-07
413

514
### Changed
@@ -18,7 +27,7 @@
1827
- more test coverage
1928
- new `cli_ab_test` script for comparing live API outputs.
2029
This uses `sgql` and `deepdiff` libraries.
21-
- new `client` package contains API clients built using `sgql`
30+
- new `client` package contains API clients built using `sgqlc`
2231

2332
### Removed
2433
- `solvis_store` dependency

DEPLOYMENT.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,10 @@ poetry export --without-hashes --format=requirements.txt > requirements.txt
3030

3131
### test wsgi handlers
3232

33-
** THIS doesn't work with ECR>
3433
```
3534
ENABLE_METRICS=0 poetry run yarn sls wsgi serve
3635
```
3736

38-
**TRY this alternative** in the meantime ....
39-
40-
This will need some further work because it is not using serverless (e.g. no env variables are set )
41-
```
42-
ENABLE_METRICS=0 poetry run python3 -m solvis_graphql_api.solvis_graphql_api
43-
```
44-
4537
## A Dockerfile
4638

4739
see [Dockerfile](./Dockerfile)
@@ -54,4 +46,4 @@ BUILDX_NO_DEFAULT_ATTESTATIONS=1 yarn sls package
5446
### and/or just deploy it
5547
```
5648
BUILDX_NO_DEFAULT_ATTESTATIONS=1 yarn sls deploy --stage dev --region ap-southeast-2
57-
```
49+
```

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "solvis-graphql-api",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "A graphql API for analysis and geojson visualisation from NZSHM Inversion Solutions.",
55
"dependencies": {
6-
"serverless": "^3.40.0",
6+
"serverless": "^4.21.0",
77
"serverless-dynamodb": "^0.2.56",
88
"serverless-plugin-warmup": "^8.3.0",
9-
"serverless-python-requirements": "^6.1.2",
109
"serverless-s3-local": "^0.8.5",
1110
"serverless-wsgi": "^3.1.0"
1211
},

poetry.lock

Lines changed: 501 additions & 463 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 52 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,71 @@
11
[project]
22
name = "solvis-graphql-api"
3-
version = "0.9.1"
4-
description = ""
3+
version = "0.9.2"
4+
description = "The Graphql API for analysis of opensha modular Inversion Solutions."
55
authors = [
6-
{name = "Chris B Chamberlain",email = "[email protected]"}
6+
{name = "Chris B Chamberlain",email = "[email protected]"},
7+
{name="NSHM Compute Working Group", email="[email protected]"}
78
]
8-
license = {text = "AGPL3"}
99
readme = "README.md"
1010
requires-python = "^3.12"
11+
license = "AGPL-3.0-or-later"
12+
classifiers=[
13+
'Development Status :: 2 - Pre-Alpha',
14+
'Intended Audience :: Developers',
15+
'Natural Language :: English',
16+
'Programming Language :: Python :: 3.12',
17+
]
1118
dependencies = [
19+
"flask (>=3.0.3)",
20+
"flask-cors (>=6.0)",
21+
"graphene (>=3.3)",
22+
"graphql-server (==3.0.0b7)",
23+
"matplotlib (>=3.10.7,<4.0.0)",
24+
"nzshm-common (>=0.9.0,<1.0)",
25+
"nzshm-model (>=0.14.0,<1.0)",
26+
"pynamodb (>=6.0.0)",
27+
"pyyaml (>=6.0.1)",
28+
"serverless-wsgi (>=3.0)",
29+
"solvis (>=1.2.0,<2.0 )",
1230
]
31+
1332
packages = [
1433
{include = "solvis_graphql_api"}
1534
]
1635

17-
[tool.poetry.scripts]
36+
[project.scripts]
1837
cli = 'solvis_graphql_api.scripts.cli:cli'
1938
cli_ab_test = 'solvis_graphql_api.scripts.cli_ab_test:cli'
2039

21-
[tool.poetry.dependencies]
22-
flask = "^3.0.3"
23-
flask-cors = "^6.0"
24-
graphql-server = {extras = ["flask"], version = "3.0.0b7"}
25-
graphene = "^3.3"
26-
pyyaml = "^6.0.1"
27-
28-
nzshm-model = ">=0.6.0"
29-
nzshm-common = ">=0.7.0"
30-
solvis = "^1.0"
31-
serverless-wsgi = "^3.0"
32-
matplotlib = "^3.7.1"
33-
34-
# see https://github.com/orgs/python-poetry/discussions/7937
35-
# urllib3 = "<2"
36-
# numpy = "<1.25"
37-
# backoff = "^2.2.1"
38-
pynamodb = "^6.0.0"
39-
40-
# GHSA-pq67-6m6q-mj2v
41-
# Cant apply until solvis-store is updated
42-
# urllib3 = "^2.5.0"
43-
44-
[tool.poetry.group.dev.dependencies]
45-
tox = ">=4.0"
46-
black = { version = "^24.0"}
47-
isort = { version = "^5.8.0"}
48-
flake8 = { version = "^7.3.0"}
49-
flake8-docstrings = { version = "^1.7.0", optional = true }
50-
pytest = "^7.4.0"
51-
pytest-cov = { version = "^2.12.0"}
40+
[tool.poetry.group.dev]
41+
optional = true
5242

53-
virtualenv = { version = "^20.2.2", optional = true}
54-
55-
mypy = {version = "^1.10"}
56-
57-
twine = { version = "^3.3.0"}
58-
59-
pre-commit = {version = "^2.12.0", optional = true}
60-
toml = {version = "^0.10.2", optional = true}
61-
bump2version = {version = "^1.0.1"}
62-
types-python-dateutil = "^2.8.16"
63-
types-PyYAML = "^6.0.7"
64-
moto = "^4.0.2"
65-
66-
pip = "^25.0"
67-
pip-audit = "^2.9.0"
68-
safety = "^3.6.2"
69-
sgqlc = "^17"
70-
click = "^8.3.0"
71-
types-toml = "^0.10.8.20240310"
72-
deepdiff = "^8.6.1"
43+
[dependency-groups]
44+
dev = [
45+
"black",
46+
"bump2version",
47+
"click",
48+
"deepdiff",
49+
"flake8-docstrings",
50+
"flake8",
51+
"isort",
52+
"moto",
53+
"mypy",
54+
"pip-audit",
55+
"pip-audit",
56+
"pre-commit",
57+
"pytest-cov",
58+
"pytest",
59+
"safety",
60+
"sgqlc",
61+
"shapely",
62+
"toml",
63+
"tox",
64+
"twine",
65+
"types-python-dateutil",
66+
"types-PyYAML",
67+
"types-toml",
68+
]
7369

7470
[build-system]
7571
requires = ["poetry-core>=2.0.0,<3.0.0"]

requirements.txt

Lines changed: 0 additions & 54 deletions
This file was deleted.

serverless.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# "org" ensures this Service is used with the correct Serverless Framework Access Key.
2+
org: gnssciencenshm
3+
# "app" enables Serverless Framework Dashboard features and sharing them with other Services.
4+
app: solvis-graphql-api
15
service: nzshm22-solvis-graphql-api
26

3-
47
configValidationMode: error
58

69
plugins:
@@ -33,7 +36,6 @@ package:
3336
- 'yarn.lock'
3437
- solvis_graphql_api/**
3538

36-
3739
custom:
3840

3941
# DRY constants: define all compound/generated names in one place
@@ -63,23 +65,6 @@ custom:
6365
packRequirements: false
6466
pythonBin: python3.12
6567

66-
# #serverless-python-requirements settings
67-
# pythonRequirements:
68-
# dockerizePip: True
69-
# useDownloadCache: false
70-
# useStaticCache: false
71-
# slim: true
72-
# slimPatterns:
73-
# - "**/*.egg-info*"
74-
# noDeploy:
75-
# - boto3
76-
# - botocore
77-
# - vtkmodules
78-
# - mkdocs
79-
# - pip
80-
# - tzdata
81-
# - fontTools
82-
8368
#serverless-s3-local settings
8469
s3:
8570
host: localhost
@@ -106,7 +91,7 @@ custom:
10691

10792
provider:
10893
name: aws
109-
runtime: python3.10
94+
runtime: python3.12
11095
stage: ${opt:stage, 'dev'}
11196
region: ap-southeast-2
11297
ecr:
@@ -167,7 +152,6 @@ provider:
167152
Resource:
168153
- "arn:aws:ecr:*:461564345538:repository/*"
169154

170-
171155
functions:
172156
ecr-app:
173157
description: The graphql API of ${self:service} as ECR container

0 commit comments

Comments
 (0)