From 105200861733cc9af9b1ed79aee4ac1efce4fee0 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 26 May 2023 11:06:48 +0200 Subject: [PATCH] [python] Remove dependency only used in testing (#26727) * [python] Remove dependency only used in testing PR #21567 added mobly as a default dependency of the Python Core CHIP library. The mobly package is only used by the Python testing framework in `src/python_testing/`. Allow to install extra dependency via `script/build_python.sh` flag and install them only when needed. * [python] remove now unnecessary dependency mobly * Apply restyle changes --- .github/workflows/tests.yaml | 2 +- scripts/build_python.sh | 9 +++++++++ src/controller/python/BUILD.gn | 2 -- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 70c0fb95d59bde..f7aaebd49b64e9 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -487,7 +487,7 @@ jobs: - name: Build Python REPL and example apps timeout-minutes: 50 run: | - scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' + scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env --extra_packages "mobly"' ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \ diff --git a/scripts/build_python.sh b/scripts/build_python.sh index 1af80368cdccf7..3e360ddbca8089 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -63,6 +63,7 @@ Input Options: no: Do not install build-env: install to virtual env for build matter separate: install to another virtual env (out/python_env) + --extra_packages PACKAGES Install extra Python packages from PyPI --include_yamltests Whether to install the matter_yamltests wheel. -z --pregen_dir DIRECTORY Directory where generated zap files have been pre-generated. " @@ -96,6 +97,10 @@ while (($#)); do install_wheel=$2 shift ;; + --extra_packages) + extra_packages=$2 + shift + ;; --include_yamltests) include_yamltests="yes" ;; @@ -160,6 +165,10 @@ if [ -n "$include_yamltests" ]; then ) fi +if [ -n "$extra_packages" ]; then + WHEEL+=("$extra_packages") +fi + if [ "$install_wheel" = "no" ]; then exit 0 elif [ "$install_wheel" = "separate" ]; then diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 102e9f3f654ace..07f288830a3f7d 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -306,7 +306,6 @@ chip_python_wheel_action("chip-core") { "pyyaml", "ipdb", "deprecation", - "mobly", "cryptography", "ecdsa", ] @@ -428,7 +427,6 @@ chip_python_wheel_action("chip-repl") { "ipython!=8.1.0", "rich", "ipykernel", - "mobly", ] if (current_os == "mac") {