ctp-slack-bot / README.MD
LiKenun's picture
Add development run script and instructions
6532466
raw
history blame
1.9 kB
# CTP Slack Bot
## Tech Stack
* Hugging Face Spaces for hosting and serverless API
* Google Drive for reference data (i.e., the material to be incorporated into the bot’s knowledge base)
* MongoDB for data persistence
* Docker for containerization
* Python
* See `pyproject.toml` for Python packages.
## General Project Structure
* `src/`
* `ctp_slack_bot/`
* `api/`: FastAPI application structure
* `core/`: fundamental components like configuration (using pydantic), logging setup (loguru), and custom exceptions
* `db/`: database connection
* `repositories/`: repository pattern implementation
* `models/`: Pydantic models for data validation and serialization
* `services/`: business logic
* `tasks/`: background scheduled jobs
* `utils/`: reusable utilities
* `tests/`: unit tests
* `scripts/`: utility scripts for development, deployment, etc.
* `notebooks/`: Jupyter notebooks for exploration and model development
## How to Run the Application
### Normally
Just run the Docker image. 😉
### For Development
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.
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:
```sh
pip3 install -e .
```
If `localhost` port `8000` is free, running the following will make the application available on that port:
```sh
scripts/run-dev.sh
```
You can check that it’s reachable by visiting [http://localhost:8000/health](http://localhost:8000/health).
```text
$ curl http://localhost:8000/health
{"status":"healthy"}
```
Uvicorn will restart the application automatically when any source files are changed.