Skip to content

Commit

Permalink
Remove pybindings from stack (project-chip#34892)
Browse files Browse the repository at this point in the history
* remove pybindings sourcecode

* remove code that interacts with pybinding

* removing pybind11 submodule
  • Loading branch information
Alami-Amine authored and austina-csa committed Aug 12, 2024
1 parent f9f92b3 commit 2517027
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 606 deletions.
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ updates:
- dependency-name: "third_party/open-iot-sdk/repo"
- dependency-name: "third_party/ot-br-posix/repo"
- dependency-name: "third_party/perfetto/repo"
- dependency-name: "third_party/pybind11/repo"
- dependency-name: "third_party/qpg_sdk/repo"
- dependency-name: "third_party/silabs/repo"
- dependency-name: "third_party/simw-top-mini/repo"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ jobs:

- name: Setup Build, Run Build and Run Tests
run: |
scripts/build/gn_gen.sh --args="enable_rtti=true enable_pylib=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false"
scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false"
scripts/run_in_build_env.sh "ninja -C ./out"
scripts/tests/gn_tests.sh
- name: Setup test python environment
Expand Down Expand Up @@ -414,7 +414,6 @@ jobs:
# "host clang" build, which uses the pigweed
# clang.
"default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';;
"python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';;
esac
BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@
path = third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a
url = https://github.com/Infineon/recipe-make-cat1a
platforms = infineon
[submodule "third_party/pybind11/repo"]
path = third_party/pybind11/repo
url = https://github.com/pybind/pybind11
branch = stable
[submodule "p6/lwip"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip
url = https://github.com/lwip-tcpip/lwip.git
Expand Down
7 changes: 0 additions & 7 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
chip_enable_python_modules =
(current_os == "mac" || current_os == "linux") &&
(host_cpu == "x64" || host_cpu == "arm64" || host_cpu == "arm")
enable_pylib = false

# Build the Linux all clusters app example with default group
chip_build_all_clusters_app = false
Expand Down Expand Up @@ -112,9 +111,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
"${chip_root}/src/controller/python:chip-repl",
"${chip_root}/src/python_testing/matter_testing_infrastructure:metadata_parser.wheel",
]
if (enable_pylib) {
deps += [ "${chip_root}/src/pybindings/pycontroller" ]
}
}
}

Expand Down Expand Up @@ -214,9 +210,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
data_deps = [ "${chip_root}/examples/chip-tool" ]

if (chip_enable_python_modules) {
if (enable_pylib) {
data_deps += [ "${chip_root}/src/pybindings/pycontroller" ]
}
data_deps += [ "${chip_root}/src/controller/python:chip-repl" ]
}

Expand Down
23 changes: 4 additions & 19 deletions scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ OUTPUT_ROOT="$CHIP_ROOT/out/python_lib"

declare enable_ble=true
declare chip_detail_logging=false
declare enable_pybindings=false
declare chip_mdns
declare case_retry_delta
declare install_virtual_env
Expand All @@ -49,7 +48,7 @@ declare install_jupyterlab=no

help() {

echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ] [-enable_pybindings EnableValue]"
echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ]"

