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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.9.1
current_version = 0.9.2
commit = True
tag = True

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
operating-systems: "['ubuntu-latest']"
python-versions: "['3.12']"
delete-poetry-lock: ${{ github.event_name == 'schedule' }} # the scheduled build tests against newer dependencies
optional-dependency-groups: dev
secrets: inherit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
requirements.txt

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -121,4 +122,4 @@ ENV/

# mkdocs build dir
site/
4

11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [0.9.2] 2025-10-15
### Changed
- migrate to serverless 4
- set serverless to python 3.12
- migrate pyproject.toml to PEP508
- ensureCI/CD workflows use minimum install footprints
- less logging verbosityd
- update to latest `nzhms-common, nzshm-model, solvis` libs

## [0.9.1] 2025-10-07

### Changed
Expand All @@ -18,7 +27,7 @@
- more test coverage
- new `cli_ab_test` script for comparing live API outputs.
This uses `sgql` and `deepdiff` libraries.
- new `client` package contains API clients built using `sgql`
- new `client` package contains API clients built using `sgqlc`

### Removed
- `solvis_store` dependency
Expand Down
10 changes: 1 addition & 9 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,10 @@ poetry export --without-hashes --format=requirements.txt > requirements.txt

### test wsgi handlers

** THIS doesn't work with ECR>
```
ENABLE_METRICS=0 poetry run yarn sls wsgi serve
```

**TRY this alternative** in the meantime ....

This will need some further work because it is not using serverless (e.g. no env variables are set )
```
ENABLE_METRICS=0 poetry run python3 -m solvis_graphql_api.solvis_graphql_api
```

## A Dockerfile

