This project supports Python 3.9, 3.10, and 3.11. Ensure you have one of these versions installed on your system before proceeding.
Using a virtual environment is recommended to isolate project dependencies and avoid conflicts with other Python projects.
python -m venv .venv
source .venv/bin/activate
python -m venv .venv
.venv\Scripts\activate
Before installing the project dependencies, ensure that pip
is up to date:
pip install --upgrade pip
Install the required dependencies from the requirements.txt
file:
pip install -r requirements.txt
-
macOS (darwin):
pip install -r requirements-gpu.txt
-
Windows with CUDA Support: If you are using GPU acceleration on Windows, you'll need to specify the appropriate CUDA version. For example, for CUDA 12.4:
pip install --extra-index-url https://download.pytorch.org/whl/cu124 -r requirements-gpu.txt
Adjust the CUDA version (
cu124
) in the URL as necessary for your setup.
The project uses Astral UV for advanced dependency management, including custom indices and conditional dependencies.
Astral UV can be installed using pip:
pip install uv
Use the uv
CLI to install dependencies as per the configurations in pyproject.toml
:
uv install
This will resolve dependencies, including those with custom indices or conditional markers.
This project uses a pyproject.toml
file for dependency and build configuration. To interact with this framework, you can use tools such as pip
, poetry
, or Astral UV:
If not already done, dependencies listed in pyproject.toml
can be installed with:
pip install .
If you prefer using poetry
for dependency management and builds:
-
Install Poetry:
pip install poetry
-
Install dependencies:
poetry install
-
Activate the Poetry shell (optional):
poetry shell
- The project uses the
astral-uv
library for dependency management. Ensure it is properly installed as part of the dependencies. - For advanced builds or custom configurations, refer to the comments in
pyproject.toml
and the respective tool documentation.
To verify that everything is set up correctly:
-
Activate the virtual environment:
source .venv/bin/activate # or .venv\Scripts\activate on Windows
-
Run the project's test suite or a basic command to confirm:
python -m unittest discover
or
python run.py
You should now be ready to develop and run the project
uv lock --upgrade
uv export --no-hashes > .\requirements.txt
uv export --no-hashes --extra cuda_gpu > .\requirements-gpu.txt
On windows, make sure the output is in utf-8, not utf-16 is it would be by default:
uv export --no-hashes | Out-File -FilePath .\requirements.txt -Encoding utf8
uv export --no-hashes --extra cuda_gpu | Out-File -FilePath .\requirements-gpu.txt -Encoding utf8
You can add --no-dev
to uv export
to ignore the dev dependencies.
# pip install ruff
ruff check verbatim tests # try `ruff check --fix verbatim tests`if you see some failures
# pip install pylint
pylint verbatim $(git ls-files 'tests/*.py')
# pip install flake8
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics verbatim tests
flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics verbatim tests
# pip install bandit
bandit -r verbatim tests