Copy .env.example to .env and set the appropriate values.
-
Install python 3.12.3 (and activate if using pyenv or similar)
# visit https://github.com/pyenv/pyenv#getting-pyenv for more information brew install pyenv # see above... pyenv install 3.12.3 pyenv global 3.12.3
-
Install poetry
curl -sSL https://install.python-poetry.org | python - -
Add poetry to path and restart shell
# in ~/.bashrc, ~/.zshrc or equivalent export PATH="$HOME/.local/bin:$PATH"
-
Config poetry to use virtual envs in project (optional)
poetry config virtualenvs.in-project true -
Add dotenv plugin for poetry
poetry self add poetry-dotenv-plugin
-
Create virtual environment and install dependencies
poetry env use python poetry install
In one terminal:
poetry run serveIn another terminal:
curl -X POST "http://127.0.0.1:8080/answer" -H "Content-Type: application/json" -d '{"question": "What is the capital of France?"}'poetry run main