Development¶
Installation¶
Install this project with uv
Set-up¶
Prepare a .env suitable for development, similar to:
# prefect variables
PREFECT_API_URL=http://127.0.0.1:4200/api
PREFECT_RESULTS_PERSIST_BY_DEFAULT=true
PREFECT_SERVER_ANALYTICS_ENABLED=false
DO_NOT_TRACK=1
# pygeoapi variables
PYGEOAPI_CONFIG=example-config.yml
PYGEOAPI_OPENAPI=example-openapi.yml
Warning
We recommend naming the env file pygeoapi-prefect.env and sourcing it like this:
All following examples assume the env file has already been sourced.
Start the prefect server:
The prefect UI shall now be available at http://localhost:4200
If you want to deploy a pygeoapi process locally with prefect, then also start a prefect worker. Here we specify a
worker of type process (i.e. flow runs execute locally, by spawning aditional Python processes) which consumes from
a pool named pygeoapi:
Now stand up pygeoapi
Deploy the hi-prefect-world process:
- Run a deployed process with prefect
Operations¶
-
List available process ids
-
Retrieve details about a process (for example the process with id
hello-world): -
Execute the pygeoapi
hello-worldprocess, via prefect. In this example we pass a JSON object with the inputs that the process needs:http localhost:5000/processes/hello-world/execution \ inputs:='{"message": "Yo", "name": "planet Earth"}'Prefect records flow run executions - you can check them in the Prefect UI, under
runs -
Execute our
hi-prefect-worldprocess: