We use PDM as a package and dependency manager. You can set up a local Python environment for development as follows:
- Install package and dependency manager PDM following the instructions here.
- Install system dependencies
- For MacOS:
brew install Cmake - For Linux (Debian):
sudo apt-get install build-essential cmake
- For MacOS:
- Run
PDM_PYTHON=$(pyenv which python) && pdm install -G all -G devto install the Python dependencies. This will create a virtual environment ineva/.venv. If you don't usepyenvto manage your python installations, you can replace$(pyenv which python)with the path to your python executable. Note that the python version used should matchPYTHON_VERSIONSinnoxfile.py, as this is the version is used for running the unit tests.
Add a new dependency to the core submodule:
pdm add <package_name>
Add a new dependency to the vision submodule:
pdm add -G vision -G all <package_name>
For more information about managing dependencies please look here.
To update all dependencies in the lock file:
pdm update
To update the dependencies in a specific group
pdm update -G <group_name>
To update a specific dependency in a specified group
pdm update -G <group_name> <package_name>
If you want to regenerate the lock file from scratch:
pdm lock -G all -G vision -G lint -G typecheck -G test -G dev -G docs
For testing automation, we use nox.
Installation:
- with brew:
brew install nox - with pip:
pip install --user --upgrade nox(this way, you might need to run nox commands withpython -m noxor specify an alias)
Commands:
noxto run all the automation tests.nox -s fmtto run the code formatting tests.nox -s lintto run the code lining tests.nox -s checkto run the type-annotation tests.nox -s testto run the unit tests.nox -s test -- tests/eva/metrics/test_average_loss.pyto run specific tests