echo "General Options:
-h, --help Display this information.
Expand All @@ -59,8 +58,6 @@ Input Options:
By default it is false.
-m, --chip_mdns ChipMDNSValue Specify ChipMDNSValue as platform or minimal.
By default it is minimal.
-p, --enable_pybindings <true/false> Specify whether to enable pybindings as python controller.
-t --time_between_case_retries MRPActiveRetryInterval Specify MRPActiveRetryInterval value
Default is 300 ms
-i, --install_virtual_env <path> Create a virtual environment with the wheels installed
Expand Down Expand Up @@ -104,14 +101,6 @@ while (($#)); do
chip_mdns=$2
shift
;;
--enable_pybindings | -p)
enable_pybindings=$2
if [[ "$enable_pybindings" != "true" && "$enable_pybindings" != "false" ]]; then
echo "enable_pybindings should have a true/false value, not '$enable_pybindings'"
exit
fi
shift
;;
--time_between_case_retries | -t)
chip_case_retry_delta=$2
shift
Expand Down Expand Up @@ -157,7 +146,7 @@ while (($#)); do
done

# Print input values
echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\", enable_pybindings = $enable_pybindings, chip_case_retry_delta=\"$chip_case_retry_delta\", pregen_dir=\"$pregen_dir\", enable_ble=\"$enable_ble\""
echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\", chip_case_retry_delta=\"$chip_case_retry_delta\", pregen_dir=\"$pregen_dir\", enable_ble=\"$enable_ble\""

# Ensure we have a compilation environment
source "$CHIP_ROOT/scripts/activate.sh"
Expand All @@ -184,7 +173,7 @@ export SYSTEM_VERSION_COMPAT=0
# Make all possible human redable tracing available.
tracing_options="matter_log_json_payload_hex=true matter_log_json_payload_decode_full=true matter_enable_tracing_support=true"

gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble chip_crypto=\"boringssl\""
gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble chip_crypto=\"boringssl\""

function ninja_target() {
# Print the ninja target required to build a gn label.
Expand All @@ -206,11 +195,7 @@ function wheel_output_dir() {
ninja -C "$OUTPUT_ROOT" python_wheels

# Add wheels from chip_python_wheel_action templates.
if [ "$enable_pybindings" == true ]; then
WHEEL=("$OUTPUT_ROOT"/pybindings/pycontroller/pychip-*.whl)
else
WHEEL=("$OUTPUT_ROOT"/controller/python/chip*.whl)
fi
WHEEL=("$OUTPUT_ROOT"/controller/python/chip*.whl)

# Add the matter_testing_infrastructure wheel
WHEEL+=("$OUTPUT_ROOT"/python/obj/src/python_testing/matter_testing_infrastructure/metadata_parser._build_wheel/metadata_parser-*.whl)
Expand Down
25 changes: 5 additions & 20 deletions scripts/build_python_device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ OUTPUT_ROOT="$CHIP_ROOT/out/python_lib"
ENVIRONMENT_ROOT="$CHIP_ROOT/out/python_env"

declare chip_detail_logging=false
declare enable_pybindings=false
declare chip_mdns

help() {

echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ] [-enable_pybindings EnableValue]"
echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ]"

echo "General Options:
-h, --help Display this information.
Expand All @@ -53,7 +52,6 @@ Input Options:
By default it is false.
-m, --chip_mdns ChipMDNSValue Specify ChipMDNSValue as platform or minimal.
By default it is minimal.
-p, --enable_pybindings EnableValue Specify whether to enable pybindings as python controller.
"
}

Expand All @@ -73,10 +71,6 @@ while (($#)); do
chip_mdns=$2
shift
;;
--enable_pybindings | -p)
enable_pybindings=$2
shift
;;
-*)
help
echo "Unknown Option \"$1\""
Expand All @@ -87,7 +81,7 @@ while (($#)); do
done

# Print input values
echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\", enable_pybindings = $enable_pybindings"
echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\""

# Ensure we have a compilation environment
source "$CHIP_ROOT/scripts/activate.sh"
Expand All @@ -97,26 +91,17 @@ source "$CHIP_ROOT/scripts/activate.sh"

chip_data_model_arg="chip_data_model=\"///examples/lighting-app/lighting-common\""

gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings $chip_mdns_arg chip_controller=false $chip_data_model_arg"
gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_detail_logging $chip_mdns_arg chip_controller=false $chip_data_model_arg"

# Compiles python files
# Check pybindings was requested
if [ "$enable_pybindings" == true ]; then
ninja -v -C "$OUTPUT_ROOT" pycontroller
else
ninja -v -C "$OUTPUT_ROOT" chip-core
fi
ninja -v -C "$OUTPUT_ROOT" chip-core

# Create a virtual environment that has access to the built python tools
virtualenv --clear "$ENVIRONMENT_ROOT"

# Activate the new environment to register the python WHL

if [ "$enable_pybindings" == true ]; then
WHEEL=("$OUTPUT_ROOT"/pybindings/pycontroller/pychip-*.whl)
else
WHEEL=("$OUTPUT_ROOT"/controller/python/chip_core*.whl)
fi
WHEEL=("$OUTPUT_ROOT"/controller/python/chip_core*.whl)

source "$ENVIRONMENT_ROOT"/bin/activate
"$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade pip
Expand Down
1 change: 0 additions & 1 deletion scripts/tools/check_includes_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
'/java/',
'/Jni',
'/mock/',
'/pybindings/',
'/python/',
'/Test',
'/tests/',
Expand Down
175 changes: 0 additions & 175 deletions src/pybindings/pycontroller/BUILD.gn

This file was deleted.

Loading

0 comments on commit 2517027

Please sign in to comment.