Skip to content

Commit

Permalink
Use venv for Python dependencies (macOS)
Browse files Browse the repository at this point in the history
Create a series of scripts to set up and manage a Python virtual
environment that can be used to build (and test) Drake. Remove Python
packages from macOS setup. Add dependencies to the virtual environment
as needed.
  • Loading branch information
mwoehlke-kitware committed Aug 26, 2024
1 parent c1cabbb commit 09aa7e0
Show file tree
Hide file tree
Showing 27 changed files with 1,000 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@

# User-specified configuration
/user.bazelrc
/requirements.txt
2 changes: 2 additions & 0 deletions bindings/pydrake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ drake_py_library(
],
deps = [
"//bindings/pydrake/common:_init_py",
"@venv",
],
)

Expand Down Expand Up @@ -399,6 +400,7 @@ drake_py_binary(
":all_py",
"@mypy_internal//:mypy",
"@stable_baselines3_internal//:stable_baselines3",
"@venv",
],
)

Expand Down
1 change: 1 addition & 0 deletions common/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ drake_py_library(
imports = ["."],
deps = [
"//lcmtypes:lcmtypes_drake_py",
"@venv",
],
)

Expand Down
1 change: 1 addition & 0 deletions doc/doxygen_cxx/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package(default_visibility = ["//visibility:private"])
drake_py_library(
name = "system_doxygen",
srcs = ["system_doxygen.py"],
deps = ["@venv"],
visibility = [
"//doc/pydrake:__pkg__",
"//tools/workspace/pybind11:__pkg__",
Expand Down
1 change: 1 addition & 0 deletions examples/hardware_sim/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ drake_py_library(
srcs = ["test/hardware_sim_test_common.py"],
deps = [
"@rules_python//python/runfiles",
"@venv",
],
)

Expand Down
26 changes: 26 additions & 0 deletions requirements-base.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# PyPI packages to make available as Drake's bazel `@venv` repository.

# WARNING: If you change this file, then it is up to you to regenerate
# the "locked" requirements.txt file via:
#
# tools/workspace/venv/upgrade

# Packages that we are happy to take the most recent version any time we
# update requirements. The versions of these packages are "locked" in the
# requirements.txt file and change any time it updates. This should be
# the overwhelming majority of our requirements.

ipython
ipywidgets
matplotlib
notebook
numpy < 2.1
Pillow
pydot
PyYAML

# The following are constrained or pinned version of packages.

# Keep `black` and `isort` fixed until we want to explicitly update.
black == 22.10.0
isort == 5.1.3
18 changes: 18 additions & 0 deletions requirements-test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# PyPI packages to make available as Drake's bazel `@venv` repository.

# WARNING: If you change this file, then it is up to you to regenerate
# the "locked" requirements.txt file via:
#
# tools/workspace/venv/upgrade

# Packages that we are happy to take the most recent version any time we
# update requirements. The versions of these packages are "locked" in the
# requirements.txt file and change any time it updates. This should be
# the overwhelming majority of our requirements.

flask
six
u-msgpack-python
websockets

# The following are constrained or pinned version of packages.
Loading

0 comments on commit 09aa7e0

Please sign in to comment.