Skip to content

Commit

Permalink
python: handle dependencies in bazel
Browse files Browse the repository at this point in the history
Signed-off-by: Øyvind Harboe <[email protected]>
  • Loading branch information
oharboe committed Dec 20, 2024
1 parent 61c7ac3 commit 4fd3448
Show file tree
Hide file tree
Showing 6 changed files with 1,502 additions and 3 deletions.
17 changes: 17 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@pip//:requirements.bzl", "requirement")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("//:eqy.bzl", "eqy_test")
load("//:openroad.bzl", "get_stage_args", "orfs_floorplan", "orfs_flow", "orfs_run")
load("//:sweep.bzl", "orfs_sweep")
Expand Down Expand Up @@ -350,3 +352,18 @@ orfs_run(
},
script = ":units.tcl",
)

compile_pip_requirements(
name = "requirements",
src = "requirements.in",
requirements_txt = "requirements_lock.txt",
)

py_binary(
name = "plot_repair",
main = "plot-retiming.py",
srcs = [
"plot-retiming.py",
],
deps = [requirement("matplotlib")]
)
16 changes: 16 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,19 @@ load_json_file(
out = "variables.json",
script = "//:yaml_to_json.py",
)

bazel_dep(name = "rules_python", version = "0.31.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
ignore_root_user_error = True,
python_version = "3.12",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.12",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")
1,038 changes: 1,037 additions & 1 deletion MODULE.bazel.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
matplotlib==3.6.3
Loading

0 comments on commit 4fd3448

Please sign in to comment.