Development environment
Prerequisites
- Python 3.12+
- Docker and Docker Compose
Packages installation
-
Create a Python virtual environment (recommended)
-
Install the dependencies with the following command:
pip install ".[api,playground,dev,test]"
Configuration
It is recommended to use a Python virtualenv.
- Create a config.yml file based on the example configuration file config.example.yml.
cp config.example.yml config.yml
- Create a env file based on the example environment file env.example
cp .env.example .env
- Comment host names variables like this (by default, they are set to
localhostin compose.example.yml):
# POSTGRES_HOST=postgres
- Check the configuration documentation to configure your configuration file.
Launch services
Start services locally with the following command:
make dev
tip
This command will start the API and the playground services and support the following options:
make dev [service=api|playground|both] [env=.env] [compose=compose.yml] # service=both by default
For more information, run make help.
To run the services without make command, you can use the following commands:
- Export the environment variables:
export $(grep -v '^#' .env | xargs)
- Launch the API:
uvicorn api.main:app --log-level debug --reload
The API will be available at http://localhost:8000.
- Launch the Playground:
cd playground
reflex run --env dev --loglevel debug
The playground will be available at http://localhost:8501.