Spaces:
Runtime error
Runtime error
Add development run script and instructions
Browse files- README.MD +38 -7
- scripts/run-dev.sh +5 -0
- setup.py +0 -0
- src/ctp_slack_bot/api/main.py +2 -2
README.MD
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
# CTP Slack Bot
|
2 |
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
*
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
* Docker
|
11 |
|
12 |
## General Project Structure
|
13 |
|
@@ -24,3 +24,34 @@
|
|
24 |
* `tests/`: unit tests
|
25 |
* `scripts/`: utility scripts for development, deployment, etc.
|
26 |
* `notebooks/`: Jupyter notebooks for exploration and model development
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# CTP Slack Bot
|
2 |
|
3 |
+
## Tech Stack
|
4 |
|
5 |
+
* Hugging Face Spaces for hosting and serverless API
|
6 |
+
* Google Drive for reference data (i.e., the material to be incorporated into the bot’s knowledge base)
|
7 |
+
* MongoDB for data persistence
|
8 |
+
* Docker for containerization
|
9 |
+
* Python
|
10 |
+
* See `pyproject.toml` for Python packages.
|
|
|
11 |
|
12 |
## General Project Structure
|
13 |
|
|
|
24 |
* `tests/`: unit tests
|
25 |
* `scripts/`: utility scripts for development, deployment, etc.
|
26 |
* `notebooks/`: Jupyter notebooks for exploration and model development
|
27 |
+
|
28 |
+
## How to Run the Application
|
29 |
+
|
30 |
+
### Normally
|
31 |
+
|
32 |
+
Just run the Docker image. 😉
|
33 |
+
|
34 |
+
### For Development
|
35 |
+
|
36 |
+
Development usually requires rapid iteration. That means a change in the code ought to be reflected as soon as possible in the behavior of the application.
|
37 |
+
|
38 |
+
First, make sure you are set up with a Python virtual environment created by the Python `venv` module and that it’s activated. Then install dependencies from `pyproject.toml` within the environment using:
|
39 |
+
|
40 |
+
```sh
|
41 |
+
pip3 install -e .
|
42 |
+
```
|
43 |
+
|
44 |
+
If `localhost` port `8000` is free, running the following will make the application available on that port:
|
45 |
+
|
46 |
+
```sh
|
47 |
+
scripts/run-dev.sh
|
48 |
+
```
|
49 |
+
|
50 |
+
You can check that it’s reachable by visiting [http://localhost:8000/health](http://localhost:8000/health).
|
51 |
+
|
52 |
+
```text
|
53 |
+
$ curl http://localhost:8000/health
|
54 |
+
{"status":"healthy"}
|
55 |
+
```
|
56 |
+
|
57 |
+
Uvicorn will restart the application automatically when any source files are changed.
|
scripts/run-dev.sh
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
parent_path=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P)
|
4 |
+
|
5 |
+
python3 "${parent_path}/../src/ctp_slack_bot/api/main.py"
|
setup.py
DELETED
File without changes
|
src/ctp_slack_bot/api/main.py
CHANGED
@@ -55,6 +55,6 @@ if __name__ == "__main__":
|
|
55 |
uvicorn.run(
|
56 |
"main:app",
|
57 |
host="localhost", #settings.API_HOST,
|
58 |
-
port=
|
59 |
-
|
60 |
)
|
|
|
55 |
uvicorn.run(
|
56 |
"main:app",
|
57 |
host="localhost", #settings.API_HOST,
|
58 |
+
port=8000, #settings.API_PORT,
|
59 |
+
reload=True #settings.DEBUG,
|
60 |
)
|