Skip to content

Commit d6ea481

Browse files
committed
Python wheels: Create one wheel to rule them all
We are working towards launching a python support module on PyPI to support local testing for developers who do not work day-to-day on the SDK and would prefer to just pip install a package. This package contains a single wheel that encompases the following individual wheel files from the SDK - matter-core - matter-clusters - matter-repl - matter-idl - matter-yamltest - matter-testing matter-jupiter will be added in a subsequent PR. The three core matter wheel files are currently being compiled by a secondary script. I opted to keep this in place for this PR to avoid complicating changes, but we should be able to remove the duplication in a follow up and compile the -core, -clusters and -repl wheel files through pigweed for simpliciy. This PR aims just to match the current python environment setup and therefore still requires that the test scripts themselves be provided. This is another follow up, as is integration of the mdns into the testing framework and inclusion of the support files like the certificates. A CI test will be added to this PR in a subsequent commit. Follow up summary for this PR: - CI to 1) create raw venv 2) install from combined wheel 3) run at least one tests (that uses data_model) Follow up summary: - CI job to manual push to test PyPI - add jupiter - change -core -clusters -repl to use pw build files - add mdns files to matter-testing - add an additional wheel to bundle the tests and the certs - examine swapping the CI over to pip install
1 parent e5e17f6 commit d6ea481

File tree

8 files changed

+292
-138
lines changed

8 files changed

+292
-138
lines changed

BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
132132
deps = [
133133
"${chip_root}/scripts:matter_yamltests_distribution.wheel",
134134
"${chip_root}/scripts/py_matter_yamltests:matter-yamltests.wheel",
135+
"${chip_root}/src/controller/python:matter-core-module.wheel",
135136
"${chip_root}/src/controller/python:matter-repl",
136137
"${chip_root}/src/python_testing/matter_testing_infrastructure:matter-testing.wheel",
137138
"${chip_root}/src/python_testing/post_certification_tests:matter-post-certification-tests.wheel",

build/chip/python_wheel.gni

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import("$dir_pw_build/python.gni")
1919
import("${chip_root}/src/system/system.gni")
2020

2121
declare_args() {
22-
chip_python_version = "1.0.0"
22+
chip_python_version = "1.5.0"
2323
chip_python_package_prefix = "matter"
2424
chip_python_supports_stack_locking = chip_system_config_locking != "none"
2525
}

scripts/BUILD.gn

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import("//build_overrides/chip.gni")
1818
import("//build_overrides/pigweed.gni")
1919
import("$dir_pw_build/python_dist.gni")
2020

21+
import("${chip_root}/src/controller/flags.gni")
22+
2123
# This target creates a single Python package and wheel for yamltests. It will
2224
# merge all Python dependencies Matter. The output is located in:
2325
# out/obj/scripts/matter_yamltests_distribution/ <- source files here
@@ -31,3 +33,61 @@ pw_python_distribution("matter_yamltests_distribution") {
3133
append_date_to_version = true
3234
}
3335
}
36+
37+
pw_python_distribution("matter_iot") {
38+
packages = [
39+
"${chip_root}/scripts/py_matter_yamltests:matter-yamltests",
40+
"${chip_root}/scripts/py_matter_idl:matter-idl",
41+
"${chip_root}/src/python_testing/matter_testing_infrastructure:matter-testing-module",
42+
"${chip_root}/src/controller/python:matter-core-module",
43+
"${chip_root}/src/controller/python:matter-clusters-module",
44+
"${chip_root}/src/controller/python:matter-repl-module",
45+
]
46+
47+
generate_setup_cfg = {
48+
name = "matter_iot"
49+
version = "1.5.0.dev1"
50+
include_default_pyproject_file = true
51+
include_extra_files_in_package_data = true
52+
metadata = {
53+
description = "Matter IoT python development controller and test package"
54+
url = "https://github.com/project-chip/connectedhomeip"
55+
classifiers = [
56+
"Intended Audience :: Developers",
57+
"License :: OSI Approved :: Apache Software License",
58+
"Programming Language :: Python :: 3",
59+
]
60+
}
61+
}
62+
63+
if (chip_support_commissioning_in_controller) {
64+
lib_name = "_ChipDeviceCtrl.so"
65+
} else {
66+
lib_name = "_ChipServer.so"
67+
}
68+
69+
public_deps = [ "${chip_root}/src/controller/python:ChipDeviceCtrl" ]
70+
public_deps += [
71+
"${chip_root}/src/python_testing/matter_testing_infrastructure:data_model_zip_1_2",
72+
"${chip_root}/src/python_testing/matter_testing_infrastructure:data_model_zip_1_3",
73+
"${chip_root}/src/python_testing/matter_testing_infrastructure:data_model_zip_1_4",
74+
"${chip_root}/src/python_testing/matter_testing_infrastructure:data_model_zip_1_4_1",
75+
"${chip_root}/src/python_testing/matter_testing_infrastructure:data_model_zip_1_4_2",
76+
"${chip_root}/src/python_testing/matter_testing_infrastructure:data_model_zip_1_5",
77+
]
78+
79+
extra_files = [
80+
"${root_out_dir}/data_model/zip_1_2.zip > matter/testing/data_model/1.2/allfiles.zip",
81+
"${root_out_dir}/data_model/zip_1_3.zip > matter/testing/data_model/1.3/allfiles.zip",
82+
"${root_out_dir}/data_model/zip_1_4.zip > matter/testing/data_model/1.4/allfiles.zip",
83+
"${root_out_dir}/data_model/zip_1_4_1.zip > matter/testing/data_model/1.4.1/allfiles.zip",
84+
"${root_out_dir}/data_model/zip_1_4_2.zip > matter/testing/data_model/1.4.2/allfiles.zip",
85+
"${root_out_dir}/data_model/zip_1_5.zip > matter/testing/data_model/1.5/allfiles.zip",
86+
"${root_out_dir}/obj/src/controller/python/matter/${lib_name} > matter/${lib_name}",
87+
]
88+
}
89+
90+
pw_python_wheels("python_wheel_dist") {
91+
packages = [ ":matter_iot" ]
92+
directory = "$root_out_dir/dist"
93+
}

scripts/build_python.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ fi
327327

328328
# Compile Python wheels
329329
ninja -C "$output_root" python_wheels
330+
ninja -C "$output_root" python_wheel_dist
330331

331332
# Add wheels from matter_python_wheel_action templates.
332333
WHEEL=("$output_root"/controller/python/matter*.whl)

0 commit comments

Comments
 (0)