Repository navigation
Python: basic pybind11 interface to the microcontroller #1612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
dd374bc
Python: basic pybind11 interface to the microcontroller
pa-devbot 871232d
Python: stop committing pip egg-info leftovers
pa-devbot 0f9c150
Python: switch to cancel_all_and_wait(); stop miniz.c warnings breaki…
pa-devbot d34e550
Move the miniz.c warning suppression into pa_apply_base_target_proper…
pa-devbot 7b07de2
Put the miniz.c warning suppression in the base CMakeLists.txt, befor…
pa-devbot 6de7657
update pybind README
jw098 d4da646
Python bindings README: small fixes
pa-devbot 7b58308
more README updates
jw098 babadf9
pybind CI
jw098 5b3eaa0
update CI
jw098 903085e
rename selftest to controller_test
jw098 253fa4f
rename files
jw098 e582f37
Python: label where the Python code references the C++ code
pa-devbot 6c9ff5f
minor update to switch_connection_test.py
jw098 7370e4e
add comments
jw098 9e7b6b5
minor update to switch_connection_test.py
jw098 31533d9
add comments
jw098 26bfca3
Python: name SwitchController commands after the backend methods
pa-devbot 3409e3e
Python: drop the repeat option from push_button()/push_dpad()
pa-devbot c0dadd7
add comments
jw098 8b66908
Python tests: add a short docstring to every test function
pa-devbot 13ce1dd
Merge branch 'python-pybind-basic' of https://github.com/PokemonAutom…
jw098 c0ccd74
add comments
jw098 8f6d515
update comments
jw098 74385b8
Python tests: drop test_matches_cpp_enum, duplicate of test_python_co…
pa-devbot 4884117
add comments
jw098 d231865
rename variables
jw098 d8913a3
Python: follow the duration_ms/hold_ms/bitfield renames through all c…
pa-devbot f7d16c4
Align pybind/Python controller API with the PBF API
pa-devbot b594981
push_*_joystick(): back to separate x, y arguments
pa-devbot 0a7eb70
Python push_*_joystick(): accept an (x, y) joystick_position tuple
pa-devbot 6ab581a
update comments. add kwargs
jw098 9c9a008
Python controller_state(): left_joystick/right_joystick as (x, y) tuples
pa-devbot 04884c5
Python controller_state(): split buttons and dpad; push_dpad arg -> dpad
pa-devbot c1425e8
update comments
jw098 42b9a44
minor fix
jw098 f9a9070
update switch_connection_test.py
jw098 dc683a2
update comments
jw098 da17496
update README
jw098 7f515b4
update comments
jw098 4bfcec8
update comments
jw098 736d0eb
update pybind CI
jw098 f3a533f
PythonBindings.cmake: do not download pybind11; error with install steps
pa-devbot e014c47
update pybind CI
jw098 ce5ebac
update comments
jw098 2590c3a
Python bindings: fix doc typos and stale example kwargs
pa-devbot b1698ea
Fix bug: close() serialization
jw098 9bafba2
fix Empty port name: SerialPABotBase2_Descriptor::open_connection() r…
jw098 3d248db
Fix review bugs: destruction race, empty port
jw098 49d1cfa
update README
jw098 4bc8307
update README
jw098 c100ca0
Rename SwitchController to SwitchProController
pa-devbot 54093a5
add comments
jw098 92e6cdb
buttons.py: remove the BUTTON_ALIASES table
pa-devbot 8ec0607
fix comment
jw098 8dad423
update comments
jw098 fa5597a
minor update to error message
jw098 46581b7
update comments
jw098 d927703
minor fixes
jw098 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: C++ CI Python Bindings | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| # Builds the GUI-free core plus the _pa_core pybind11 module | ||
| # (Source/PythonBindings/README.md) and runs the package's pytest suite. | ||
| # This needs no Qt, OpenCV, ONNX Runtime, Tesseract, DPP or Discord SDK. | ||
|
|
||
| jobs: | ||
| build: | ||
| # if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | ||
| runs-on: ubuntu-26.04 | ||
|
|
||
| steps: | ||
| - name: Checkout Arduino-Source | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| path: 'Arduino-Source' | ||
| submodules: 'recursive' | ||
|
|
||
| # Step 1: Create a single environment for the entire job | ||
| - name: Set up Virtual Environment | ||
| run: | | ||
| python3 -m venv /tmp/pa-build-venv | ||
| /tmp/pa-build-venv/bin/pip install --upgrade pip | ||
| /tmp/pa-build-venv/bin/pip install pybind11 pytest | ||
|
|
||
| - name: Generate binaries | ||
| run: | | ||
| cd Arduino-Source/SerialPrograms | ||
| mkdir bin | ||
| cd bin | ||
| cmake .. -DPA_CORE_ONLY=ON -DPA_PYTHON_BINDINGS=ON -DPython_EXECUTABLE=/tmp/pa-build-venv/bin/python | ||
| cmake --build . --config RelWithDebInfo --parallel 10 | ||
|
|
||
| - name: Run the Python tests | ||
| run: | | ||
| cd Arduino-Source/SerialPrograms/Source/PythonBindings | ||
| /tmp/pa-build-venv/bin/python -m pytest -q | ||
|
|
||
| # Note: the venv avoids PEP 668 issues with system-pip on newer runners. | ||
| # The runner's system Python needs dev headers (python3-dev is preinstalled on the images). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.