From 6435e9d4147a6d82ac99562a89df07b853f3521b Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Fri, 20 Feb 2026 10:13:29 -0500 Subject: [PATCH 1/6] chore(client): add client pyproject.toml --- client/pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 client/pyproject.toml diff --git a/client/pyproject.toml b/client/pyproject.toml new file mode 100644 index 000000000..493e1f974 --- /dev/null +++ b/client/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = ["maturin>=1.9,<2.0"] +build-backend = "maturin" + +[tool.maturin] +features = ["pybindings"] From cfb1939f5f8ed3e23a2c420c8f7b7f845ee0ab45 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Fri, 20 Feb 2026 10:29:21 -0500 Subject: [PATCH 2/6] chore(client): update gitignore --- client/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/.gitignore b/client/.gitignore index f3d5d011e..8b4aad15e 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -5,3 +5,7 @@ __pycache__/ *.profraw *.profdata coverage* +.tox/ +.ruff_cache/ +.mypy_cache/ +.venv/ From 4d2253c30b259cd846a5b351589396288ecd3bc1 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Fri, 20 Feb 2026 10:29:47 -0500 Subject: [PATCH 3/6] chore(client): update tox.ini --- client/tox.ini | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/client/tox.ini b/client/tox.ini index 3dd94fe61..e201b693a 100644 --- a/client/tox.ini +++ b/client/tox.ini @@ -1,17 +1,25 @@ [tox] -envlist = py -skipsdist = true +env_list = format, lint, unit +[testenv:format] +description = Apply coding standards to code +deps = + ruff +commands = + ruff check --fix + ruff format -[testenv] +[testenv:lint] +description = Check code against coding stle standards deps = - black ruff +commands = + ruff check + ruff format --check + +[testenv:unit] +description = Run unit tests +deps = pytest - maturin -commands_pre = - {envbindir}/maturin develop --features pybindings commands = - {envbindir}/python -m black --check pytests/ - {envbindir}/python -m ruff check pytests/ - {envbindir}/python -m pytest pytests/ + pytest pytests From a0716f872183e7e5a0fd34373f0b7c22d49e466d Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Fri, 20 Feb 2026 10:34:41 -0500 Subject: [PATCH 4/6] ci: install client pybindings in tics workflow --- .github/workflows/tics.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tics.yml b/.github/workflows/tics.yml index 74e9926df..cb8c5c51b 100644 --- a/.github/workflows/tics.yml +++ b/.github/workflows/tics.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y pipx pkgconf libssl-dev build-essential + sudo apt-get install -y pipx pkgconf python3-maturin libssl-dev build-essential # Client - name: Install Rust toolchain @@ -39,6 +39,9 @@ jobs: - name: Build (client) working-directory: client run: cargo build --all-features + - name: Install (client pybindings) + working-directory: client + run: pip install . --break-system-packages # Server - name: Set up uv From 87592c4734c7cc9950790e0ba0aa2d0a18d4f861 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Fri, 20 Feb 2026 10:43:43 -0500 Subject: [PATCH 5/6] docs(client): update CONTRIBUTING.md updated the python bindings section --- client/CONTRIBUTING.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client/CONTRIBUTING.md b/client/CONTRIBUTING.md index 4d8ffbf48..44d7005d0 100644 --- a/client/CONTRIBUTING.md +++ b/client/CONTRIBUTING.md @@ -34,15 +34,14 @@ sudo snap connect hwctl:system-observe ## Use Python Bindings The `hwlib` library can be used in Python code as well. We're using the -[`pyo3`][pyo3] library to create Python bindings; to build them, you need to -have [`maturin`][maturin] installed on your system. It requires a virtual -environment to be configured to work with it: +[`pyo3`][pyo3] library to create Python bindings and [`maturin`][maturin] to +build the Python library. It requires a virtual environment to be configured to +work with it: ```shell -virtualenv venv -source venv/bin/activate -pip install maturin -maturin develop --features pybindings +python3 -m venv .venv +source .venv/bin/activate +pip install . ``` Now you can use the library in your Python code. The library requires root From 89e24b2aaf91ccd516ebbd651172536c01528a50 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Fri, 20 Feb 2026 10:49:13 -0500 Subject: [PATCH 6/6] ci: run specific client tox tests --- .github/workflows/test_client.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_client.yaml b/.github/workflows/test_client.yaml index e179d307b..f6139dce1 100644 --- a/.github/workflows/test_client.yaml +++ b/.github/workflows/test_client.yaml @@ -84,5 +84,7 @@ jobs: python-version: "3.13" - name: Install tox run: pip install tox - - name: Run tox - run: tox + - name: Lint + run: tox run -e lint + - name: Unit + run: tox run -e unit