- Fork this repository into a new PRIVATE repository in your own GitHub account.
- A postgres DB is recommended
- Run the app
- Stop when the database migrations have successfully run and you can view the / html page.
Template repo for technical assessments in Python, scenario 1.
- Option 1. This project has a devcontainer configuration
- Option 2. Or the .devcontainer/docker-compose.yml can be run directly
- Option 3. Open in codespaces https://codespaces.new/nearai/assessment-technical-py-scenario1
- Option 4. Run it step by step as detailed below.
- Feel free to reach out if you run into any problems.
-
You will need to run Postgres locally or with .devcontainer/docker-compose.yml
-
Set up a virtual environment and Install dependencies:
uv sync
source ./.venv/bin/activate
- Set up environment variables in a
.env
file:
DB_USER=postgres
DB_HOST=localhost
DB_NAME=agent_discovery
DB_PASSWORD=postgres
DB_PORT=5432
The scripts .devcontainer/init-db.sh
and .devcontainer/run-migrations.sh
This project uses Alembic for database migrations. To run the migrations:
-
Make sure your database is running and the environment variables are set correctly in your
.env
file. -
Make sure you have an
agent_discovery
database created in your Postgres instance. -
Run the migrations:
alembic upgrade head
This will create the necessary tables and seed the initial data.
This script will:
- Run the Alembic migrations
- Test the database connection
- Verify that the tables exist
- Check that the data was seeded correctly
Start the FastAPI server:
python run.py
The server will start on http://localhost:8000
You can also access the interactive API documentation at http://localhost:8000/docs