Setting up FastF1 for development¶
Creating a dedicated environment¶
You should set up a dedicated environment to decouple your FastF1 development from other Python and FastF1 installations on your system. Here we use python’s virtual environment venv, but you may also use others such as conda.
A new environment can be set up with
python -m venv <file folder location>
and activated with one of the following:
source <file folder location>/bin/activate # Linux/macOS
<file folder location>\Scripts\activate.bat # Windows cmd.exe
<file folder location>\Scripts\Activate.ps1 # Windows PowerShell
Whenever you plan to work on FastF1, remember to activate the development environment in your shell.
Retrieving the latest version of the code¶
FastF1 is hosted at https://github.com/theOehrly/Fast-F1.git.
git clone https://github.com/theOehrly/Fast-F1.git
This will place the sources in a directory Fast-F1
below your
current working directory.
If you have the proper privileges, you can use git@
instead of
https://
, which works through the ssh protocol and might be easier to use
if you are using 2-factor authentication.
Installing FastF1 in editable mode¶
Install FastF1 in editable mode from the Fast-F1
directory
using the command
python -m pip install -e .
The ‘editable/develop mode’, builds everything and places links in your Python environment so that Python will be able to import FastF1 from your development source directory. This allows you to import your modified version of FastF1 without re-installing after every change.
Installing additional dependencies for development¶
To install additional dependencies for development, testing and building of the
documentation, run the following command within the Fast-F1
directory:
python -m pip install -r requirements/dev.txt
Installing pre-commit hooks¶
It is recommended to install pre-commit hooks.
These will automatically check and partially fix code style issues (using the
ruff linter and isort) when you run git commit
. The hooks are defined in
the top level .pre-commit-config.yaml
file. To install the hooks
pip install pre-commit
pre-commit install