see [Dockerfile](./Dockerfile)
Expand All @@ -54,4 +46,4 @@ BUILDX_NO_DEFAULT_ATTESTATIONS=1 yarn sls package
### and/or just deploy it
```
BUILDX_NO_DEFAULT_ATTESTATIONS=1 yarn sls deploy --stage dev --region ap-southeast-2
```
```
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "solvis-graphql-api",
"version": "0.9.1",
"version": "0.9.2",
"description": "A graphql API for analysis and geojson visualisation from NZSHM Inversion Solutions.",
"dependencies": {
"serverless": "^3.40.0",
"serverless": "^4.21.0",
"serverless-dynamodb": "^0.2.56",
"serverless-plugin-warmup": "^8.3.0",
"serverless-python-requirements": "^6.1.2",
"serverless-s3-local": "^0.8.5",
"serverless-wsgi": "^3.1.0"
},
Expand Down
964 changes: 501 additions & 463 deletions poetry.lock

Large diffs are not rendered by default.

108 changes: 52 additions & 56 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,75 +1,71 @@
[project]
name = "solvis-graphql-api"
version = "0.9.1"
description = ""
version = "0.9.2"
description = "The Graphql API for analysis of opensha modular Inversion Solutions."
authors = [
{name = "Chris B Chamberlain",email = "chrisbc@artisan.co.nz"}
{name = "Chris B Chamberlain",email = "chrisbc@artisan.co.nz"},
{name="NSHM Compute Working Group", email="nshm@gns.cri.nz"}
]
license = {text = "AGPL3"}
readme = "README.md"
requires-python = "^3.12"
license = "AGPL-3.0-or-later"
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Natural Language :: English',
'Programming Language :: Python :: 3.12',
]
dependencies = [
"flask (>=3.0.3)",
"flask-cors (>=6.0)",
"graphene (>=3.3)",
"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)",
"pynamodb (>=6.0.0)",
"pyyaml (>=6.0.1)",
"serverless-wsgi (>=3.0)",
"solvis (>=1.2.0,<2.0 )",
]

packages = [
{include = "solvis_graphql_api"}
]

[tool.poetry.scripts]
[project.scripts]
cli = 'solvis_graphql_api.scripts.cli:cli'
cli_ab_test = 'solvis_graphql_api.scripts.cli_ab_test:cli'

[tool.poetry.dependencies]
flask = "^3.0.3"
flask-cors = "^6.0"
graphql-server = {extras = ["flask"], version = "3.0.0b7"}
graphene = "^3.3"
pyyaml = "^6.0.1"

nzshm-model = ">=0.6.0"
nzshm-common = ">=0.7.0"
solvis = "^1.0"
serverless-wsgi = "^3.0"
matplotlib = "^3.7.1"

# see https://github.com/orgs/python-poetry/discussions/7937
# urllib3 = "<2"
# numpy = "<1.25"
# backoff = "^2.2.1"
pynamodb = "^6.0.0"

# GHSA-pq67-6m6q-mj2v
# Cant apply until solvis-store is updated
# urllib3 = "^2.5.0"

[tool.poetry.group.dev.dependencies]
tox = ">=4.0"
black = { version = "^24.0"}
isort = { version = "^5.8.0"}
flake8 = { version = "^7.3.0"}
flake8-docstrings = { version = "^1.7.0", optional = true }
pytest = "^7.4.0"
pytest-cov = { version = "^2.12.0"}
[tool.poetry.group.dev]
optional = true

virtualenv = { version = "^20.2.2", optional = true}

mypy = {version = "^1.10"}

twine = { version = "^3.3.0"}

pre-commit = {version = "^2.12.0", optional = true}
toml = {version = "^0.10.2", optional = true}
bump2version = {version = "^1.0.1"}
types-python-dateutil = "^2.8.16"
types-PyYAML = "^6.0.7"
moto = "^4.0.2"

pip = "^25.0"
pip-audit = "^2.9.0"
safety = "^3.6.2"
sgqlc = "^17"
click = "^8.3.0"
types-toml = "^0.10.8.20240310"
deepdiff = "^8.6.1"
[dependency-groups]
dev = [
"black",
"bump2version",
"click",
"deepdiff",
"flake8-docstrings",
"flake8",
"isort",
"moto",
"mypy",
"pip-audit",
"pip-audit",
"pre-commit",
"pytest-cov",
"pytest",
"safety",
"sgqlc",
"shapely",
"toml",
"tox",
"twine",
"types-python-dateutil",
"types-PyYAML",
"types-toml",
]

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
Expand Down
54 changes: 0 additions & 54 deletions requirements.txt

This file was deleted.

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


configValidationMode: error

plugins:
Expand Down Expand Up @@ -33,7 +36,6 @@ package:
- 'yarn.lock'
- solvis_graphql_api/**


custom:

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

# #serverless-python-requirements settings
# pythonRequirements:
# dockerizePip: True
# useDownloadCache: false
# useStaticCache: false
# slim: true
# slimPatterns:
# - "**/*.egg-info*"
# noDeploy:
# - boto3
# - botocore
# - vtkmodules
# - mkdocs
# - pip
# - tzdata
# - fontTools

#serverless-s3-local settings
s3:
host: localhost
Expand All @@ -106,7 +91,7 @@ custom:

provider:
name: aws
runtime: python3.10
runtime: python3.12
stage: ${opt:stage, 'dev'}
region: ap-southeast-2
ecr:
Expand Down Expand Up @@ -167,7 +152,6 @@ provider:
Resource:
- "arn:aws:ecr:*:461564345538:repository/*"


functions:
ecr-app:
description: The graphql API of ${self:service} as ECR container
Expand Down
2 changes: 1 addition & 1 deletion solvis_graphql_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """GNS Science"""
__email__ = "chrisbc@artisan.co.nz"
__version__ = "0.9.1"
__version__ = "0.9.2"
21 changes: 3 additions & 18 deletions solvis_graphql_api/logging_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,16 @@ formatters:
handlers:

console_handler:
level: DEBUG
level: INFO
formatter: standard
class: logging.StreamHandler
stream: ext://sys.stdout

loggers:

root:
level: DEBUG
handlers: [console_handler]

fiona:
level: WARNING
level: INFO
handlers: [console_handler]
propagate: no

flask:
level: WARNING
Expand All @@ -37,7 +32,7 @@ loggers:
propagate: no

pynamodb:
level: DEBUG
level: INFO
handlers: [console_handler]
propagate: no

Expand All @@ -52,16 +47,6 @@ loggers:
propagate: no

solvis_graphql_api:
level: DEBUG
handlers: [console_handler]
propagate: no

solvis_store:
level: DEBUG
handlers: [console_handler]
propagate: no

backoff:
level: INFO
handlers: [console_handler]
propagate: no
Expand Down
Loading