From 1c449981f26d57bb904ad1c0b66feeee43ee90f5 Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Thu, 29 Aug 2024 15:29:33 +0200 Subject: [PATCH] py: Consolidate python requirements into `pyproject.toml` file --- iis-setup.sh | 10 ++++----- pyproject.toml | 47 +++++++++++++++++++++++++++++++++++++-- util/container/Dockerfile | 5 +---- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/iis-setup.sh b/iis-setup.sh index 902f103c9f..f21fc4aa47 100755 --- a/iis-setup.sh +++ b/iis-setup.sh @@ -15,16 +15,14 @@ export LLVM_BINROOT=/usr/pack/riscv-1.0-kgf/pulp-llvm-0.12.0/bin # Create Python virtual environment with required packages /usr/local/anaconda3-2022.05/bin/python3 -m venv .venv source .venv/bin/activate -# Unpack packages in a local temporary directory which can be safely cleaned -# after installation. Also protects against "No space left on device" errors +# Install local packages in editable mode and unpack packages in a +# local temporary directory which can be safely cleaned after installation. +# Also protects against "No space left on device" errors # occurring when the /tmp folder is filled by other processes. mkdir tmp -TMPDIR=tmp pip install -r python-requirements.txt +TMPDIR=tmp pip install -e . rm -rf tmp -# Install local packages in editable mode. -pip install -e . - # Install spike-dasm mkdir tools/ cd tools/ diff --git a/pyproject.toml b/pyproject.toml index 9e1fc95971..71d10ed382 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ # SPDX-License-Identifier: SHL-0.51 [build-system] -requires = ["setuptools>=42"] +requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" [project] @@ -12,8 +12,51 @@ authors = [ {name = "Luca Colagrande", email = "colluca@iis.ee.ethz.ch"} ] dynamic = ["version"] +dependencies = [ + # Keep sorted. + # General dependencies. + "bin2coe", + "dataclasses", + "editorconfig-checker==2.3.51", + "flake8", + "gitpython", + "hjson", + "humanize", + "json5", + "jsonref", + "jsonschema", + "mako", + "matplotlib", + "mkdocs-material", + "pandas", + "prettytable", + "progressbar2", + "psutil", + "pyelftools", + "pyflexfloat", + "pytablewriter", + "pytest", + "pyyaml", + "tabulate", + "termcolor", + "yamllint", + # DNN lib dependencies. + "numpy", + "torch", + "json5" +] + +[project.optional-dependencies] +docs = [ + "mkdocs", + "mkdocs-material", + "mkdocs-include-markdown-plugin", + "mkdocs-macros-plugin", + "mkdocstrings", + "mkdocstrings-python", +] [tool.setuptools.package-dir] "snitch.dnn" = "sw/dnn" "snitch.blas" = "sw/blas" -"snitch.util" = "util" \ No newline at end of file +"snitch.util" = "util" diff --git a/util/container/Dockerfile b/util/container/Dockerfile index bfef212662..2ae3e89b05 100644 --- a/util/container/Dockerfile +++ b/util/container/Dockerfile @@ -162,10 +162,7 @@ ENV VIRTUAL_ENV "/root/.venvs/snitch_cluster" RUN /opt/python/bin/python3 -m venv ${VIRTUAL_ENV} ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" # Install Python requirements -COPY python-requirements.txt /tmp/python-requirements.txt -COPY docs/requirements.txt /tmp/docs/requirements.txt -COPY sw/dnn/requirements.txt /tmp/sw/dnn/requirements.txt -RUN pip install -r /tmp/python-requirements.txt +RUN pip install .[docs] # Add Verilator to PATH ENV PATH "/tools/verilator/bin:${PATH}"