Configuration

riotfile.py

riot is configured using a single Python file called riotfile.py. This file is typically placed in the root directory of the project for ease of access.

A riotfile.py must define the following:

  • venv a Venv that declares how to build the virtual environments.

Note

By default, riot looks for riotfile.py in the current directory. It can also be named and located differently but then has to be specified with the --file option.

Venv

class riot.riot.Venv(pys: dataclasses.InitVar[typing.Union[float, int, str, typing.List[typing.Union[float, int, str]]]] = None, pkgs: dataclasses.InitVar[typing.Dict[str, typing.Union[str, typing.List[str]]]] = None, env: dataclasses.InitVar[typing.Dict[str, typing.Union[str, typing.List[str]]]] = None, name: typing.Optional[str] = None, command: typing.Optional[str] = None, venvs: typing.List[Venv] = <factory>, create: bool = False, skip_dev_install: bool = False)

Specifies how to build and run a virtual environment.

Venvs can be nested to benefit from inheriting from a parent Venv. All attributes are passed down to child Venvs. The child Venvs can override parent attributes with the semantics defined below.

Example:

Venv(
  pys=[3.9],
  venvs=[
      Venv(
          name="mypy",
          command="mypy",
          pkgs={
              "mypy": "==0.790",
          },
      ),
      Venv(
          name="test",
          pys=["3.7", "3.8", "3.9"],
          command="pytest",
          pkgs={
              "pytest": "==6.1.2",
          },
      ),
  ])
Parameters
  • name (str) – Name of the instance. Overrides parent value.

  • command (str) – Command to run in the virtual environment. Overrides parent value.

  • pys (List[float]) – Python versions. Overrides parent value.

  • pkgs (Dict[str, Union[str, List[str]]]) – Packages and version(s) to install into the virtual env. Merges and overrides parent values.

  • env (Dict[str, Union[str, List[str]]]) – Environment variables to define in the virtual env. Merges and overrides parent values.

  • venvs (List[Venv]) – List of Venvs that inherit the properties of this Venv (unless they are overridden).

  • create (bool) – Create the virtual environment instance. Defaults to False, in which case only a prefix is created.