From 3ce7e5b64fb5cd79703aecaaeb4ef7364df15caa Mon Sep 17 00:00:00 2001 From: Rik <49898887+gemenerik@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:14:22 +0200 Subject: [PATCH 1/8] Refactor nightly.yml to use uv for Python setup Updated the nightly build workflow to use 'uv' for Python setup and dependency management, and removed macOS specific steps. --- .github/workflows/nightly.yml | 63 +++++++++++++++-------------------- 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index aaf91788e..3c6fe12a0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,4 +1,3 @@ -# Run check and build of the lib using the Bitcraze builder docker image name: Nightly Build on: @@ -13,28 +12,31 @@ jobs: matrix: os: [ubuntu-latest, lab-mac, windows-latest] python-version: ["3.10", "3.11", "3.12", "3.13"] - exclude: - - os: lab-mac - python-version: "3.13" runs-on: ${{ matrix.os }} + env: + UV_PYTHON_PREFERENCE: only-managed + steps: - name: Checkout repo uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - if: runner.os == 'Linux' || runner.os == 'Windows' - uses: actions/setup-python@v5 + - name: Set up uv + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} + enable-cache: true - - name: Set up Python ${{ matrix.python-version }} and venv on macOS - if: runner.os == 'macOS' + - name: Create venv + shell: bash run: | - brew install python@${{ matrix.python-version }} - $(brew --prefix)/bin/python${{ matrix.python-version }} -m venv venv - echo "PATH=$(pwd)/venv/bin:$PATH" >> $GITHUB_ENV + uv venv --clear --python ${{ matrix.python-version }} + if [ "$RUNNER_OS" = "Windows" ]; then + echo "$PWD/.venv/Scripts" >> $GITHUB_PATH + else + echo "$PWD/.venv/bin" >> $GITHUB_PATH + fi - name: Set up MSVC environment (Windows) uses: ilammy/msvc-dev-cmd@v1 @@ -42,49 +44,36 @@ jobs: arch: x64 if: runner.os == 'Windows' - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip build setuptools - python3 -m pip install pre-commit - - name: Code quality checks - run: pre-commit run --all-files + run: uvx pre-commit run --all-files - name: Build wheel - run: python3 -m build --wheel + run: uv build --wheel - name: Install the built wheel + shell: bash run: | - # Find the built wheel WHEEL_FILE=$(ls dist/*.whl | head -n 1) echo "Installing wheel: $WHEEL_FILE" - pip install "$WHEEL_FILE" - shell: bash - if: runner.os != 'Windows' - - - name: Install the built wheel (Windows) - run: | - for /f %%i in ('dir /b dist\*.whl') do set WHEEL_FILE=dist\%%i - echo Installing wheel: %WHEEL_FILE% - pip install %WHEEL_FILE% - shell: cmd - if: runner.os == 'Windows' + uv pip install "$WHEEL_FILE" - name: Test - run: python3 -m unittest discover test/ + run: python -m unittest discover test/ build-docs: runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 + - name: Set up uv + uses: astral-sh/setup-uv@v5 with: - python-version: '3.x' + python-version: "3.13" + enable-cache: true - name: Install dependencies run: | - python3 -m pip install --upgrade pip setuptools - python3 -m pip install pdoc3 pyyaml + uv venv + uv pip install pdoc3 pyyaml + echo "$PWD/.venv/bin" >> $GITHUB_PATH - name: Build docs run: ./tools/build-docs/build-docs From 26f8389113feb18b3f3e6c47aee01423a942825e Mon Sep 17 00:00:00 2001 From: Rik <49898887+gemenerik@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:16:42 +0200 Subject: [PATCH 2/8] Update nightly workflow to clear venv before install Clear the virtual environment before installing dependencies. --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3c6fe12a0..2ce9ed1d2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -72,7 +72,7 @@ jobs: enable-cache: true - name: Install dependencies run: | - uv venv + uv venv --clear uv pip install pdoc3 pyyaml echo "$PWD/.venv/bin" >> $GITHUB_PATH - name: Build docs From 77d712a6b24913b927f2803a5f2b468ff96357dc Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Mon, 27 Jul 2026 14:19:41 +0200 Subject: [PATCH 3/8] Reorder imports per pre-commit --- test/crazyflie/test_syncCrazyflie.py | 2 +- test/crazyflie/test_syncLogger.py | 2 +- test/localization/test_ippe_cf.py | 5 ++--- test/localization/test_lighthouse_bs_vector.py | 3 +-- test/localization/test_lighthouse_geometry_solver.py | 5 ++--- test/localization/test_lighthouse_initial_estimator.py | 5 ++--- test/localization/test_lighthouse_system_aligner.py | 3 +-- test/localization/test_lighthouse_types.py | 3 +-- 8 files changed, 11 insertions(+), 17 deletions(-) diff --git a/test/crazyflie/test_syncCrazyflie.py b/test/crazyflie/test_syncCrazyflie.py index 579c769d2..a0cf644ad 100644 --- a/test/crazyflie/test_syncCrazyflie.py +++ b/test/crazyflie/test_syncCrazyflie.py @@ -22,13 +22,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . import unittest -from test.support.asyncCallbackCaller import AsyncCallbackCaller from unittest.mock import MagicMock from cflib.crazyflie import Crazyflie from cflib.crazyflie.syncCrazyflie import SyncCrazyflie from cflib.utils import uri_helper from cflib.utils.callbacks import Caller +from test.support.asyncCallbackCaller import AsyncCallbackCaller class SyncCrazyflieTest(unittest.TestCase): diff --git a/test/crazyflie/test_syncLogger.py b/test/crazyflie/test_syncLogger.py index 5a81b8571..ad2d8eb58 100644 --- a/test/crazyflie/test_syncLogger.py +++ b/test/crazyflie/test_syncLogger.py @@ -22,7 +22,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . import unittest -from test.support.asyncCallbackCaller import AsyncCallbackCaller from unittest.mock import call from unittest.mock import MagicMock @@ -32,6 +31,7 @@ from cflib.crazyflie.syncCrazyflie import SyncCrazyflie from cflib.crazyflie.syncLogger import SyncLogger from cflib.utils.callbacks import Caller +from test.support.asyncCallbackCaller import AsyncCallbackCaller class SyncLoggerTest(unittest.TestCase): diff --git a/test/localization/test_ippe_cf.py b/test/localization/test_ippe_cf.py index fd0e64a84..8a1e46247 100644 --- a/test/localization/test_ippe_cf.py +++ b/test/localization/test_ippe_cf.py @@ -19,14 +19,13 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from test.localization.lighthouse_fixtures import LighthouseFixtures -from test.localization.lighthouse_test_base import LighthouseTestBase - import numpy as np from cflib.localization.ippe_cf import IppeCf from cflib.localization.lighthouse_types import LhDeck4SensorPositions from cflib.localization.lighthouse_types import Pose +from test.localization.lighthouse_fixtures import LighthouseFixtures +from test.localization.lighthouse_test_base import LighthouseTestBase class TestIppeCf(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_bs_vector.py b/test/localization/test_lighthouse_bs_vector.py index 8d490cd91..c745776d2 100644 --- a/test/localization/test_lighthouse_bs_vector.py +++ b/test/localization/test_lighthouse_bs_vector.py @@ -19,12 +19,11 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from test.localization.lighthouse_test_base import LighthouseTestBase - import numpy as np from cflib.localization import LighthouseBsVector from cflib.localization.lighthouse_bs_vector import LighthouseBsVectors +from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseBsVector(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_geometry_solver.py b/test/localization/test_lighthouse_geometry_solver.py index ad2f2fd29..77816529f 100644 --- a/test/localization/test_lighthouse_geometry_solver.py +++ b/test/localization/test_lighthouse_geometry_solver.py @@ -19,13 +19,12 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from test.localization.lighthouse_fixtures import LighthouseFixtures -from test.localization.lighthouse_test_base import LighthouseTestBase - from cflib.localization.lighthouse_geometry_solver import LighthouseGeometrySolver from cflib.localization.lighthouse_initial_estimator import LighthouseInitialEstimator from cflib.localization.lighthouse_types import LhCfPoseSample from cflib.localization.lighthouse_types import LhDeck4SensorPositions +from test.localization.lighthouse_fixtures import LighthouseFixtures +from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseGeometrySolver(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_initial_estimator.py b/test/localization/test_lighthouse_initial_estimator.py index b011558b5..2c38cb481 100644 --- a/test/localization/test_lighthouse_initial_estimator.py +++ b/test/localization/test_lighthouse_initial_estimator.py @@ -19,9 +19,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from test.localization.lighthouse_fixtures import LighthouseFixtures -from test.localization.lighthouse_test_base import LighthouseTestBase - import numpy as np from cflib.localization.lighthouse_initial_estimator import LighthouseInitialEstimator @@ -29,6 +26,8 @@ from cflib.localization.lighthouse_types import LhDeck4SensorPositions from cflib.localization.lighthouse_types import LhException from cflib.localization.lighthouse_types import Pose +from test.localization.lighthouse_fixtures import LighthouseFixtures +from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseInitialEstimator(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_system_aligner.py b/test/localization/test_lighthouse_system_aligner.py index 0e5cea781..7af8ca68a 100644 --- a/test/localization/test_lighthouse_system_aligner.py +++ b/test/localization/test_lighthouse_system_aligner.py @@ -19,12 +19,11 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from test.localization.lighthouse_test_base import LighthouseTestBase - import numpy as np from cflib.localization.lighthouse_system_aligner import LighthouseSystemAligner from cflib.localization.lighthouse_types import Pose +from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseSystemAligner(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_types.py b/test/localization/test_lighthouse_types.py index dacc2e27b..d0c62be4f 100644 --- a/test/localization/test_lighthouse_types.py +++ b/test/localization/test_lighthouse_types.py @@ -19,11 +19,10 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from test.localization.lighthouse_test_base import LighthouseTestBase - import numpy as np from cflib.localization.lighthouse_types import Pose +from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseTypes(LighthouseTestBase): From affdfde04645878e40b9ed84a228b3a2103d1f94 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Mon, 27 Jul 2026 14:24:44 +0200 Subject: [PATCH 4/8] Add pyyaml dependency to project requirements --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index a2c3a5dc7..29d370615 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ dependencies = [ "scipy~=1.14", "numpy~=2.2", "packaging~=25.0", + "pyyaml>=6.0.3", ] [project.urls] From d9546d89b7f88cf32efd8ab8601c4dc27280419e Mon Sep 17 00:00:00 2001 From: Rik <49898887+gemenerik@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:28:46 +0200 Subject: [PATCH 5/8] Add libusb-package and pyusb to dependencies for nightly doc build --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2ce9ed1d2..90f2580e8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -73,7 +73,7 @@ jobs: - name: Install dependencies run: | uv venv --clear - uv pip install pdoc3 pyyaml + uv pip install pdoc3 pyyaml libusb-package pyusb echo "$PWD/.venv/bin" >> $GITHUB_PATH - name: Build docs run: ./tools/build-docs/build-docs From f163e4003cd81e84987fb38ef990fe20202fbc46 Mon Sep 17 00:00:00 2001 From: Rik <49898887+gemenerik@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:31:49 +0200 Subject: [PATCH 6/8] Update dependency installation in nightly workflow --- .github/workflows/nightly.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 90f2580e8..e0e93aabc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -73,7 +73,8 @@ jobs: - name: Install dependencies run: | uv venv --clear - uv pip install pdoc3 pyyaml libusb-package pyusb + uv pip install -e . pdoc3 echo "$PWD/.venv/bin" >> $GITHUB_PATH + echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV - name: Build docs run: ./tools/build-docs/build-docs From 73fea1bd1adf5c8210f79ac74219861a5cd23079 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Mon, 27 Jul 2026 14:41:37 +0200 Subject: [PATCH 7/8] Drop code quality checks from nightly build The pre-commit suite already runs on every push and pull request in CI, inside the bitcraze/builder image. Running it again across the nightly os/python matrix duplicated that work, and reorder-python-imports gives a different answer under uv's managed interpreters than under the builder image, so the nightly disagreed with CI about test/* import placement. --- .github/workflows/nightly.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e0e93aabc..f8abd8926 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -44,9 +44,6 @@ jobs: arch: x64 if: runner.os == 'Windows' - - name: Code quality checks - run: uvx pre-commit run --all-files - - name: Build wheel run: uv build --wheel From 08645142b3cc051559a85269808b67080d6ab216 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Mon, 27 Jul 2026 14:42:14 +0200 Subject: [PATCH 8/8] Revert "Reorder imports per pre-commit" This reverts commit 77d712a. reorder-python-imports classifies the top-level `test` package by asking importlib whether it exists. Distro CPython, as in the bitcraze/builder image CI runs, ships the stdlib `test` package, so `test.*` imports sort as BUILTIN and belong in the first import block. uv's managed python-build-standalone interpreters strip that package, so the same imports fall back to the local ./test directory and sort as APPLICATION instead. 77d712a encoded the uv answer, which made CI fail. Restore the ordering the builder image expects. --- test/crazyflie/test_syncCrazyflie.py | 2 +- test/crazyflie/test_syncLogger.py | 2 +- test/localization/test_ippe_cf.py | 5 +++-- test/localization/test_lighthouse_bs_vector.py | 3 ++- test/localization/test_lighthouse_geometry_solver.py | 5 +++-- test/localization/test_lighthouse_initial_estimator.py | 5 +++-- test/localization/test_lighthouse_system_aligner.py | 3 ++- test/localization/test_lighthouse_types.py | 3 ++- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/test/crazyflie/test_syncCrazyflie.py b/test/crazyflie/test_syncCrazyflie.py index a0cf644ad..579c769d2 100644 --- a/test/crazyflie/test_syncCrazyflie.py +++ b/test/crazyflie/test_syncCrazyflie.py @@ -22,13 +22,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . import unittest +from test.support.asyncCallbackCaller import AsyncCallbackCaller from unittest.mock import MagicMock from cflib.crazyflie import Crazyflie from cflib.crazyflie.syncCrazyflie import SyncCrazyflie from cflib.utils import uri_helper from cflib.utils.callbacks import Caller -from test.support.asyncCallbackCaller import AsyncCallbackCaller class SyncCrazyflieTest(unittest.TestCase): diff --git a/test/crazyflie/test_syncLogger.py b/test/crazyflie/test_syncLogger.py index ad2d8eb58..5a81b8571 100644 --- a/test/crazyflie/test_syncLogger.py +++ b/test/crazyflie/test_syncLogger.py @@ -22,6 +22,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . import unittest +from test.support.asyncCallbackCaller import AsyncCallbackCaller from unittest.mock import call from unittest.mock import MagicMock @@ -31,7 +32,6 @@ from cflib.crazyflie.syncCrazyflie import SyncCrazyflie from cflib.crazyflie.syncLogger import SyncLogger from cflib.utils.callbacks import Caller -from test.support.asyncCallbackCaller import AsyncCallbackCaller class SyncLoggerTest(unittest.TestCase): diff --git a/test/localization/test_ippe_cf.py b/test/localization/test_ippe_cf.py index 8a1e46247..fd0e64a84 100644 --- a/test/localization/test_ippe_cf.py +++ b/test/localization/test_ippe_cf.py @@ -19,13 +19,14 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from test.localization.lighthouse_fixtures import LighthouseFixtures +from test.localization.lighthouse_test_base import LighthouseTestBase + import numpy as np from cflib.localization.ippe_cf import IppeCf from cflib.localization.lighthouse_types import LhDeck4SensorPositions from cflib.localization.lighthouse_types import Pose -from test.localization.lighthouse_fixtures import LighthouseFixtures -from test.localization.lighthouse_test_base import LighthouseTestBase class TestIppeCf(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_bs_vector.py b/test/localization/test_lighthouse_bs_vector.py index c745776d2..8d490cd91 100644 --- a/test/localization/test_lighthouse_bs_vector.py +++ b/test/localization/test_lighthouse_bs_vector.py @@ -19,11 +19,12 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from test.localization.lighthouse_test_base import LighthouseTestBase + import numpy as np from cflib.localization import LighthouseBsVector from cflib.localization.lighthouse_bs_vector import LighthouseBsVectors -from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseBsVector(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_geometry_solver.py b/test/localization/test_lighthouse_geometry_solver.py index 77816529f..ad2f2fd29 100644 --- a/test/localization/test_lighthouse_geometry_solver.py +++ b/test/localization/test_lighthouse_geometry_solver.py @@ -19,12 +19,13 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from test.localization.lighthouse_fixtures import LighthouseFixtures +from test.localization.lighthouse_test_base import LighthouseTestBase + from cflib.localization.lighthouse_geometry_solver import LighthouseGeometrySolver from cflib.localization.lighthouse_initial_estimator import LighthouseInitialEstimator from cflib.localization.lighthouse_types import LhCfPoseSample from cflib.localization.lighthouse_types import LhDeck4SensorPositions -from test.localization.lighthouse_fixtures import LighthouseFixtures -from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseGeometrySolver(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_initial_estimator.py b/test/localization/test_lighthouse_initial_estimator.py index 2c38cb481..b011558b5 100644 --- a/test/localization/test_lighthouse_initial_estimator.py +++ b/test/localization/test_lighthouse_initial_estimator.py @@ -19,6 +19,9 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from test.localization.lighthouse_fixtures import LighthouseFixtures +from test.localization.lighthouse_test_base import LighthouseTestBase + import numpy as np from cflib.localization.lighthouse_initial_estimator import LighthouseInitialEstimator @@ -26,8 +29,6 @@ from cflib.localization.lighthouse_types import LhDeck4SensorPositions from cflib.localization.lighthouse_types import LhException from cflib.localization.lighthouse_types import Pose -from test.localization.lighthouse_fixtures import LighthouseFixtures -from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseInitialEstimator(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_system_aligner.py b/test/localization/test_lighthouse_system_aligner.py index 7af8ca68a..0e5cea781 100644 --- a/test/localization/test_lighthouse_system_aligner.py +++ b/test/localization/test_lighthouse_system_aligner.py @@ -19,11 +19,12 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from test.localization.lighthouse_test_base import LighthouseTestBase + import numpy as np from cflib.localization.lighthouse_system_aligner import LighthouseSystemAligner from cflib.localization.lighthouse_types import Pose -from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseSystemAligner(LighthouseTestBase): diff --git a/test/localization/test_lighthouse_types.py b/test/localization/test_lighthouse_types.py index d0c62be4f..dacc2e27b 100644 --- a/test/localization/test_lighthouse_types.py +++ b/test/localization/test_lighthouse_types.py @@ -19,10 +19,11 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from test.localization.lighthouse_test_base import LighthouseTestBase + import numpy as np from cflib.localization.lighthouse_types import Pose -from test.localization.lighthouse_test_base import LighthouseTestBase class TestLighthouseTypes(LighthouseTestBase):