Skip to content

Commit

Permalink
py: Consolidate python requirements into pyproject.toml file
Browse files Browse the repository at this point in the history
  • Loading branch information
fischeti committed Aug 29, 2024
1 parent 3a2d92e commit 1c44998
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 deletions.
10 changes: 4 additions & 6 deletions iis-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
47 changes: 45 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: SHL-0.51

[build-system]
requires = ["setuptools>=42"]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -12,8 +12,51 @@ authors = [
{name = "Luca Colagrande", email = "[email protected]"}
]
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"
"snitch.util" = "util"
5 changes: 1 addition & 4 deletions util/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 1c44998

Please sign in to comment.