Developing and Documenting Locust

You want to contribute to Locust? Great! Here is a list of open bugs/feature requests.

Install Locust for development

Fork Locust on GitHub and then run

$ git clone git://<YourName>/locust.git # clone the repo
$ pip3 install -e locust/                          # install in editable mode

Now the locust command will run your code with no need for reinstalling after making changes.

To contribute your changes, push to a branch in your repo and then open a PR on github.

If you install pre-commit, linting and format checks/fixes will be automatically performed before each commit.

Before you open a pull request, make sure all the tests work. And if you are adding a feature, make sure it is documented (in docs/*.rst).

Testing your changes

We use tox to automate tests across multiple Python versions:

$ pip3 install tox
$ tox
py39: install_deps> python -I -m pip install cryptography mock pyquery retry
py39: commands[0]> python3 -m pip install .
py39: commands[1]> python3 -m unittest discover

To only run a specific suite or specific test you can call pytest directly:

$ pytest locust/test/

Formatting and linting

Locust uses ruff for formatting and linting. The build will fail if code does not adhere to it. If you run vscode it will automatically run every time you save a file, but if your editor doesn’t support it you can run it manually:

$ pip3 install ruff
$ python -m ruff --fix <file_or_folder_to_be_formatted>
$ python -m ruff format <file_or_folder_to_be_formatted>

You can validate the whole project using tox:

$ tox -e ruff
ruff: install_deps> python -I -m pip install ruff==0.1.13
ruff: commands[0]> ruff check .
ruff: commands[1]> ruff format --check
104 files already formatted
  ruff: OK (1.41=setup[1.39]+cmd[0.01,0.01] seconds)
  congratulations :) (1.47 seconds)

Build documentation

The documentation source is in the docs/ directory. To build the documentation you’ll need to Install Locust for development then

  1. Install the documentation requirements:

    $ pip3 install -r docs/requirements.txt
  2. Build the documentation locally:

    $ make build_docs

View your generated documentation by opening docs/_build/index.html.

Making changes to Locust’s Web UI

The Web UI is built using React and Typescript



Install node using nvm to easily switch between node version

  • Copy and run the install line from nvm (starts with curl/wget …)

  • Verify nvm was installed correctly

$ nvm --version
  • Install the proper Node version according to engines in the locust/webui/package.json

$ nvm install {version}
$ nvm alias default {version}


  • Install Yarn from their official website (avoid installing through Node if possible)

  • Verify yarn was installed correctly

$ yarn --version
  • Next in web, install all dependencies

$ cd locust/webui
$ yarn


To develop the frontend, run yarn dev. This will start the Vite dev server and allow for viewing and editing the frontend, without needing to a run a locust web server

To develop while running a locust instance, run yarn dev:watch. This will output the static files to the dist directory. Vite will automatically detect any changed files and re-build as needed. Simply refresh the page to view the changes

To compile the webui, run yarn build

The frontend can additionally be built using make:

$ make frontend_build


Run yarn lint to detect lint failures in the frontend project. Running yarn lint --fix will resolve any issues that are automatically resolvable. Your IDE can additionally be configured with ESLint to resolve these issues on save.


Run yarn format to fix any formatting issues in the frontend project. Once again your IDE can be configured to automatically format on save.


We use Typescript in the frontend project. Run yarn type-check to find any issues.