mc-bench / mc-bench-backend

Other
2 stars 0 forks source link

Development

This is known to work with python 3.12.7

Pre-Requisites

  1. python installed. We recommend pyenv.
pyenv install 3.12.7
  1. A virtual environment created and activated somewhere

    via pyenv

    pyenv virtualenv 3.12.7 mc-bench-backend
    pyenv activate mc-bench-backend

    via vanilla venv

    pyenv shell 3.12.7
    python -m venv .venv
    source .venv/bin/activate

Any other mechanism should work as well

  1. editably install the project

    pip install -e .[dev,api,worker]

Run migrations

With the python virtual environment activated, run the database migrations

$ mc-bench-alembic upgrade head

Setup oauth2

You need to create a Github oauth app and save the client and secret in your local env file as:

GITHUB_CLIENT_ID GITHUB_CLIENT_SECRET

See frontend setup docs

Login and give yourself a role

Running the frontend and the backend, login and create a username.

Then use:

./bin/grant-user-role grant --username {your username} --role admin

To see the usernames use:


./bin/grant-user-role list-users

To see the roles use:


./bin/grant-user-role list-roles

Services run via docker

The following command will start all the services up

docker-compose up -d --build

See the docker-compose.yml file for what services are started up and which ports they are listening on

TODO: figure out hot reloading in the containers

Tail the logs

docker-compose logs -f

Formatting/Linting

Run the ruff formatter

make fmt

Run the ruff checker

make check

Run the ruff checker with --fix option

make check-fix