Skip to content

Commit 228aae6

Browse files
committed
adapting code to match current pygeoapi
1 parent 942222b commit 228aae6

File tree

2 files changed

+284
-163
lines changed

2 files changed

+284
-163
lines changed

docs/development.md

Lines changed: 67 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,60 @@
11
# Development
22

3+
## Installation
4+
35
Install this project with uv
46

57
```shell
68
git clone
79
uv sync
810
```
911

10-
Start the prefect server:
1112

12-
```shell
13-
uv run prefect server start
14-
```
13+
## Set-up
1514

16-
Update the prefect config, as directed by the prefect server:
15+
Prepare a `.env` suitable for development, similar to:
1716

18-
```shell
19-
uv run prefect config set PREFECT_API_URL=http://127.0.0.1:4200/api
17+
```dotenv
18+
# prefect variables
19+
PREFECT_API_URL=http://127.0.0.1:4200/api
20+
PREFECT_SERVER_ANALYTICS_ENABLED=false
21+
DO_NOT_TRACK=1
22+
23+
# pygeoapi variables
24+
PYGEOAPI_CONFIG=example-config.yml
25+
PYGEOAPI_OPENAPI=example-openapi.yml
2026
```
2127

22-
If you want to deploy a pygeoapi process locally with prefect, then also start a prefect agent:
28+
!!! WARNING
29+
30+
We recommend naming the env file `pygeoapi-prefect.env` and sourcing it like this:
31+
32+
```shell
33+
set -o allexport; source pygeoapi-prefect.env; set +o allexport
34+
```
35+
36+
All following examples assume the env file has already been sourced.
37+
38+
39+
Start the prefect server:
2340

2441
```shell
25-
uv run prefect agent start --work-queue pygeoapi
42+
uv run prefect server start
2643
```
2744

28-
Now stand up pygeoapi with the provided config files:
45+
The prefect UI shall now be available at http://localhost:4200
46+
47+
48+
If you want to deploy a pygeoapi process locally with prefect, then also start a prefect agent:
2949

3050
```shell
31-
PYGEOAPI_CONFIG=example-config.yml PYGEOAPI_OPENAPI=example-openapi.yml uv run pygeoapi serve
51+
uv run prefect agent start --type process --pool pygeoapi
3252
```
3353

34-
If you need to regenerate the openapi description file, run:
54+
Now stand up pygeoapi
3555

3656
```shell
37-
uv run pygeoapi openapi generate example-config.yml > example-openapi.yml
57+
uv run pygeoapi serve --starlette
3858
```
3959

4060
Deploy the `hi-prefect-world` process:
@@ -50,20 +70,42 @@ uv run prefect deployment run --param
5070
```
5171

5272

53-
- List processes
73+
## Operations
74+
75+
76+
!!! TIP
77+
78+
All examples below use:
79+
80+
- [httpie](https://httpie.io/) as a CLI HTTP client;
81+
- [jq](https://jqlang.org/) as a CLI JSON processor;
82+
83+
84+
- List available process ids
85+
86+
```shell
87+
http localhost:5000/processes | jq '.processes[].id'
88+
```
89+
90+
- Retrieve details about a process (for example the process with id `hello-world`):
91+
92+
```shell
93+
http localhost:5000/processes/hello-world | jq '.'
94+
```
5495

55-
```shell
56-
http -v localhost:5000/processes
57-
```
96+
- Execute the pygeoapi `hello-world` process, via prefect. In this example we pass a JSON object
97+
with the inputs that the process needs:
5898

59-
- Execute the standard `hello-world` process via prefect:
99+
```shell
100+
http localhost:5000/processes/hello-world/execution \
101+
inputs:='{"message": "Yo", "name": "planet Earth"}'
102+
```
60103

61-
```shell
62-
http -v localhost:5000/processes/hello-world/execution inputs:='{"message": "Yo", "name": "planet Earth"}'
63-
```
104+
Prefect records flow run executions - you can check them in the Prefect UI, under `runs`
64105

65-
- Execute our `hi-prefect-world` process:
106+
- Execute our `hi-prefect-world` process:
66107

67-
```shell
68-
http -v localhost:5000/processes/hi-prefect-world/execution inputs:='{"message": "Yo", "name": "planet Earth"}'
69-
```
108+
```shell
109+
http -v localhost:5000/processes/hi-prefect-world/execution \
110+
inputs:='{"message": "Yo", "name": "planet Earth"}'
111+
```

0 commit comments

Comments
 (0)