You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-3Lines changed: 35 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,25 @@ The authenticated users can:
18
18
Behind the scenes, the API communicates with the [worker-facing API](https://github.com/ries-lab/DECODE_Cloud_WorkerAPI) of DECODE OpenCloud.
19
19
When a user starts a job, it sends it to the [worker-facing API](https://github.com/ries-lab/DECODE_Cloud_WorkerAPI) and gets job updates from it.
20
20
21
-
## Run
21
+
## Development guide
22
+
23
+
### Prepare the development environment
24
+
We use [poetry](https://python-poetry.org/) for dependency tracking.
25
+
See online guides on how to use it, but this setup should work:
26
+
-`conda create -n "3-11-10" python=3.11.10`
27
+
-`conda activate 3-11-10`
28
+
-`pip install pipx`
29
+
-`pipx install poetry`
30
+
-`poetry env use /path/to/conda/env/bin/python`
31
+
-`poetry install`
32
+
Afterwards, when you need a new package, use `poetry add [--group dev] <package>` to add new dependencies.
33
+
The `--group dev` option adds the dependency only for development (e.g., pre-commit hooks, pytest, ...).
34
+
35
+
Install the pre-commit hooks: `pre-commit install`.
36
+
These currently include ruff and mypy.
37
+
38
+
### Run locally
39
+
22
40
#### Define the environment variables
23
41
Copy the `.env.example` file to a `.env` file at the root of the directory and define its fields appropriately:
24
42
- Deployment settings:
@@ -46,13 +64,27 @@ Copy the `.env.example` file to a `.env` file at the root of the directory and d
46
64
-`EMAIL_SENDER_SECRET_KEY`: API key secret to use the email sender. Can also be the ARN of an AWS SecretsManager secret.
47
65
48
66
#### Start the user-facing API
49
-
`uvicorn api.main:app --reload --port 8000`
67
+
`poetry run serve`
50
68
51
69
#### View the API documentation
52
70
You can find it at `<API_URL>/docs` (if running locally, `<API_URL>=localhost:8000`).
53
71
72
+
#### Docker
73
+
Alternatively, you can build a Docker image.
74
+
For this, run `poetry run docker-build`:
75
+
This will create a Docker image named `api:<branch_name>`.
76
+
To run the Docker container, use `poetry run docker-serve`.
77
+
To stop and delete all containers for this package, use `poetry run docker-stop`.
78
+
If you want to additionally remove all images for this package and prune dangling images, run `poetry run docker-cleanup`.
79
+
80
+
### Tests
81
+
Run them with `poetry run pytest`.
82
+
83
+
Note that tests marked with `aws` are skipped by default, to avoid the need for an AWS setup.
84
+
They are however ran in the GitHub Action.
85
+
For this to work, they must have been ran once locally with an account with sufficient permissions (`poetry run pytest -m "aws"`), since for security reasons, the AWS account used on GitHub does not have permissions to create RDS instances.
54
86
55
-
## Add/modify runnable applications
87
+
###Add/modify runnable applications
56
88
#### Dockerize the application
57
89
See for example [DECODE](https://github.com/ries-lab/DECODE_Internal/blob/dockerfile_stable/Dockerfile) and [Comet](https://github.com/nolan1999/Comet/blob/docker/Python_interface/Dockerfile).
0 commit comments