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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.tox
.git
.github/workflows
.venv*
src/zepben/lib/generated_graphql_client
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EAS_TAG=edge
38 changes: 38 additions & 0 deletions .github/evolve-app-server/client-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"server": {
"host": "0.0.0.0",
"publicAddress": "http://localhost",
"useTls": false,
"port": 7654,
"webRoot": "../evolve-web-app/dist",
"webClientHost": "*",
"logFile": "logs/logFile.log"
},
"ewb": {
"host": "ewb.local",
"port": 9000,
"protocol": "HTTPS",
"requestMethod": "GET",
"verifyCertificate": false
},
"database": {
"url": "jdbc:postgresql://localhost:5432/eas?user=eas&password=password",
"driver": "org.postgresql.Driver",
"createSchemaOnStart": true
},
"ui": {
"powerFactoryExporterEnabled": true
},
"jwks": {
"issuer": "http://localhost:7654"
},
"auth": {
"audience": "80b6b329-bc8f-4479-943a-9daf755a06a7",
"method": "none",
"defaultUserId": "guy1",
"defaultUsername": "some",
"defaultUserEmail": "a@b",
"defaultUserRoles": ["MAP_VIEWER", "SUPER_ADMIN", "EWB_ADMIN", "DEVELOPER", "METRICS_VIEWER"]
}

}
38 changes: 38 additions & 0 deletions .github/evolve-app-server/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"server": {
"host": "0.0.0.0",
"publicAddress": "http://localhost",
"useTls": false,
"port": 7654,
"webRoot": "../evolve-web-app/dist",
"webClientHost": "*",
"logFile": "logs/logFile.log"
},
"ewb": {
"host": "ewb.local",
"port": 9000,
"protocol": "HTTPS",
"requestMethod": "GET",
"verifyCertificate": false
},
"database": {
"url": "jdbc:postgresql://postgres:5432/eas?user=eas&password=password",
"driver": "org.postgresql.Driver",
"createSchemaOnStart": true
},
"ui": {
"powerFactoryExporterEnabled": true
},
"jwks": {
"issuer": "http://localhost:7654"
},
"auth": {
"audience": "80b6b329-bc8f-4479-943a-9daf755a06a7",
"method": "none",
"defaultUserId": "guy1",
"defaultUsername": "some",
"defaultUserEmail": "a@b",
"defaultUserRoles": ["MAP_VIEWER", "SUPER_ADMIN", "EWB_ADMIN", "DEVELOPER", "METRICS_VIEWER"]
}

}
17 changes: 17 additions & 0 deletions .github/workflows/client-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Python Library Release

on:
repository_dispatch:
types:
[evolve-app-server-build]

jobs:
run:
uses: zepben/.github/.github/workflows/python-lib-release.yml@main
with:
private: false
python-version: "3.10"
docker-container: codegen
docker-compose-env: '{"EAS_TAG": "${{ github.event.client_payload.eas-tag }}"}'
package-release-version: "${{ github.event.client_payload.eas-tag }}"
secrets: inherit
14 changes: 0 additions & 14 deletions .github/workflows/python-hotfix-branch.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/python-lib-build-eas-edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Python Lib Build (Latest Evolve App Server)

on:
push:

jobs:
run:
uses: zepben/.github/.github/workflows/python-build.yml@main
with:
python-versions-to-test: "['3.10', '3.11', '3.12']"
docker-container: codegen
secrets: inherit
21 changes: 21 additions & 0 deletions .github/workflows/python-lib-build-eas-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Python Lib Build (Tagged Evolve App Server)

on:
workflow_dispatch:
inputs:
eas-tag:
description: 'evolve-app-server version tag (e.g. 2.13.0) to generate client for.'
required: true
type: string

jobs:
run:
uses: zepben/.github/.github/workflows/python-build.yml@main
if: ${{ inputs.eas-tag }} != ''
with:
docker-compose-env: '{"EAS_TAG": "${{ inputs.eas-tag }}"}'
override-version: "${{ inputs.eas-tag }}"
python-versions-to-test: "['3.10', '3.11', '3.12']"
docker-container: codegen
secrets: inherit

11 changes: 0 additions & 11 deletions .github/workflows/python-lib-build.yml

This file was deleted.

18 changes: 17 additions & 1 deletion .github/workflows/python-lib-release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
name: Python Library Release

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
eas-tag:
description: 'evolve-app-server version tag (e.g. 2.13.0) to generate client for.'
required: true
type: string
workflow_call:
inputs:
eas-tag:
description: 'evolve-app-server version tag (e.g. 2.13.0) to generate client for.'
required: true
type: string

jobs:
run:
uses: zepben/.github/.github/workflows/python-lib-release.yml@main
with:
private: false
python-version: "3.10"
docker-container: codegen
docker-compose-env: '{"EAS_TAG": "${{ inputs.eas-tag }}"}'
package-release-version: "${{ inputs.eas-tag }}"
secrets: inherit
16 changes: 0 additions & 16 deletions .github/workflows/python-lib-snapshot.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/python-lts-branch.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ docs/yarn-error.log*
docs/versioned_docs/static/

.tox/

src/zepben/eas/lib/generated_graphql_client/

src/zepben/eas/lib/

.coverage

coverage.xml
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.10
RUN mkdir /app
WORKDIR /app
COPY . .
RUN pip install ".[codegen, test]"
CMD ["python", "ariadne-codegen.py"]
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ the Evolve App Server and upload studies.

```python
from geojson import FeatureCollection
from zepben.eas import EasClient, StudyInput, StudyResultInput, GeoJsonOverlayInput, ResultSectionInput, SectionType, Mutation
from src.zepben.eas import EasClient, StudyInput, StudyResultInput, GeoJsonOverlayInput, ResultSectionInput,
SectionType, Mutation

eas_client = EasClient(
host="<host>",
Expand Down Expand Up @@ -40,8 +41,10 @@ eas_client.mutation(
{"key": "<column 2 key>", "name": "<column 2 name>"},
],
data=[
{"<column 1 key>": "<column 1 row 1 value>", "<column 2 key>": "<column 2 row 1 value>"},
{"<column 1 key>": "<column 1 row 2 value>", "<column 2 key>": "<column 2 row 2 value>"}
{"<column 1 key>": "<column 1 row 1 value>",
"<column 2 key>": "<column 2 row 1 value>"},
{"<column 1 key>": "<column 1 row 2 value>",
"<column 2 key>": "<column 2 row 2 value>"}
]
)
]
Expand All @@ -67,7 +70,8 @@ The EasClient can operate in async mode if specified, like so:
```python
from aiohttp import ClientSession
from geojson import FeatureCollection
from zepben.eas import EasClient, StudyInput, StudyResultInput, GeoJsonOverlayInput, ResultSectionInput, SectionType, Mutation
from src.zepben.eas import EasClient, StudyInput, StudyResultInput, GeoJsonOverlayInput, ResultSectionInput,
SectionType, Mutation


async def upload():
Expand Down Expand Up @@ -102,8 +106,10 @@ async def upload():
{"key": "<column 2 key>", "name": "<column 2 name>"},
],
data=[
{"<column 1 key>": "<column 1 row 1 value>", "<column 2 key>": "<column 2 row 1 value>"},
{"<column 1 key>": "<column 1 row 2 value>", "<column 2 key>": "<column 2 row 2 value>"}
{"<column 1 key>": "<column 1 row 1 value>",
"<column 2 key>": "<column 2 row 1 value>"},
{"<column 1 key>": "<column 1 row 2 value>",
"<column 2 key>": "<column 2 row 2 value>"}
]
)
]
Expand Down Expand Up @@ -133,7 +139,7 @@ The new EasClient is fully type hinted and self documenting.
For example.

```python
from zepben.eas import EasClient, WorkPackageInput, HcExecutorConfigInput, FeederConfigsInput, FeederConfigInput
from src.zepben.eas import EasClient, WorkPackageInput, HcExecutorConfigInput, FeederConfigsInput, FeederConfigInput

client = EasClient(host='host', port=1234)
client.get_work_package_cost_estimation(
Expand All @@ -158,7 +164,7 @@ Hovering over any kwarg or looking at any class definition will show all possibl
Legacy convenience methods can be enabled by passing `enable_legacy_methods` to `__init__` of `EasClient`. eg:

```python
from zepben.eas import EasClient
from src.zepben.eas import EasClient

client = EasClient(enable_legacy_methods=True)
```
Expand All @@ -167,14 +173,16 @@ This will enable all `deprecated` and `opt_in` methods on the class, they are di

# Development #

To regenerate the graphql client you will need to install `zepben.eas` with `eas-codegen` optional dependencies:
To regenerate the graphql client, run the following command

```shell
pip install -e ".[eas-codegen]"
docker compose run codegen
```

With these installed and EAS running locally on port 7654, you can then generate the client:
If you have done any of the following, you will need to regenerate the docker image if testing locally.
- Made changes to anything that affects the python package
- Changed anything under `ariadne_plugins`

```shell
python ariadne-codegen.py
docker build .
```
Loading
Loading