Compare commits

...
Author SHA1 Message Date
Laurens Valk 5d6ee68638 v4.0.0b11 2026-06-01 16:26:28 +02:00
Laurens Valk acf3b1be65 conf: Build a json symbol index on build.
Ship it with the docs so we can parse it in Pybricks for namespace based lookup.
2026-06-01 16:26:28 +02:00
Laurens Valk 7409057b9c pybricks: Indexing fixes.
The noindex made them not show up. Also fix misc related indexing issues.
2026-06-01 16:26:24 +02:00
Laurens Valk 89e5bde8e7 pybricks.pupdevices.Motor: Namespace model and control.
Otherwise the duplicate the Motor class in the object index.
2026-06-01 15:32:57 +02:00
Laurens Valk 5ecad4a845 pybricks.parameters. Document with full namespace.
This types them in full for the object index.
2026-06-01 15:18:09 +02:00
Laurens Valk a402ae02e9 poetry: Update locks.
0.0.0 can't be pinned.
2026-05-30 11:47:05 +02:00
Laurens Valk cd58dde773 v4.0.0b10 2026-05-30 11:40:00 +02:00
Laurens Valk 2926b4af71 npm/jedi: Build pybricks-api from source.
Now that we use a single release pipeline, the API itself might not yet be on
PyPI by the time we build jedi, so we build it locally.

We'll still keep the API docs on PyPI so users can have local autocomplete,
but that path is no longer a dependency for building jedi.

Also explain CHANGELOG synchronization with firmware repo.
2026-05-30 11:39:00 +02:00
Laurens Valk 614453aa32 .github/workflows: Fix permissions and npm version tags. 2026-05-30 11:32:04 +02:00
Laurens Valk 0f6b8dee67 npm: Simplify release pipeline.
Releasing API updates is quite a long and error prone process, so the point
that it was limiting our ability to push frequent updates in practice. There
were 5 tag, commit, wait, and proceed steps and you'd have to start over or
force push if a mistake was made.

This keeps all the npm packages as they were, but versions everything from a
single source of truth, which is this project's main version. Everything
builds on a tag on the main repo, much like we did for a regular IDE docs RTD
release.

It also skips the PyPI for jedi as an intermediate step, which isn't really
needed and required us to have this strict order of publication steps.
2026-05-30 11:31:38 +02:00
Laurens Valk a9be86238d pybricks.messaging.BLERadio: Fix example paths. 2026-05-29 20:28:36 +02:00
Laurens Valk 16d5ba64d2 pybricks.ev3devices: Update return types. 2026-05-29 20:09:06 +02:00
Laurens Valk d8802ace7d pybricks.common: Update system info. 2026-05-29 20:08:53 +02:00
Laurens Valk acb5206349 pybricks.robotics: Update DriveBase. 2026-05-29 20:06:56 +02:00
Laurens Valk 6686fce3c3 pybricks.pupdevices: Document MarioHub, TechnicMoveHub and DuploTrain. 2026-05-29 16:59:51 +02:00
Laurens Valk 7d27fbb5d8 pybricks.iodevices: Document DCMotor. 2026-05-29 15:39:24 +02:00
Laurens Valk a0e98ba75f pybricks.iodevices: Document pinout. 2026-05-29 15:34:58 +02:00
Laurens Valk 1b69e42b6b pybricks.iodevices: Update UARTDevice docstrings. 2026-05-29 14:57:53 +02:00
Laurens Valk 47a3d664c2 pybricks.iodevices: Include all classes in index.
Some were omitted once EV3 in Pybricks 2.0 was dropped, but they will be included again to prepare for EV3 in Pybricks 4.0.

Enable for Powered UP where relevant, as with UARTDevice.
2026-05-29 14:22:15 +02:00
Laurens Valk e6cb436c47 pybricks.iodevices: Update I2CDevice docstrings. 2026-05-29 13:41:10 +02:00
Laurens Valk a8d74720b6 pybricks.iodevices: Update AnalogSensor docstrings. 2026-05-29 12:38:49 +02:00
Laurens Valk 54b4e39360 pybricks.iodevices: Update XboxController docstrings. 2026-05-29 12:32:43 +02:00
Laurens Valk 1f8f0f777a pybricks.iodevices: Update PUPDevice and LUMPDevice.
Also remove Ev3devSensor, which is no longer used.
2026-05-29 12:30:58 +02:00
Laurens Valk 45b9b89d11 pybricks.messaging: Add tests. 2026-05-29 11:48:15 +02:00
Laurens Valk e0f48b178b pybricks.messaging: Document AppData. 2026-05-29 11:41:45 +02:00
Laurens Valk 8ed5a489b9 pybricks.messaging.BLERadio: Include raised errors. 2026-05-29 11:24:41 +02:00
Laurens Valk a2ba8e4dcd pybricks.hubs: Move .ble to BLERadio.
Follows upstream firmware change.

Update tests and examples too.
2026-05-29 11:12:50 +02:00
Frederik Leonhardt 7900f03574 jedi: Add tests for methods on hub.ble. 2026-05-28 11:20:54 +02:00
Frederik Leonhardt 7014f46441 pybricks.common.BLE: Improve typing for broadcast() and observe()
- Add overloads for broadcast(). It accepts either a single value, or a tuple,
  or a list.

- Adjust return type of observe(). It either returns a single value, or a tuple.
2026-05-28 11:12:17 +02:00
Frederik Leonhardt 7411a246c9 pybricks.common.BLE: Improve typing for hub constructor.
Update type hint for broadcast_channel to Optional, as None is allowed.
2026-05-28 11:12:17 +02:00
Lasse Deleuran 3bc2f35e3e pybricks.iodevices: Added missing functions and parameters.
* Added missing functions and parameters to documentation.

- AnalogSensor: Missing parameter "custom".
- I2CDevice: Missing parameters "port", "address", "custom", "powered", and "nxt_quirk" with attempted explanation of parameters.
- UARTDevice: Missing default parameter value.
- LWP3Device: Missing "connect" parameter.
- Added missing connect and disconnnect methods.
- XboxController: Missing documentation in constructor and missing methods.

* Minor changes to the documentation

Made it more clear and less verbose when to skip connect to bluetooth devices.
2026-05-28 10:47:04 +02:00
kai-morich 61578b5547 pybricks.parameters: Add/fix operators for Color type.
* Implement `Color.__eq__`, fix `Color.__mul__`. This allows testing of color block sorting algorithms with CPython.
* implement `Color.__lshift__` and immutability for completeness.
2026-04-25 11:01:54 -05:00
JoBe c615ccf986 pybricks._common: Fix parameter name in LightMatrix.orientation().
The parameter `up` was named `top` here, which does not reflect the state of the current code.

See https://github.com/pybricks/pybricks-micropython/blob/master/pybricks/common/pb_type_lightmatrix.c#L59C25 for usage in the code itself.
2026-03-29 17:41:34 -05:00
Gabriel Couchenour 32f974e7e5 Robotics.py: Fix issue with the type stub for DriveBase.angle() (#165)
The type was changed from `int` to `float` in https://github.com/pybricks/pybricks-micropython/commit/4d457a17fc13d42d9b311df99e05dafaeed67862.

Technically, it is still `int` on BOOST Move hub (any system without floating point support). But most platforms use `float` so makes sense to have that in the type hints.
2025-09-19 21:53:37 -05:00
Laurens Valk 0efcfd4a36 pybricks.iodevices.LWP3Device: Document new parameters. 2025-06-16 11:05:13 +02:00
Laurens Valk 356f6ffdba v3.6.1 2025-05-01 11:30:32 +02:00
Laurens Valk 4967b96ddd doc/main: Fix trailing whitespace.
For some reason this was not caught by CI.
2025-05-01 11:27:33 +02:00
Laurens Valk 116368e4c7 pybricks.hubs: List missing system.info method. 2025-05-01 11:25:56 +02:00
Laurens Valk 5b56249d8c doc/common/extensions: Drop unused imports. 2025-05-01 11:19:48 +02:00
Laurens Valk 04fb7e3e19 @pybricks/images/v1.4.0 2025-03-19 10:33:59 +01:00
Laurens Valk 5814a73bb1 v3.6.0 2025-03-11 13:08:17 +01:00
Laurens Valk ed3059b47b pybricks.common.IMU: Clarify notes on calibrated values. 2025-03-11 13:01:10 +01:00
Laurens Valk 2a98264144 @pybricks/jedi/v1.17.0 2025-02-26 12:54:14 +01:00
Laurens Valk 6083b17d9a pybricks_jedi/v1.17.0 2025-02-26 12:49:04 +01:00
Laurens Valk 1c598f35be @pybricks/ide-docs/v2.20.0 2025-02-26 12:33:03 +01:00
Laurens Valk 52c522df2d v3.6.0b5 2025-02-26 12:29:10 +01:00
Laurens Valk 2380be2814 extensions/blockimg: Embed svg.
This cuts the total build from 527 to 156 files,
which is considerably fewer requests when loading
this inside Pybricks Code.

See https://github.com/pybricks/support/issues/1559
2025-02-26 10:58:03 +01:00
Laurens Valk 89a34e9f51 conf: Don't export txt sources.
The sources are hosted on GitHub, so there is not additional information here. Also, the actual docstrings are included in the .py files.

See https://github.com/pybricks/support/issues/1559
2025-02-26 10:17:08 +01:00
Laurens Valk 9597f227f4 pybricks.common.IMU: Add settings blocks. 2025-02-25 13:47:07 +01:00
Laurens Valk 1e09cb2232 builtins: Document missing eval and exec on Move Hub.
Fixes https://github.com/pybricks/support/issues/1931
2025-02-25 11:32:01 +01:00
Laurens Valk 6739b517a5 examples: Fix duty cycle comment.
Fixes https://github.com/pybricks/support/issues/2029
2025-02-25 11:26:16 +01:00
Laurens Valk c5cfcd0ac8 tests: Update for IMU changes. 2025-02-25 11:16:27 +01:00
Laurens Valk 827eda031b pybricks.common.System: Document new system info. 2025-02-25 11:16:27 +01:00
Laurens Valk c77b440270 pybricks.parameters: Allow iterating colors.
https://github.com/pybricks/support/issues/1661
2025-02-25 11:16:27 +01:00
Laurens Valk 789e70a42b pybricks.common.BLE: Broadcast fixes.
Fix missing awaitable. Fix default broadcast channel following firmware update.
2025-02-25 11:16:27 +01:00
Laurens Valk 53d6d14de6 pybricks.common.IMU: Document calibration kwarg option. 2025-02-25 11:16:27 +01:00
Laurens Valk ce9d7420fb pybricks.common.IMU: Document new settings.
Also dcument hub.system.reset_storage.
2025-02-25 11:16:27 +01:00
Laurens Valk 044903b193 pybricks.common.Motor: Clarify drive base reset side effect.
Fixes https://github.com/pybricks/support/issues/1449
2025-02-25 11:16:27 +01:00
Laurens Valk 25bfd0e80e pybricks.robotics.DriveBase: Document curve and reset updates. 2025-02-25 11:16:27 +01:00
David Lechner b28f768bec pybricks.lwp3device: Show compatibility.
It has come up a few times recently that this wasn't clear.
2025-01-25 11:02:54 -06:00
111 changed files with 16202 additions and 1570 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install dependencies
+1 -16
View File
@@ -7,24 +7,9 @@ jobs:
if: github.ref_type != 'tag'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- run: pipx install poetry
- run: poetry install
working-directory: ./jedi
- run: poetry run pytest -vv
working-directory: ./jedi
publish:
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'pybricks_jedi/')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: pipx install poetry
- run: poetry install
working-directory: ./jedi
- run: poetry build
working-directory: ./jedi
- run: poetry publish
working-directory: ./jedi
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_PYBRICKS_JEDI_TOKEN }}
+20 -9
View File
@@ -2,22 +2,33 @@ name: Release @pybricks/ide-docs
on:
push:
tags:
- '@pybricks/ide-docs/**'
tags:
- 'v4.*'
permissions:
id-token: write
contents: read
jobs:
publish_ide_docs:
runs-on: ubuntu-22.04
steps:
- name: Get version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
NPM_VERSION=$(echo "$VERSION" | sed 's/\([0-9]\)a\([0-9]\)/\1-alpha.\2/;s/\([0-9]\)b\([0-9]\)/\1-beta.\2/;s/\([0-9]\)rc\([0-9]\)/\1-rc.\2/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_ENV
echo "NPM_TAG=$(echo "$NPM_VERSION" | grep -q '-' && echo 'next' || echo 'latest')" >> $GITHUB_ENV
- name: Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y dvisvgm preview-latex-style texlive texlive-fonts-extra texlive-latex-extra
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
@@ -26,13 +37,13 @@ jobs:
poetry run python -m pip install --upgrade pip
poetry run python -m pip install --upgrade setuptools
poetry install --only=doc
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '14.x'
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- run: npm version --no-git-tag-version "$NPM_VERSION"
working-directory: npm/ide-docs
- run: yarn build
working-directory: npm/ide-docs
- run: yarn publish
- run: npm publish --tag "$NPM_TAG"
working-directory: npm/ide-docs
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
+3 -3
View File
@@ -9,11 +9,11 @@ jobs:
publish_ide_docs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- run: ./build.py
working-directory: npm/images
+32 -12
View File
@@ -2,22 +2,42 @@ name: Release @pybricks/jedi
on:
push:
tags:
- '@pybricks/jedi/**'
tags:
- 'v4.*'
permissions:
id-token: write
contents: read
jobs:
publish_jedi:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- name: Get version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
NPM_VERSION=$(echo "$VERSION" | sed 's/\([0-9]\)a\([0-9]\)/\1-alpha.\2/;s/\([0-9]\)b\([0-9]\)/\1-beta.\2/;s/\([0-9]\)rc\([0-9]\)/\1-rc.\2/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_ENV
echo "NPM_TAG=$(echo "$NPM_VERSION" | grep -q '-' && echo 'next' || echo 'latest')" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
node-version: '16.x'
python-version: '3.11'
- name: Install poetry
run: pipx install poetry
- name: Set pybricks-jedi version
run: poetry version "$VERSION"
working-directory: jedi
- name: Set pybricks version and update jedi dependency pin
run: |
poetry version "$VERSION"
sed -i "s/^pybricks = \".*\"/pybricks = \"$VERSION\"/" jedi/pyproject.toml
- uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- run: ./build.py
working-directory: npm/jedi
- run: yarn publish
working-directory: npm/jedi/build
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- run: python jedi/build.py "$NPM_VERSION"
- run: npm publish --tag "$NPM_TAG"
working-directory: jedi/npm-build
+3 -3
View File
@@ -1,7 +1,7 @@
on:
push:
tags:
- 'v3.*'
- 'v4.*'
name: Create release on GitHub and PyPI
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
@@ -38,7 +38,7 @@ jobs:
build_and_publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- run: pipx run poetry build
- run: pipx run poetry publish
env:
+1
View File
@@ -25,6 +25,7 @@
build/
build-*/
_build/
npm-build/
# Tests
######################
-1
View File
@@ -24,7 +24,6 @@ EV3
ev3brick
ev3dev
ev3devices
Ev3devSensor
fb
Franca
func
+7 -279
View File
@@ -1,285 +1,13 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
See [pybricks-micropython/CHANGELOG.md][changelog] for the changes in each release.
## Unreleased
This repository is frequently updated to stay in sync with the implementation.
## 3.5.0- 2024-04-11
Major and minor versions are synchronized with `pybricks-micropython`, which
leads. Patch versions and prerelease version numbers may differ, as they may
be bumped for every small change or typo in the docs.
### Changed
- Bump version to 3.5.0 without additional changes.
The version for this repository is also used for the `@pybricks/jedi` and `@pybricks/ide-docs` npm packages.
## 3.5.0b2 - 2024-04-05
### Added
- Added `pybricks.pupdevices.Remote.disconnect` method.
- Added blocks for `up`, `ready` and `stationary` for IMUs.
- Added `last` and `chr` parameters to `read_input_byte` and add blocks.
- Added block for the `in` operation.
- Add double ternary block.
## 3.5.0b1 - 2024-03-11
### Added
- Added `XboxController.rumble` method.
- Added block icons for `hub.system.set_stop_button` and `hub.system.shutdown`.
- Added program stop block (`raise SystemExit`).
## 3.4.1 - 2024-03-11
### Fixed
- Fixed Read The Docs virtual environment workflow.
## 3.4.0 - 2024-03-11
### Changed
- Update list block screenshots to match implementation.
## 3.4.0b5 - 2024-03-05
### Changed
- Updates for v3.4.0b3 firmware (out of sync with docs).
- Changed `hub.button` to `hub.buttons` on single button hubs. Access via
`hub.button` will keep working in the firmware for backwards compatibility.
## 3.4.0b4 - 2024-02-14
### Added
- Added `pybricks.iodevices.XboxController` class.
### Changed
- Changed `buttons.pressed` return type to set.
## 3.4.0b3 - 2024-01-30
### Added
- Added `pybricks.robotics.Car` class.
### Changed
- Changed `pybricks.robotics.DriveBase` icon to two wheels instead of steering
wheel, which will be used for the new car class.
## 3.4.0b2 - 2023-11-28
### Changed
- Include first batch of block coding images.
## 3.3.0 - 2023-11-24
### Changed
- Bump beta version to release version with no further changes.
## 3.3.0c1 - 2023-11-20
### Added
- Enabled tilt and orientation config for `MoveHub()`.
- Documented `Motor.close()`
## Fixed
- Fixed missing awaitable for `Remote.light` and LWP3 writes.
## 3.3.0b9 - 2023-10-26
### Changed
- Changed the beta feature for using the hub's gyro. Gyro control can now be
toggled using `use_gyro` instead of using a separate `GyroDriveBase` class.
- Documentation updates to match firmware 3.3.0b5--3.3.0b9 updates.
### Added
- Added `set` to `ubuiltins` module.
- Basic multitasking docs.
- Awaitable keyword for awaitable methods and functions.
## 3.3.0b5 - 2023-05-16
### Added
- Documented new `hub.ble` methods.
## 3.3.0b4 - 2023-04-21
### Added
- Documented `integral_deadzone` in `Control.pid()`.
- Documented `Motor.model`. This can be used to view the estimated motor
state and change its settings.
- Added `rotation`, `orientation`, `ready`, `stationary` and `settings` methods
to `IMU` class.
- Added `GyroDriveBase` class to `pybricks.robotics`.
### Changed
- Change implementation status of `IMU.heading` and `IMU.reset_heading`. They
are now implemented, with some limitations as noted in a note box.
- Moved `Matrix` and `vector` from `pybricks.geometry` to `pybricks.tools`.
- Moved `Axis` from `pybricks.geometry` to `pybricks.parameters`.
### Removed
- Removed `pybricks.geometry` module.
## 3.2.0 - 2022-12-20
### Changed
- Changed module TOC headings to make it easier to find things.
## 3.2.0c1 - 2022-12-09
### Changed
- Updated "front" side of the Technic Hub to be consistent with
the Prime Hub.
## 3.2.0b6 - 2022-12-02
### Added
- Documented ``Stop.NONE`` and ``Stop.COAST_SMART``.
- Documented ``ujson`` module.
- Added `done` and `stalled` methods for `DriveBase`.
### Changed
- Changed `PrimeHub.display.image()` to `PrimeHub.display.icon()` and renamed
its kwarg from `image` to `icon`.
- Improved presentation and docstrings of the ``ubuiltins`` and other
MicroPython modules
- Moved the random numbers example for Move Hub to the Move Hub page.
- Moved `done()`, `stalled()`, `load()` from `Control` to `Motor` object.
## 3.2.0b5 - 2022-11-11
### Fixed
- Fixed Jedi code completion for `Color` and `Icon` classes in `pybricks.parameters`.
## 3.2.0b4 - 2022-10-21
### Added
- Code auto-completion for `EssentialHub`.
- Added `System.storage` method.
### Fixed
- Fixed some type hints in `parameters` submodule.
## 3.2.0b1-r3 - 2022-06-26
### Fixed
- Fixed more type hints and improved compatibility with jedi.
## 3.2.0b1-r2 - 2022-06-24
### Changed
- Moved remaining type hints from `.pyi` files to the python stub modules, and
fixed numerous errors in the type hints throughout.
## 3.2.0b1-r1 - 2022-06-09
### Added
- Added `__init__.py` to `pybricks` package.
## 3.2.0b1 - 2022-06-02
### Added
- Code auto-completion for `hub.charger`, `hub.imu` and `hub.system`.
- Moved typing from several `.pyi` files to the actual python modules.
### Fixed
- Fixed code completion for `DCMotor` and `Motor` classes in MS Python VS Code extension.
- Fixed missing `DCMotor` type in `ev3devices`.
- Fixed type hint for `Motor.reset_angle()` in `pupdevices`.
### Changed
- Setter for acceleration can now also be used to set acceleration and
deceleration to different values, using a two-valued tuple.
## 3.1.0 - 2021-12-16
### Added
- Added maximum voltage setter for `DCMotor` and `Motor`.
- Documented `DriveBase.curve()` method.
### Changed
- Removed `duty` setting from `Control.limits` method.
- Removed `integral_range` setting from `Control.pid` method.
### Fixed
- Fixed link to Color Light Matrix page.
- Fixed link to Inventor Hub page.
## 3.1.0rc1 - 2021-11-19
### Added
- Added `ColorLightMatrix` class.
- Added `LWP3Device` class.
**NOTE: version number after this point were from JavaScript package and do
not correspond to Pybricks firmware version numbers.**
## 1.6.0 - 2021-08-30
### Added
- MicroPython module documentation.
- Examples for hub system functions including stop button and shutdown.
### Changed
- Build IDE docs as main docs with minor changes, instead of a completely
separate build.
- Moved motor control documentation to the motor page.
## 1.5.0 - 2021-07-01
### Added
- Documentation for Powered Up Remote Control.
## 1.4.0 - 2021-06-23
### Added
- Enabled beta content that was hidden for the 3.0 release.
- Added notice about using the latest beta version.
## 1.3.3 - 2021-05-21
### Changed
- Match example snippet styling to IDE.
- Add more examples.
## 1.3.2 - 2021-04-26
### Changed
- Theme style fixes.
- Example code fixes
- Match doc version to firmware version.
## 1.3.1 - 2021-04-12
### Changed
- Upgrade sphinx and rtd-theme to fix style issues.
## 1.3.0 - 2021-04-12
### Removed
- Removed features which not be in the official 3.0 release. These features
are still in beta. They'll come back in future releases once tested.
## 1.2.0 - 2021-04-09
### Changed
- Moved installation guide to external site.
## 1.1.1 - 2021-02-14
### Added
- Added installation guide.
- Various documentation fixes.
## 1.1.0 - 2021-01-28
### Added
- Scrollbar styling.
## 1.0.0 - 2021-01-25
### Added
- Sphinx build output.
[changelog]: https://github.com/pybricks/pybricks-micropython/blob/master/CHANGELOG.md
+5
View File
@@ -163,6 +163,11 @@ Linting:
poetry run flake8 # check Python
poetry run doc8 # check Restructured Text
Building all release artifacts (docs, jedi, npm packages):
# Linux/macOS only
./build-all.sh
[vscode]: https://code.visualstudio.com/
[git]: https://git-scm.com/
[python]: https://www.python.org/
Executable
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Build all release artifacts locally (equivalent to CI workflows, minus publish).
set -euo pipefail
REPO_ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
# Activate the project venv so python/make/etc. all use it without poetry run
source "$REPO_ROOT/.venv/bin/activate"
# Read version from pyproject.toml
VERSION=$(grep '^version = ' "$REPO_ROOT/pyproject.toml" | head -1 | sed 's/version = "\(.*\)"/\1/')
# Convert Python pre-release format (e.g. 4.0.0a1, 4.0.0b1, 4.0.0rc1) to npm semver (e.g. 4.0.0-alpha.1, 4.0.0-beta.1, 4.0.0-rc.1)
NPM_VERSION=$(echo "$VERSION" | sed 's/\([0-9]\)a\([0-9]\)/\1-alpha.\2/;s/\([0-9]\)b\([0-9]\)/\1-beta.\2/;s/\([0-9]\)rc\([0-9]\)/\1-rc.\2/')
echo "==> Building version $VERSION (npm: $NPM_VERSION)"
# lint
echo "==> Linting"
cd "$REPO_ROOT"
flake8
doc8
# pybricks-jedi tests
echo "==> Testing pybricks-jedi"
cd "$REPO_ROOT/jedi"
poetry run pytest -vv
# @pybricks/jedi npm package
echo "==> Building @pybricks/jedi"
cd "$REPO_ROOT/jedi"
python3 build.py "$NPM_VERSION"
# @pybricks/ide-docs npm package
echo "==> Building @pybricks/ide-docs"
cd "$REPO_ROOT"
make -C doc clean
cd "$REPO_ROOT/npm/ide-docs"
yarn build
echo ""
echo "Build complete."
echo " jedi npm package : jedi/npm-build/"
echo " ide-docs : npm/ide-docs/html/"
+10 -2
View File
@@ -1,3 +1,11 @@
.block-image {
margin-top: 10px;
.svg-container {
display: inline-block;
width: 100%;
height: auto;
}
.svg-container svg {
position: relative;
height: auto;
max-width: 100%;
}
+30 -6
View File
@@ -151,6 +151,9 @@ import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_show_sourcelink = False
html_copy_source = False
html_context = {
"disclaimer": _DISCLAIMER,
}
@@ -251,16 +254,11 @@ latex_documents = [
exclude_patterns = [
"ev3devices.rst",
"hubs/ev3brick.rst",
"iodevices/analogsensor.rst",
"iodevices/dcmotor.rst",
"iodevices/ev3devsensor.rst",
"iodevices/i2cdevice.rst",
"iodevices/lumpdevice.rst",
"iodevices/uartdevice.rst",
"media.rst",
"messaging.rst",
"nxtdevices.rst",
"tools/datalog.rst",
"*.rst.txt",
]
@@ -366,9 +364,35 @@ def on_missing_reference(
return nodes.Text(f"{ret_type}: {ret_unit}")
def on_build_finished(app: Sphinx, exception):
if exception or app.builder.name != "html":
return
import json
from sphinx.ext.intersphinx import InventoryFile
inv_path = os.path.join(app.outdir, "objects.inv")
if not os.path.exists(inv_path):
return
with open(inv_path, "rb") as f:
inv = InventoryFile.load(f, "", lambda base, uri: base + uri)
index = {}
for type_key, entries in inv.items():
if not type_key.startswith("py:"):
continue
for name, (project, version, url, display) in entries.items():
index[name] = url
out_path = os.path.join(app.outdir, "index.json")
with open(out_path, "w") as f:
json.dump(index, f, indent=2, sort_keys=True)
def setup(app: Sphinx):
app.add_directive("availability", AvailabilityDirective)
app.connect("missing-reference", on_missing_reference)
app.connect("build-finished", on_build_finished)
# -- Python domain hacks ---------------------------------------------------
+16 -35
View File
@@ -1,56 +1,37 @@
import xml.etree.ElementTree as ET
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.images import Image
from docutils.nodes import image, paragraph
from docutils.parsers.rst import Directive
from docutils import nodes
from pathlib import Path
SPHINX_IMAGE_PATH = "blockimg"
SVG_SCALE = 0.9
def get_svg_size(file_path):
tree = ET.parse(file_path)
root = tree.getroot()
width = root.attrib.get("width")
height = root.attrib.get("height")
return float(width), float(height)
def get_svg_content(file_path):
with open(file_path, "r", encoding="utf-8") as file:
return file.read()
# Global variable to store the app object
app = None
class BlockImageDirective(Image):
option_spec = Image.option_spec.copy()
option_spec["stack"] = directives.flag
class BlockImageDirective(Directive):
has_content = False
required_arguments = 1
optional_arguments = 0
def run(self):
# Adjust the image path
file_name = self.arguments[0] + ".svg"
self.arguments[0] = "/" + SPHINX_IMAGE_PATH + "/" + file_name
path = Path(app.srcdir) / SPHINX_IMAGE_PATH / file_name
file_path = Path(app.srcdir) / SPHINX_IMAGE_PATH / file_name
# Set it to the scaled SVG size unless width explicitly set.
if self.options.get("width") is None:
width, height = get_svg_size(path)
self.options["width"] = str(round(width * SVG_SCALE)) + "px"
self.options["height"] = str(round(height * SVG_SCALE)) + "px"
# Read the SVG content
svg_content = get_svg_content(file_path)
# Call the parent class's run method
nodes = super().run()
# Create a raw HTML node with the SVG content
raw_html = f'<div class="svg-container">{svg_content}</div>'
raw_node = nodes.raw("", raw_html, format="html")
# Wrap each image node in a paragraph node
for i, node in enumerate(nodes):
if isinstance(node, image):
if "stack" not in self.options:
node["classes"].append("block-image")
nodes[i] = paragraph("", "", node)
return nodes
return [raw_node]
def setup(apparg):
+17 -9
View File
@@ -18,14 +18,23 @@ FEATURES_MEDIUM = FEATURES_SMALL | {
}
# Large feature set.
FEATURES_LARGE = FEATURES_MEDIUM | set()
FEATURES_LARGE = FEATURES_MEDIUM | {
"ble-extra", # Extra features such as pairing or multiple connections.
}
# Features per hub.
HUB_FEATURES = {
"movehub": {"movehub"} | FEATURES_SMALL,
"cityhub": {"cityhub"} | FEATURES_MEDIUM,
"technichub": {"technichub", "gyro", "xbox-controller"} | FEATURES_MEDIUM,
"primehub": {"primehub", "inventorhub", "light-matrix", "gyro", "xbox-controller"}
"movehub": {"movehub", "pup"} | FEATURES_SMALL,
"cityhub": {"cityhub", "pup"} | FEATURES_MEDIUM,
"technichub": {"technichub", "gyro", "xbox-controller", "pup"} | FEATURES_MEDIUM,
"primehub": {
"primehub",
"inventorhub",
"light-matrix",
"gyro",
"xbox-controller",
"pup",
}
| FEATURES_LARGE,
"inventorhub": {
"primehub",
@@ -33,9 +42,10 @@ HUB_FEATURES = {
"light-matrix",
"gyro",
"xbox-controller",
"pup",
}
| FEATURES_LARGE,
"essentialhub": {"essentialhub", "gyro", "xbox-controller"} | FEATURES_LARGE,
"essentialhub": {"essentialhub", "gyro", "xbox-controller", "pup"} | FEATURES_LARGE,
}
@@ -94,9 +104,7 @@ class PybricksRequirementsStaticDirective(Directive):
</tbody>
</table>
</div>
""".format(
compat_row
)
""".format(compat_row)
# Return the node.
node = nodes.raw("", html, format="html")
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

+89
View File
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg2"
width="525"
height="525"
viewBox="0 0 525 525"
sodipodi:docname="icon_ev3hub.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
inkscape:export-filename="../diagrams/icon_ev3hub.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath860">
<rect
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect862"
width="589.10107"
height="96.333336"
x="235.33333"
y="-236.00002" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1040">
<rect
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1042"
width="128.5101"
height="19.934668"
x="827.15656"
y="74.666672" />
</clipPath>
</defs>
<sodipodi:namedview
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1163"
id="namedview4"
showgrid="false"
inkscape:zoom="0.9950413"
inkscape:cx="301.49502"
inkscape:cy="344.70931"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<image
width="525"
height="468.02328"
preserveAspectRatio="none"
xlink:href="../cad/output/ev3device-ev3.png"
id="image834"
x="0"
y="26.384924" />
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+89
View File
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg2"
width="525"
height="525"
viewBox="0 0 525 525"
sodipodi:docname="icon_nxthub.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
inkscape:export-filename="../diagrams/icon_nxthub.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath860">
<rect
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect862"
width="589.10107"
height="96.333336"
x="235.33333"
y="-236.00002" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1040">
<rect
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1042"
width="128.5101"
height="19.934668"
x="827.15656"
y="74.666672" />
</clipPath>
</defs>
<sodipodi:namedview
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1163"
id="namedview4"
showgrid="false"
inkscape:zoom="0.9950413"
inkscape:cx="301.49502"
inkscape:cy="344.70931"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-global="false"
inkscape:pagecheckerboard="false" />
<image
width="525"
height="447.39801"
preserveAspectRatio="none"
xlink:href="../cad/output/nxtdevice-nxt.png"
id="image960"
x="0"
y="34.809708" />
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+4 -4
View File
@@ -64,13 +64,13 @@ Motors
.. rubric:: Control settings
.. automethod:: pybricks.ev3devices.Motor.control.limits
.. automethod:: pybricks.ev3devices::Motor.control.limits
.. automethod:: pybricks.ev3devices.Motor.control.pid
.. automethod:: pybricks.ev3devices::Motor.control.pid
.. automethod:: pybricks.ev3devices.Motor.control.target_tolerances
.. automethod:: pybricks.ev3devices::Motor.control.target_tolerances
.. automethod:: pybricks.ev3devices.Motor.control.stall_tolerances
.. automethod:: pybricks.ev3devices::Motor.control.stall_tolerances
.. attribute:: control.scale
+4 -36
View File
@@ -8,7 +8,6 @@ City Hub
.. blockimg:: pybricks_variables_set_city_hub_option0
.. blockimg:: pybricks_variables_set_city_hub_option3
:stack:
.. autoclass:: pybricks.hubs.CityHub
:no-members:
@@ -27,20 +26,6 @@ City Hub
.. automethod:: pybricks.hubs::CityHub.light.animate
.. rubric:: Using connectionless Bluetooth messaging
.. blockimg:: pybricks_blockBleBroadcast_CityHub
.. automethod:: pybricks.hubs::CityHub.ble.broadcast
.. blockimg:: pybricks_blockBleObserve_CityHub
.. automethod:: pybricks.hubs::CityHub.ble.observe
.. automethod:: pybricks.hubs::CityHub.ble.signal_strength
.. automethod:: pybricks.hubs::CityHub.ble.version
.. rubric:: Using the battery
.. blockimg:: pybricks_blockBatteryMeasure_CityHub_battery.voltage
@@ -57,26 +42,26 @@ City Hub
.. automethod:: pybricks.hubs::CityHub.buttons.pressed
.. automethod:: pybricks.hubs::CityHub.system.info
.. blockimg:: pybricks_blockHubStopButton_CityHub
.. blockimg:: pybricks_blockHubStopButton_CityHub_none
:stack:
.. automethod:: pybricks.hubs::CityHub.system.set_stop_button
.. automethod:: pybricks.hubs::CityHub.system.name
.. automethod:: pybricks.hubs::CityHub.system.storage
You can store up to 128 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware or if you restore the original
firmware.
.. automethod:: pybricks.hubs::CityHub.system.reset_storage
.. blockimg:: pybricks_blockHubShutdown_CityHub
.. automethod:: pybricks.hubs::CityHub.system.shutdown
.. automethod:: pybricks.hubs::CityHub.system.reset_reason
Status light examples
---------------------
@@ -105,23 +90,6 @@ Creating light animations
.. literalinclude::
../../../examples/pup/hub_common/build/light_animate_cityhub.py
Bluetooth examples
------------------
Broadcasting data to other hubs
*******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_broadcast_cityhub.py
Observing data from other hubs
******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_observe_cityhub.py
Button and system examples
----------------------------------
+18 -38
View File
@@ -9,7 +9,6 @@ Essential Hub
.. blockimg:: pybricks_variables_set_essential_hub_option0
.. blockimg:: pybricks_variables_set_essential_hub_option4
:stack:
.. autoclass:: pybricks.hubs.EssentialHub
:no-members:
@@ -37,12 +36,18 @@ Essential Hub
.. blockimg:: pybricks_blockHubStopButton_EssentialHub
.. blockimg:: pybricks_blockHubStopButton_EssentialHub_none
:stack:
.. automethod:: pybricks.hubs::EssentialHub.system.set_stop_button
.. rubric:: Using the IMU
.. versionchanged:: 3.6
The methods below now return calibrated data by default. Depending on
the method used, this combines data from the accelerometer, gyroscope,
with your calibration values. Use ``calibrated=False`` where applicable
to get the raw data you got before.
.. blockimg:: pybricks_blockImuStatus_EssentialHub_ready
.. automethod:: pybricks.hubs::EssentialHub.imu.ready
@@ -58,7 +63,6 @@ Essential Hub
.. blockimg:: pybricks_blockTilt_EssentialHub_imu.tilt.pitch
.. blockimg:: pybricks_blockTilt_EssentialHub_imu.tilt.roll
:stack:
.. automethod:: pybricks.hubs::EssentialHub.imu.tilt
@@ -84,22 +88,14 @@ Essential Hub
.. automethod:: pybricks.hubs::EssentialHub.imu.orientation
.. blockimg:: pybricks_blockImuConfigure_EssentialHub_imu.settings_heading_correction
.. blockimg:: pybricks_blockImuConfigure_EssentialHub_imu.settings_angular_velocity_threshold
.. blockimg:: pybricks_blockImuConfigure_EssentialHub_imu.settings_acceleration_threshold
.. automethod:: pybricks.hubs::EssentialHub.imu.settings
.. rubric:: Using connectionless Bluetooth messaging
.. blockimg:: pybricks_blockBleBroadcast_EssentialHub
.. automethod:: pybricks.hubs::EssentialHub.ble.broadcast
.. blockimg:: pybricks_blockBleObserve_EssentialHub
.. automethod:: pybricks.hubs::EssentialHub.ble.observe
.. automethod:: pybricks.hubs::EssentialHub.ble.signal_strength
.. automethod:: pybricks.hubs::EssentialHub.ble.version
.. rubric:: Using the battery
.. blockimg:: pybricks_blockBatteryMeasure_EssentialHub_battery.voltage
@@ -120,18 +116,19 @@ Essential Hub
.. rubric:: System control
.. automethod:: pybricks.hubs::EssentialHub.system.name
.. automethod:: pybricks.hubs::EssentialHub.system.info
.. automethod:: pybricks.hubs::EssentialHub.system.storage
You can store up to 512 bytes of data on this hub.
You can store up to 512 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware.
.. automethod:: pybricks.hubs::EssentialHub.system.reset_storage
.. blockimg:: pybricks_blockHubShutdown_EssentialHub
.. automethod:: pybricks.hubs::EssentialHub.system.shutdown
.. automethod:: pybricks.hubs::EssentialHub.system.reset_reason
Status light examples
---------------------
@@ -193,23 +190,6 @@ Reading acceleration and angular velocity on one axis
.. literalinclude::
../../../examples/pup/hub_common/build/imu_read_scalar_essentialhub.py
Bluetooth examples
------------------
Broadcasting data to other hubs
*******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_broadcast_essentialhub.py
Observing data from other hubs
******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_observe_essentialhub.py
System examples
----------------------------------
+4 -38
View File
@@ -11,7 +11,6 @@ Move Hub
.. blockimg:: pybricks_variables_set_move_hub_option0
.. blockimg:: pybricks_variables_set_move_hub_option4
:stack:
.. autoclass:: pybricks.hubs.MoveHub
:no-members:
@@ -39,7 +38,6 @@ Move Hub
.. blockimg:: pybricks_blockTilt_MoveHub_imu.tilt.pitch
.. blockimg:: pybricks_blockTilt_MoveHub_imu.tilt.roll
:stack:
.. automethod:: pybricks.hubs::MoveHub.imu.tilt
@@ -51,20 +49,6 @@ Move Hub
Changed acceleration units from m/s² to mm/s².
.. rubric:: Using connectionless Bluetooth messaging
.. blockimg:: pybricks_blockBleBroadcast_PrimeHub
.. automethod:: pybricks.hubs::PrimeHub.ble.broadcast
.. blockimg:: pybricks_blockBleObserve_PrimeHub
.. automethod:: pybricks.hubs::PrimeHub.ble.observe
.. automethod:: pybricks.hubs::MoveHub.ble.signal_strength
.. automethod:: pybricks.hubs::MoveHub.ble.version
.. rubric:: Using the battery
.. blockimg:: pybricks_blockBatteryMeasure_MoveHub_battery.voltage
@@ -81,27 +65,26 @@ Move Hub
.. automethod:: pybricks.hubs::MoveHub.buttons.pressed
.. automethod:: pybricks.hubs::MoveHub.system.info
.. blockimg:: pybricks_blockHubStopButton_MoveHub
.. blockimg:: pybricks_blockHubStopButton_MoveHub_none
:stack:
.. automethod:: pybricks.hubs::MoveHub.system.set_stop_button
.. automethod:: pybricks.hubs::MoveHub.system.name
.. automethod:: pybricks.hubs::MoveHub.system.storage
You can store up to 128 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware or if you restore the original
firmware.
.. automethod:: pybricks.hubs::MoveHub.system.reset_storage
.. blockimg:: pybricks_blockHubShutdown_MoveHub
.. automethod:: pybricks.hubs::MoveHub.system.shutdown
.. automethod:: pybricks.hubs::MoveHub.system.reset_reason
Status light examples
---------------------
@@ -132,23 +115,6 @@ Reading acceleration
.. literalinclude::
../../../examples/pup/hub_movehub/imu_read_acceleration.py
Bluetooth examples
------------------
Broadcasting data to other hubs
*******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_broadcast_movehub.py
Observing data from other hubs
******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_observe_movehub.py
Button and system examples
----------------------------------
+22 -39
View File
@@ -9,7 +9,8 @@ Prime Hub / Inventor Hub
.. blockimg:: pybricks_variables_set_inventor_hub_option0
.. blockimg:: pybricks_variables_set_inventor_hub_option4
:stack:
.. currentmodule:: pybricks.hubs
.. class:: InventorHub
@@ -21,7 +22,6 @@ Prime Hub / Inventor Hub
.. blockimg:: pybricks_variables_set_prime_hub_option0
.. blockimg:: pybricks_variables_set_prime_hub_option4
:stack:
.. autoclass:: pybricks.hubs.PrimeHub
:no-members:
@@ -84,12 +84,18 @@ Prime Hub / Inventor Hub
.. blockimg:: pybricks_blockHubStopButton_PrimeHub
.. blockimg:: pybricks_blockHubStopButton_PrimeHub_none
:stack:
.. automethod:: pybricks.hubs::PrimeHub.system.set_stop_button
.. rubric:: Using the IMU
.. versionchanged:: 3.6
The methods below now return calibrated data by default. Depending on
the method used, this combines data from the accelerometer, gyroscope,
with your calibration values. Use ``calibrated=False`` where applicable
to get the raw data you got before.
.. blockimg:: pybricks_blockImuStatus_PrimeHub_ready
.. automethod:: pybricks.hubs::PrimeHub.imu.ready
@@ -105,7 +111,6 @@ Prime Hub / Inventor Hub
.. blockimg:: pybricks_blockTilt_PrimeHub_imu.tilt.pitch
.. blockimg:: pybricks_blockTilt_PrimeHub_imu.tilt.roll
:stack:
.. automethod:: pybricks.hubs::PrimeHub.imu.tilt
@@ -131,6 +136,12 @@ Prime Hub / Inventor Hub
.. automethod:: pybricks.hubs::PrimeHub.imu.orientation
.. blockimg:: pybricks_blockImuConfigure_PrimeHub_imu.settings_heading_correction
.. blockimg:: pybricks_blockImuConfigure_PrimeHub_imu.settings_angular_velocity_threshold
.. blockimg:: pybricks_blockImuConfigure_PrimeHub_imu.settings_acceleration_threshold
.. automethod:: pybricks.hubs::PrimeHub.imu.settings
.. rubric:: Using the speaker
@@ -141,20 +152,6 @@ Prime Hub / Inventor Hub
.. automethod:: pybricks.hubs::PrimeHub.speaker.play_notes
.. rubric:: Using connectionless Bluetooth messaging
.. blockimg:: pybricks_blockBleBroadcast_PrimeHub
.. automethod:: pybricks.hubs::PrimeHub.ble.broadcast
.. blockimg:: pybricks_blockBleObserve_PrimeHub
.. automethod:: pybricks.hubs::PrimeHub.ble.observe
.. automethod:: pybricks.hubs::PrimeHub.ble.signal_strength
.. automethod:: pybricks.hubs::PrimeHub.ble.version
.. rubric:: Using the battery
.. blockimg:: pybricks_blockBatteryMeasure_PrimeHub_battery.voltage
@@ -175,19 +172,22 @@ Prime Hub / Inventor Hub
.. rubric:: System control
.. automethod:: pybricks.hubs::PrimeHub.system.name
.. automethod:: pybricks.hubs::PrimeHub.system.info
.. automethod:: pybricks.hubs::PrimeHub.system.storage
You can store up to 512 bytes of data on this hub.
You can store up to 512 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware.
.. automethod:: pybricks.hubs::PrimeHub.system.reset_storage
.. blockimg:: pybricks_blockHubShutdown_PrimeHub
.. automethod:: pybricks.hubs::PrimeHub.system.shutdown
.. automethod:: pybricks.hubs::PrimeHub.system.reset_reason
.. note::
.. note:: The examples below use the ``PrimeHub`` class. The examples work fine
The examples below use the ``PrimeHub`` class. The examples work fine
on both hubs because they are the identical. If you prefer, you can
change this to ``InventorHub``.
@@ -317,23 +317,6 @@ Reading acceleration and angular velocity on one axis
.. literalinclude::
../../../examples/pup/hub_common/build/imu_read_scalar_primehub.py
Bluetooth examples
------------------
Broadcasting data to other hubs
*******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_broadcast_primehub.py
Observing data from other hubs
******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_observe_primehub.py
System examples
----------------------------------
+17 -38
View File
@@ -9,7 +9,6 @@ Technic Hub
.. blockimg:: pybricks_variables_set_technic_hub_option0
.. blockimg:: pybricks_variables_set_technic_hub_option4
:stack:
.. autoclass:: pybricks.hubs.TechnicHub
:no-members:
@@ -30,6 +29,13 @@ Technic Hub
.. rubric:: Using the IMU
.. versionchanged:: 3.6
The methods below now return calibrated data by default. Depending on
the method used, this combines data from the accelerometer, gyroscope,
with your calibration values. Use ``calibrated=False`` where applicable
to get the raw data you got before.
.. blockimg:: pybricks_blockImuStatus_TechnicHub_ready
.. automethod:: pybricks.hubs::TechnicHub.imu.ready
@@ -45,7 +51,6 @@ Technic Hub
.. blockimg:: pybricks_blockTilt_TechnicHub_imu.tilt.pitch
.. blockimg:: pybricks_blockTilt_TechnicHub_imu.tilt.roll
:stack:
.. automethod:: pybricks.hubs::TechnicHub.imu.tilt
@@ -71,22 +76,14 @@ Technic Hub
.. automethod:: pybricks.hubs::TechnicHub.imu.orientation
.. blockimg:: pybricks_blockImuConfigure_TechnicHub_imu.settings_heading_correction
.. blockimg:: pybricks_blockImuConfigure_TechnicHub_imu.settings_angular_velocity_threshold
.. blockimg:: pybricks_blockImuConfigure_TechnicHub_imu.settings_acceleration_threshold
.. automethod:: pybricks.hubs::TechnicHub.imu.settings
.. rubric:: Using connectionless Bluetooth messaging
.. blockimg:: pybricks_blockBleBroadcast_TechnicHub
.. automethod:: pybricks.hubs::TechnicHub.ble.broadcast
.. blockimg:: pybricks_blockBleObserve_TechnicHub
.. automethod:: pybricks.hubs::TechnicHub.ble.observe
.. automethod:: pybricks.hubs::TechnicHub.ble.signal_strength
.. automethod:: pybricks.hubs::TechnicHub.ble.version
.. rubric:: Using the battery
.. blockimg:: pybricks_blockBatteryMeasure_TechnicHub_battery.voltage
@@ -103,27 +100,26 @@ Technic Hub
.. automethod:: pybricks.hubs::TechnicHub.buttons.pressed
.. automethod:: pybricks.hubs::TechnicHub.system.info
.. blockimg:: pybricks_blockHubStopButton_TechnicHub
.. blockimg:: pybricks_blockHubStopButton_TechnicHub_none
:stack:
.. automethod:: pybricks.hubs::TechnicHub.system.set_stop_button
.. automethod:: pybricks.hubs::TechnicHub.system.name
.. automethod:: pybricks.hubs::TechnicHub.system.storage
You can store up to 128 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware or if you restore the original
firmware.
.. automethod:: pybricks.hubs::TechnicHub.system.reset_storage
.. blockimg:: pybricks_blockHubShutdown_TechnicHub
.. automethod:: pybricks.hubs::TechnicHub.system.shutdown
.. automethod:: pybricks.hubs::TechnicHub.system.reset_reason
Status light examples
---------------------
@@ -185,23 +181,6 @@ Reading acceleration and angular velocity on one axis
.. literalinclude::
../../../examples/pup/hub_common/build/imu_read_scalar_technichub.py
Bluetooth examples
------------------
Broadcasting data to other hubs
*******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_broadcast_technichub.py
Observing data from other hubs
******************************
.. literalinclude::
../../../examples/pup/hub_common/build/ble_observe_technichub.py
Button and system examples
----------------------------------
+1
View File
@@ -60,6 +60,7 @@ above to reveal this menu.
parameters/index
tools/index
robotics
messaging/index
signaltypes
.. toctree::
+3 -5
View File
@@ -1,10 +1,8 @@
EV3 Analog Sensor
.. pybricks-requirements:: pybricks-iodevices ev3
Analog Sensor
^^^^^^^^^^^^^^^^^
.. note::
This class is only available on EV3.
.. figure:: ../../main/cad/output/iodevice-rj12brown.png
:width: 25 %
+12 -7
View File
@@ -1,20 +1,25 @@
EV3 DC Motor
DC Motor
^^^^^^^^^^^^^^^^^^
.. note::
This class is specifically for EV3 and NXT. This lets you drive motors that
are not automatically detected as motors. This includes RCX motors and Power
Function motors that are connected via the official converter cables. Note:
Applying motor power to custom electronics may damage the hub or the device.
This class is specifically for on EV3. For Powered Up DC Motors, just use
the :class:`DCMotor <pybricks.pupdevices.DCMotor>` class.
For Powered Up DC Motors, just use
the :class:`DCMotor <pybricks.pupdevices.DCMotor>` class instead, which will
automatically detect the motor and use the correct and safe settings.
.. figure:: ../../main/cad/output/iodevice-dcmotor.png
:width: 40 %
.. autoclass:: pybricks.iodevices.DCMotor
:noindex:
:no-members:
.. automethod:: pybricks.iodevices.DCMotor.dc
:noindex:
.. automethod:: pybricks.iodevices.DCMotor.brake
.. automethod:: pybricks.iodevices.DCMotor.stop
:noindex:
.. automethod:: pybricks.iodevices.DCMotor.settings
-60
View File
@@ -1,60 +0,0 @@
Ev3dev sensors
^^^^^^^^^^^^^^^^^^
.. note::
This class is only available on EV3.
.. figure:: ../../main/cad/output/iodevice-rj12pcbbox.png
:width: 30 %
EV3 MicroPython is built on top of ev3dev, which means that a sensor
may be supported even if it is not listed in this documentation. If so, you can
use it with the ``Ev3devSensor`` class. This is easier and faster than using
the custom device classes given above.
To check whether you can use the ``Ev3devSensor`` class:
* Plug the sensor into your EV3 Brick.
* Go to the main menu of the EV3 Brick.
* Select `Device Browser` and then `Sensors`.
* If your sensor shows up, you can use it.
Now select your sensor from the menu and choose `set mode`. This shows all
available modes for this sensor. You can use these mode names as the ``mode``
setting below.
To learn more about compatible devices and what each mode does,
visit the `ev3dev sensors`_ page.
.. autoclass:: pybricks.iodevices.Ev3devSensor
:no-members:
.. autoattribute:: pybricks.iodevices.Ev3devSensor.sensor_index
:annotation:
.. autoattribute:: pybricks.iodevices.Ev3devSensor.port_index
:annotation:
.. automethod:: pybricks.iodevices.Ev3devSensor.read
**Example: Reading values with the Ev3devSensor class**
In this example we use the LEGO MINDSTORMS EV3 Color Sensor with the raw
RGB mode. This gives uncalibrated red, green, and blue reflection values.
.. literalinclude::
../../../examples/ev3/ev3devsensor/main.py
**Example: Extending the Ev3devSensor class**
This example shows how to extend the ``Ev3devSensor`` class by accessing
additional features found in the Linux system folder for this device.
.. literalinclude::
../../../examples/ev3/ev3devsensor/class_example.py
.. _ev3dev sensors: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensors.html
.. _Mode name: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensor_data.html
.. _lego-sensor: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensors.html#the-lego-sensor-subsytem
.. _lego-port: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/ports.html#the-lego-port-subsystem
+2 -8
View File
@@ -1,14 +1,8 @@
Generic I2C Device
^^^^^^^^^^^^^^^^^^
.. note::
This class is **only supported on the EV3** at this time. It could be added
to Powered Up hubs in a future release. If you'd like to see this happen, be
sure to ask us on our `support page`_.
.. _support page: https://github.com/pybricks/support/issues/
EV3 and NXT support connecting generic I2C devices to the hub.
See :doc:`pinout here <uartdevice>`.
.. figure:: ../../main/cad/output/iodevice-rj12cyan.png
:width: 25 %
+86 -12
View File
@@ -1,25 +1,39 @@
.. pybricks-requirements:: pybricks-iodevices
:mod:`iodevices <pybricks.iodevices>` -- Custom devices
============================================================
.. module:: pybricks.iodevices
This module has classes for generic and custom input/output devices.
Wireless devices
----------------
.. toctree::
:maxdepth: 1
:hidden:
pupdevice
lwp3device
xboxcontroller
This module has classes for generic and custom input/output devices.
.. pybricks-requirements:: pybricks-iodevices
.. pybricks-classlink:: PUPDevice
.. pybricks-classlink:: XboxController
.. figure:: ../../main/cad/output/iodevice-pupdevice.png
:width: 50 %
:target: pupdevice.html
.. figure:: ../../main/diagrams_source/xboxcontroller.png
:width: 40 %
:target: xboxcontroller.html
LEGO protocol devices
---------------------
.. toctree::
:maxdepth: 1
:hidden:
lwp3device
lumpdevice
pupdevice
.. pybricks-requirements:: pybricks-iodevices
.. pybricks-classlink:: LWP3Device
@@ -27,8 +41,68 @@ This module has classes for generic and custom input/output devices.
:width: 80 %
:target: lwp3device.html
.. pybricks-classlink:: XboxController
.. pybricks-requirements:: ev3 pybricks-iodevices
.. figure:: ../../main/diagrams_source/xboxcontroller.png
.. pybricks-classlink:: LUMPDevice
.. figure:: ../../main/cad/output/iodevice-rj12green.png
:width: 20 %
:target: lumpdevice.html
.. pybricks-requirements:: pybricks-iodevices
.. pybricks-classlink:: PUPDevice
.. figure:: ../../main/cad/output/iodevice-pupdevice.png
:width: 50 %
:target: pupdevice.html
Generic protocols
-----------------
.. toctree::
:maxdepth: 1
:hidden:
uartdevice
i2cdevice
analogsensor
dcmotor
.. pybricks-requirements:: pybricks-iodevices
.. pybricks-classlink:: UARTDevice
.. |uart-wired| image:: ../../main/cad/output/iodevice-rj12grey.png
:width: 20 %
:target: uartdevice.html
.. |uart-wireless| image:: ../../main/cad/output/iodevice-pupdevice.png
:width: 50 %
:target: uartdevice.html
|uart-wired| |uart-wireless|
.. pybricks-requirements:: ev3 pybricks-iodevices
.. pybricks-classlink:: I2CDevice
.. figure:: ../../main/cad/output/iodevice-rj12cyan.png
:width: 20 %
:target: i2cdevice.html
.. pybricks-requirements:: ev3 pybricks-iodevices
.. pybricks-classlink:: AnalogSensor
.. figure:: ../../main/cad/output/iodevice-rj12brown.png
:width: 20 %
:target: analogsensor.html
.. pybricks-requirements:: ev3 pybricks-iodevices
.. pybricks-classlink:: DCMotor
.. figure:: ../../main/cad/output/iodevice-dcmotor.png
:width: 40 %
:target: xboxcontroller.html
:target: dcmotor.html
+3 -4
View File
@@ -1,11 +1,10 @@
.. pybricks-requirements:: pybricks-iodevices ev3
EV3 UART Device
^^^^^^^^^^^^^^^^^
.. note::
This class is only available on EV3.
.. figure:: ../../main/cad/output/iodevice-rj12green.png
:width: 25 %
.. autoclass:: pybricks.iodevices.LUMPDevice
:no-members:
+2 -5
View File
@@ -1,11 +1,8 @@
.. pybricks-requirements:: pybricks-iodevices
LEGO Wireless Protocol v3 device
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning::
This is an experimental class. It has not been well tested and may be
changed in future.
.. figure:: ../../main/cad/output/hub-lwp3.png
:width: 80 %
Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

+2
View File
@@ -15,6 +15,8 @@ Powered Up Device
.. automethod:: pybricks.iodevices.PUPDevice.write
.. automethod:: pybricks.iodevices.PUPDevice.reset
Examples
-------------------
+38 -7
View File
@@ -1,16 +1,47 @@
.. pybricks-requirements:: pybricks-iodevices
Generic UART Device
^^^^^^^^^^^^^^^^^^^
.. note::
Powered Up and EV3 support connecting generic UART devices to the hub. The pinout
is shown below. Note the orientation of the connector. For EV3, the internal
wire colors match those on the diagram below.
This class is **only supported on the EV3** at this time. It could be added
to Powered Up hubs in a future release. If you'd like to see this happen,
be sure to ask us on our `support page`_.
.. image:: pinout_numbered.jpg
:width: 50 %
.. _support page: https://github.com/pybricks/support/issues/
.. list-table::
:header-rows: 1
* - Pin
- Powered Up (UART)
- EV3 (UART sensor)
- EV3 (I2C sensor)
* - 1 (white)
- Motor Terminal 1
- Optional battery power
- Optional battery power
* - 2 (black)
- Motor Terminal 2
- N/A
- N/A
* - 3 (red)
- Ground
- Ground
- Ground
* - 4 (green)
- VCC (3.3 V)
- VCC (5 V)
- VCC (5 V)
* - 5 (yellow)
- Hub TX (Sensor RX) (3.3 V)
- Hub TX (Sensor RX) (3.3 V)
- SCL (master) (3.3 V)
* - 6 (blue)
- Hub RX (Sensor TX) (3.3 V)
- Hub RX (Sensor TX) (3.3 V)
- SDA (master) (3.3 V)
.. figure:: ../../main/cad/output/iodevice-rj12grey.png
:width: 25 %
.. autoclass:: pybricks.iodevices.UARTDevice
+9 -8
View File
@@ -11,6 +11,12 @@ Xbox Controller
.. autoclass:: pybricks.iodevices.XboxController
:no-members:
.. automethod:: pybricks.iodevices::XboxController.connect
.. automethod:: pybricks.iodevices::XboxController.disconnect
.. automethod:: pybricks.iodevices::XboxController.name
.. blockimg:: pybricks_blockButtonIsPressed_XboxController
.. automethod:: pybricks.iodevices::XboxController.buttons.pressed
@@ -30,21 +36,18 @@ Xbox Controller
.. blockimg:: pybricks_blockJoystickValue_lj_x
.. blockimg:: pybricks_blockJoystickValue_lj_y
:stack:
.. automethod:: pybricks.iodevices::XboxController.joystick_left
.. blockimg:: pybricks_blockJoystickValue_rj_x
.. blockimg:: pybricks_blockJoystickValue_rj_y
:stack:
.. automethod:: pybricks.iodevices::XboxController.joystick_right
.. blockimg:: pybricks_blockJoystickValue_lt
.. blockimg:: pybricks_blockJoystickValue_rt
:stack:
.. automethod:: pybricks.iodevices::XboxController.triggers
@@ -59,17 +62,15 @@ Xbox Controller
.. blockimg:: pybricks_blockGamepadRumble_default
.. blockimg:: pybricks_blockGamepadRumble_default_with_list
:stack:
.. blockimg:: pybricks_blockGamepadRumble_with_options
:stack:
.. automethod:: pybricks.iodevices::XboxController.rumble
.. _xbox-controller-pairing:
Xbox Controller Pairing Instructions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
====================================
The first time you use a controller with a hub, you will need to pair
them: Turn the controller on and then press and hold the pairing
button on the back of the controller for a few seconds. When you release
@@ -79,7 +80,7 @@ When pairing and the connection is succesful, the Xbox button will stop
flashing and stay on for as long as the program is running.
Repeat Connections
==================
------------------
If you keep using the same controller with the same hub, you can simply
turn the controller on the next time and the hub will connect to it
@@ -91,7 +92,7 @@ connect to another hub, you will need to pair them again as described
above.
Compatible Controllers
============================
----------------------
All Xbox controllers released since 2016 are compatible. This includes the
controller from the One S (``1708`` from 2016), the Elite Series 2 (``1797``
+44
View File
@@ -0,0 +1,44 @@
:mod:`messaging <pybricks.messaging>` -- Send and receive messages
==================================================================
.. automodule:: pybricks.messaging
:no-members:
.. pybricks-requirements:: pup
.. autoclass:: pybricks.messaging.BLERadio
:no-members:
.. automethod:: pybricks.messaging.BLERadio.broadcast
.. automethod:: pybricks.messaging.BLERadio.observe
.. automethod:: pybricks.messaging.BLERadio.signal_strength
.. automethod:: pybricks.messaging.BLERadio.version
.. autoclass:: pybricks.messaging.AppData
:no-members:
.. automethod:: pybricks.messaging.AppData.get_bytes
.. automethod:: pybricks.messaging.AppData.write_bytes
.. automethod:: pybricks.messaging.AppData.configure
.. automethod:: pybricks.messaging.AppData.close
BLERadio examples
------------------
Broadcasting data to other hubs
*******************************
.. literalinclude::
../../../examples/pup/ble_radio/ble_broadcast.py
Observing data from other hubs
******************************
.. literalinclude::
../../../examples/pup/ble_radio/ble_observe.py
+2 -18
View File
@@ -79,52 +79,36 @@ Sequences
.. pybricks-requirements::
.. blockimg:: pybricks_blockListCreate_list_empty
:stack:
.. blockimg:: pybricks_blockListCreate_list_3
:stack:
.. blockimg:: pybricks_blockListUnpack
:stack:
.. blockimg:: pybricks_blockListGet_list_get_first
:stack:
.. blockimg:: pybricks_blockListGet_list_get_index
:stack:
.. blockimg:: pybricks_blockListGet_list_get_last
:stack:
.. blockimg:: pybricks_blockListGet_list_get_random
:stack:
.. blockimg:: pybricks_blockListSet_list_insert_first
:stack:
.. blockimg:: pybricks_blockListSet_list_insert_index
:stack:
.. blockimg:: pybricks_blockListSet_list_insert_last
:stack:
.. blockimg:: pybricks_blockListSet_list_remove_first
:stack:
.. blockimg:: pybricks_blockListSet_list_remove_index
:stack:
.. blockimg:: pybricks_blockListSet_list_remove_last
:stack:
.. blockimg:: pybricks_blockListSet_list_set_first
:stack:
.. blockimg:: pybricks_blockListSet_list_set_index
:stack:
.. blockimg:: pybricks_blockListSet_list_set_last
:stack:
.. autoclass:: ubuiltins.list
@@ -262,11 +246,11 @@ See also :mod:`umath` for floating point math operations.
Runtime functions
-------------------------
.. pybricks-requirements::
.. pybricks-requirements:: stm32-extra
.. autofunction:: ubuiltins.eval
.. pybricks-requirements::
.. pybricks-requirements:: stm32-extra
.. autofunction:: ubuiltins.exec
-1
View File
@@ -54,7 +54,6 @@ This section lists all available exceptions in alphabetical order.
.. _OSError:
.. autoclass:: ubuiltins.OSError
:noindex:
.. autoclass:: ubuiltins.OverflowError
:no-members:
+9
View File
@@ -6,5 +6,14 @@ Axis
.. autoclass:: pybricks.parameters.Axis
:no-members:
.. autoattribute:: pybricks.parameters.Axis.X
:annotation: = vector(1, 0, 0)
.. autoattribute:: pybricks.parameters.Axis.Y
:annotation: = vector(0, 1, 0)
.. autoattribute:: pybricks.parameters.Axis.Z
:annotation: = vector(0, 0, 1)
On Move Hub, doing math with these vectors is not supported. The axes can still
be used to set up the hub orientation.
+2
View File
@@ -3,6 +3,8 @@
Button
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. currentmodule:: pybricks.parameters
.. class:: Button
.. rubric:: Remote and hub buttons
+2
View File
@@ -3,6 +3,8 @@
Direction
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. currentmodule:: pybricks.parameters
.. class:: Direction
Rotational direction for positive speed or angle values.
+2
View File
@@ -3,6 +3,8 @@
Port
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. currentmodule:: pybricks.parameters
.. class:: Port
Input and output ports:
+2
View File
@@ -3,6 +3,8 @@
Side
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. currentmodule:: pybricks.parameters
.. class:: Side
Side of a hub or a sensor. These devices are
+2
View File
@@ -3,6 +3,8 @@
Stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. currentmodule:: pybricks.parameters
.. class:: Stop
Action after the motor stops.
-1
View File
@@ -42,7 +42,6 @@ Color Sensor
.. blockimg:: pybricks_blockLightOn_colorsensor_on
.. blockimg:: pybricks_blockLightOn_colorsensor_on_list
:stack:
.. automethod:: pybricks.pupdevices::ColorSensor.lights.on
-4
View File
@@ -21,20 +21,16 @@ Motors without rotation sensors
.. blockimg:: pybricks_blockMotorDuty_DCMotor
.. automethod:: pybricks.pupdevices.DCMotor.dc
:noindex:
.. blockimg:: pybricks_blockMotorStop_DCMotor_coast
.. automethod:: pybricks.pupdevices.DCMotor.stop
:noindex:
.. blockimg:: pybricks_blockMotorStop_DCMotor_brake
.. automethod:: pybricks.pupdevices.DCMotor.brake
:noindex:
.. automethod:: pybricks.pupdevices.DCMotor.settings
:noindex:
Examples
-------------------
+23
View File
@@ -0,0 +1,23 @@
.. pybricks-requirements:: pybricks-iodevices ble-extra
Duplo Train
^^^^^^^^^^^
.. autoclass:: pybricks.pupdevices.DuploTrain
:no-members:
.. automethod:: pybricks.pupdevices::DuploTrain.connect
.. automethod:: pybricks.pupdevices::DuploTrain.disconnect
.. automethod:: pybricks.pupdevices::DuploTrain.name
.. automethod:: pybricks.pupdevices::DuploTrain.drive
.. automethod:: pybricks.pupdevices::DuploTrain.headlights
.. automethod:: pybricks.pupdevices::DuploTrain.sound
.. automethod:: pybricks.pupdevices::DuploTrain.speed
.. automethod:: pybricks.pupdevices::DuploTrain.color
+15
View File
@@ -22,6 +22,9 @@
colorlightmatrix
light
remote
technicmovehub
mariohub
duplotrain
.. pybricks-classlink:: DCMotor
@@ -94,3 +97,15 @@
.. figure:: ../../main/cad/output/pupdevice-remote.png
:width: 50 %
:target: remote.html
.. pybricks-requirements:: pybricks-iodevices ble-extra
.. pybricks-classlink:: TechnicMoveHub
.. pybricks-requirements:: pybricks-iodevices ble-extra
.. pybricks-classlink:: MarioHub
.. pybricks-requirements:: pybricks-iodevices ble-extra
.. pybricks-classlink:: DuploTrain
+17
View File
@@ -0,0 +1,17 @@
.. pybricks-requirements:: pybricks-iodevices ble-extra
Mario Hub
^^^^^^^^^
.. autoclass:: pybricks.pupdevices.MarioHub
:no-members:
.. automethod:: pybricks.pupdevices::MarioHub.connect
.. automethod:: pybricks.pupdevices::MarioHub.disconnect
.. automethod:: pybricks.pupdevices::MarioHub.color
.. automethod:: pybricks.pupdevices::MarioHub.hsv
.. automethod:: pybricks.pupdevices::MarioHub.detectable_colors
+6 -8
View File
@@ -105,26 +105,24 @@ Motors with rotation sensors
.. blockimg:: pybricks_blockMotorConfigure_motor_max_speed
.. blockimg:: pybricks_blockMotorConfigure_motor_acceleration
:stack:
.. blockimg:: pybricks_blockMotorConfigure_motor_max_torque
:stack:
.. automethod:: pybricks.pupdevices.Motor.control.limits
.. automethod:: pybricks.pupdevices::Motor.control.limits
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.control.pid
.. automethod:: pybricks.pupdevices::Motor.control.pid
.. pybricks-requirements:: pybricks-common-control
.. blockimg:: pybricks_blockMotorConfigure_motor_target_tolerances
.. automethod:: pybricks.pupdevices.Motor.control.target_tolerances
.. automethod:: pybricks.pupdevices::Motor.control.target_tolerances
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.control.stall_tolerances
.. automethod:: pybricks.pupdevices::Motor.control.stall_tolerances
.. pybricks-requirements:: pybricks-common-control
@@ -141,11 +139,11 @@ Motors with rotation sensors
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.model.state
.. automethod:: pybricks.pupdevices::Motor.model.state
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.model.settings
.. automethod:: pybricks.pupdevices::Motor.model.settings
Initialization examples
-----------------------
-4
View File
@@ -21,23 +21,19 @@ and ambient conditions.
.. blockimg:: pybricks_variables_set_pf_motor
.. autoclass:: pybricks.pupdevices.PFMotor
:noindex:
:no-members:
.. blockimg:: pybricks_blockMotorDuty_PFMotor
.. automethod:: pybricks.pupdevices.PFMotor.dc
:noindex:
.. blockimg:: pybricks_blockMotorStop_PFMotor_coast
.. automethod:: pybricks.pupdevices.PFMotor.stop
:noindex:
.. blockimg:: pybricks_blockMotorStop_PFMotor_brake
.. automethod:: pybricks.pupdevices.PFMotor.brake
:noindex:
Examples
-------------------
+2 -1
View File
@@ -9,11 +9,12 @@ Remote Control
.. blockimg:: pybricks_variables_set_remote_connect_any
.. blockimg:: pybricks_variables_set_remote_connect_name
:stack:
.. autoclass:: pybricks.pupdevices.Remote
:no-members:
.. automethod:: pybricks.pupdevices::Remote.connect
.. automethod:: pybricks.pupdevices::Remote.name
.. blockimg:: pybricks_blockLightOnColor_remote_on
+13
View File
@@ -0,0 +1,13 @@
.. pybricks-requirements:: pybricks-iodevices ble-extra
Technic Move Hub
^^^^^^^^^^^^^^^^
.. autoclass:: pybricks.pupdevices.TechnicMoveHub
:no-members:
.. automethod:: pybricks.pupdevices::TechnicMoveHub.connect
.. automethod:: pybricks.pupdevices::TechnicMoveHub.disconnect
.. automethod:: pybricks.pupdevices::TechnicMoveHub.drive
-1
View File
@@ -14,7 +14,6 @@ Tilt Sensor
.. blockimg:: pybricks_blockTilt_TiltSensor_imu.tilt.pitch
.. blockimg:: pybricks_blockTilt_TiltSensor_imu.tilt.roll
:stack:
.. automethod:: tilt
-1
View File
@@ -25,7 +25,6 @@ Ultrasonic Sensor
.. blockimg:: pybricks_blockLightOn_ultrasonicsensor_on
.. blockimg:: pybricks_blockLightOn_ultrasonicsensor_on_list
:stack:
.. automethod:: pybricks.pupdevices::UltrasonicSensor.lights.on
+17 -3
View File
@@ -27,9 +27,15 @@
.. automethod:: pybricks.robotics.DriveBase.turn
.. blockimg:: pybricks_blockDriveBaseDrive_drivebase_drive_curve
.. blockimg:: pybricks_blockDriveBaseDrive2_drivebase_drive_arc_angle
.. automethod:: pybricks.robotics.DriveBase.curve
.. blockimg:: pybricks_blockDriveBaseDrive2_drivebase_drive_arc_distance
.. automethod:: pybricks.robotics.DriveBase.arc
.. pybricks-requirements:: stm32-float
.. automethod:: pybricks.robotics.DriveBase.move_by
.. blockimg:: pybricks_blockDriveBaseConfigure_drivebase_straight_speed
@@ -65,6 +71,8 @@
.. blockimg:: pybricks_blockDriveBaseStop_hold
.. automethod:: pybricks.robotics.DriveBase.hold
.. rubric:: Measuring
.. blockimg:: pybricks_blockDriveBaseMeasure_drivebase_get_distance
@@ -81,6 +89,12 @@
.. automethod:: pybricks.robotics.DriveBase.state
.. versionchanged:: 3.6
Now stops the drive base. You can now use nonzero values.
.. blockimg:: pybricks_blockDriveBaseResetWithValues
.. automethod:: pybricks.robotics.DriveBase.reset
.. automethod:: pybricks.robotics.DriveBase.stalled
@@ -114,7 +128,7 @@
``then=Stop.COAST`` in your last
:meth:`straight <pybricks.robotics.DriveBase.straight>`,
:meth:`turn <pybricks.robotics.DriveBase.turn>`, or
:meth:`curve <pybricks.robotics.DriveBase.curve>` command.
:meth:`curve <pybricks.robotics.DriveBase.arc>` command.
.. _measuring:
+1 -1
View File
@@ -291,5 +291,5 @@ though the *hub* accelerates backward.
How to configure the ``top_side`` and ``front_side`` settings for three
different robot designs. The same technique can be applied to other hubs
and other creations, by noting which way the top and
front :class:`Side <Side>` of the hub are pointing. The example
front :class:`Side <pybricks.parameters.Side>` of the hub are pointing. The example
on the left is the default configuration.
-3
View File
@@ -40,13 +40,10 @@ Input tools
.. blockimg:: pybricks_blockReadInput_read_input_first_byte
.. blockimg:: pybricks_blockReadInput_read_input_first_char
:stack:
.. blockimg:: pybricks_blockReadInput_read_input_last_byte
:stack:
.. blockimg:: pybricks_blockReadInput_read_input_last_char
:stack:
.. autofunction:: pybricks.tools.read_input_byte
+1 -1
View File
@@ -10,7 +10,7 @@ ev3 = EV3Brick()
device = I2CDevice(Port.S2, 0xD2 >> 1)
# Recommended for reading
(result,) = device.read(reg=0x0F, length=1)
result = device.read(reg=0x0F, length=1)
# Read 1 byte from no particular register:
device.read(reg=None, length=1)
@@ -1,11 +1,10 @@
# ThisHub = MoveHub CityHub TechnicHub PrimeHub EssentialHub
from pybricks.hubs import ThisHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Port
from pybricks.tools import wait
from pybricks.messaging import BLERadio
# Initialize the hub.
hub = ThisHub(broadcast_channel=1)
radio = BLERadio(broadcast_channel=1)
# Initialize the motors.
left_motor = Motor(Port.A)
@@ -18,7 +17,7 @@ while True:
# Set the broadcast data and start broadcasting if not already doing so.
data = (left_angle, right_angle)
hub.ble.broadcast(data)
radio.broadcast(data)
# Broadcasts are only sent every 100 milliseconds, so there is no reason
# to call the broadcast() method more often than that.
@@ -1,11 +1,10 @@
# ThisHub = MoveHub CityHub TechnicHub PrimeHub EssentialHub
from pybricks.hubs import ThisHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Color, Port
from pybricks.parameters import Port
from pybricks.tools import wait
from pybricks.messaging import BLERadio
# Initialize the hub.
hub = ThisHub(observe_channels=[1])
radio = BLERadio(observe_channels=[1])
# Initialize the motors.
left_motor = Motor(Port.A)
@@ -14,17 +13,12 @@ right_motor = Motor(Port.B)
while True:
# Receive broadcast from the other hub.
data = hub.ble.observe(1)
data = radio.observe(1)
if data is None:
# No data has been received in the last 1 second.
hub.light.on(Color.RED)
else:
if data is not None:
# Data was received and is less that one second old.
hub.light.on(Color.GREEN)
# *data* contains the same values in the same order
# that were passed to hub.ble.broadcast() on the
# It contains the same values in the same order
# that were passed to radio.broadcast() on the
# other hub.
left_angle, right_angle = data
+1 -1
View File
@@ -12,7 +12,7 @@ wait(1500)
example_motor.stop()
wait(1500)
# Run at 70% duty cycle ("power") and then stop by coasting.
# Run at 50% duty cycle ("power") and then stop by coasting.
print("Demo of dc")
example_motor.dc(50)
wait(1500)
+5
View File
@@ -4,6 +4,11 @@
## Unreleased
## 1.17.0 - 2025-02-26
### Changed
- Updated `pybricks` package to v3.5.0b5.
## 1.16.0 - 2024-04-05
### Changed
+37 -23
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# Builds the @pybricks/jedi npm package into npm-build/.
import email.parser
import json
@@ -6,18 +7,27 @@ import pathlib
import shutil
import subprocess
import sys
import tomllib
import zipfile
BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <version>", file=sys.stderr)
sys.exit(1)
VERSION = sys.argv[1]
ROOT_DIR = pathlib.Path(__file__).parent.resolve()
REPO_ROOT_DIR = (ROOT_DIR / "..").resolve()
BUILD_DIR = ROOT_DIR / "npm-build"
package_json = {
"name": "@pybricks/jedi",
"version": "1.16.0",
"version": VERSION,
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
"repository": {
"type": "git",
"url": "https://github.com/pybricks/pybricks-api",
"directory": "npm/jedi",
"url": "git+https://github.com/pybricks/pybricks-api.git",
"directory": "jedi",
},
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
}
@@ -30,16 +40,28 @@ whl_map: dict[str, str] = {}
shutil.rmtree(BUILD_DIR, True)
BUILD_DIR.mkdir()
# download package and dependencies (*.whl files)
# build pybricks api wheel from local source so pip uses it instead of fetching from PyPI
subprocess.check_call(["poetry", "build", "--format=wheel"], cwd=REPO_ROOT_DIR)
# copy locally built pybricks wheel to build dir
for whl in (REPO_ROOT_DIR / "dist").glob("pybricks-*.whl"):
shutil.copy(whl, BUILD_DIR)
# build pybricks-jedi wheel from local source
subprocess.check_call(["poetry", "build", "--format=wheel"], cwd=ROOT_DIR)
# copy locally built wheel to build dir
for whl in (ROOT_DIR / "dist").glob("pybricks_jedi-*.whl"):
shutil.copy(whl, BUILD_DIR)
# download transitive dependencies using versions pinned in poetry.lock
transitive_packages = ["jedi", "parso", "docstring-parser", "typing-extensions"]
with open(ROOT_DIR / "poetry.lock", "rb") as f:
lock = tomllib.load(f)
lock_versions = {pkg["name"]: pkg["version"] for pkg in lock["package"]}
transitive = [f"{pkg}=={lock_versions[pkg]}" for pkg in transitive_packages]
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"download",
"--only-binary=any",
"pybricks-jedi==1.16.0",
],
[sys.executable, "-m", "pip", "download", "--only-binary=any"] + transitive,
cwd=BUILD_DIR,
)
@@ -79,13 +101,8 @@ for whl in BUILD_DIR.glob("*.whl"):
license_identifiers.add(license)
# TODO: The LICENSE workaround for the pybricks-jedi package can be
# dropped after the next release of that package
if whl.name.startswith("pybricks_jedi-"):
LICENSE = (
pathlib.Path(__file__).parent.parent.parent / "jedi" / "LICENSE"
).resolve()
with open(LICENSE) as lf:
with open(ROOT_DIR / "LICENSE") as lf:
license_text[whl.name] = lf.read()
else:
try:
@@ -126,7 +143,4 @@ with open(BUILD_DIR / "LICENSE", "w") as f:
# copy additional files
ROOT_DIR = (pathlib.Path(__file__).parent).resolve()
for file in "README.md", "CHANGELOG.md":
shutil.copy(ROOT_DIR / file, BUILD_DIR / file)
shutil.copy(ROOT_DIR / "README.md", BUILD_DIR / "README.md")
+82 -48
View File
@@ -1,12 +1,12 @@
# This file is automatically @generated by Poetry and should not be changed by hand.
# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand.
[[package]]
name = "black"
version = "22.12.0"
description = "The uncompromising code formatter."
category = "dev"
optional = false
python-versions = ">=3.7"
groups = ["dev"]
files = [
{file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"},
{file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"},
@@ -37,14 +37,14 @@ uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "click"
version = "8.1.7"
version = "8.1.8"
description = "Composable command line interface toolkit"
category = "dev"
optional = false
python-versions = ">=3.7"
groups = ["dev"]
files = [
{file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
{file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"},
{file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"},
{file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"},
]
[package.dependencies]
@@ -54,9 +54,10 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "dev"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
groups = ["dev"]
markers = "sys_platform == \"win32\" or platform_system == \"Windows\""
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
@@ -66,9 +67,9 @@ files = [
name = "docstring-parser"
version = "0.14.1"
description = "Parse Python docstrings in reST, Google and Numpydoc format"
category = "main"
optional = false
python-versions = ">=3.6,<4.0"
groups = ["main"]
files = [
{file = "docstring_parser-0.14.1-py3-none-any.whl", hash = "sha256:14ac6ec1f1ba6905c4d8cb90fd0bc55394f5678183752c90e44812bf28d7a515"},
{file = "docstring_parser-0.14.1.tar.gz", hash = "sha256:2c77522e31b7c88b1ab457a1f3c9ae38947ad719732260ba77ee8a3deb58622a"},
@@ -76,14 +77,15 @@ files = [
[[package]]
name = "exceptiongroup"
version = "1.2.0"
version = "1.2.2"
description = "Backport of PEP 654 (exception groups)"
category = "dev"
optional = false
python-versions = ">=3.7"
groups = ["dev"]
markers = "python_version == \"3.10\""
files = [
{file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"},
{file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"},
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
]
[package.extras]
@@ -93,9 +95,9 @@ test = ["pytest (>=6)"]
name = "flake8"
version = "4.0.1"
description = "the modular source code checker: pep8 pyflakes and co"
category = "dev"
optional = false
python-versions = ">=3.6"
groups = ["dev"]
files = [
{file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"},
{file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"},
@@ -110,9 +112,9 @@ pyflakes = ">=2.4.0,<2.5.0"
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
category = "dev"
optional = false
python-versions = ">=3.7"
groups = ["dev"]
files = [
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
@@ -122,9 +124,9 @@ files = [
name = "jedi"
version = "0.18.1"
description = "An autocompletion tool for Python that can be used for text editors."
category = "main"
optional = false
python-versions = ">=3.6"
groups = ["main"]
files = [
{file = "jedi-0.18.1-py2.py3-none-any.whl", hash = "sha256:637c9635fcf47945ceb91cd7f320234a7be540ded6f3e99a50cb6febdfd1ba8d"},
{file = "jedi-0.18.1.tar.gz", hash = "sha256:74137626a64a99c8eb6ae5832d99b3bdd7d29a3850fe2aa80a4126b2a7d949ab"},
@@ -141,9 +143,9 @@ testing = ["Django (<3.1)", "colorama", "docopt", "pytest (<7.0.0)"]
name = "mccabe"
version = "0.6.1"
description = "McCabe checker, plugin for flake8"
category = "dev"
optional = false
python-versions = "*"
groups = ["dev"]
files = [
{file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"},
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
@@ -153,9 +155,9 @@ files = [
name = "mypy-extensions"
version = "1.0.0"
description = "Type system extensions for programs checked with the mypy type checker."
category = "dev"
optional = false
python-versions = ">=3.5"
groups = ["dev"]
files = [
{file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
{file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
@@ -163,23 +165,23 @@ files = [
[[package]]
name = "packaging"
version = "24.0"
version = "24.2"
description = "Core utilities for Python packages"
category = "dev"
optional = false
python-versions = ">=3.7"
python-versions = ">=3.8"
groups = ["dev"]
files = [
{file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"},
{file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"},
{file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
{file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
]
[[package]]
name = "parso"
version = "0.8.4"
description = "A Python Parser"
category = "main"
optional = false
python-versions = ">=3.6"
groups = ["main"]
files = [
{file = "parso-0.8.4-py2.py3-none-any.whl", hash = "sha256:a418670a20291dacd2dddc80c377c5c3791378ee1e8d12bffc35420643d43f18"},
{file = "parso-0.8.4.tar.gz", hash = "sha256:eb3a7b58240fb99099a345571deecc0f9540ea5f4dd2fe14c2a99d6b281ab92d"},
@@ -193,9 +195,9 @@ testing = ["docopt", "pytest"]
name = "pathspec"
version = "0.12.1"
description = "Utility library for gitignore style pattern matching of file paths."
category = "dev"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
files = [
{file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"},
{file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"},
@@ -203,30 +205,31 @@ files = [
[[package]]
name = "platformdirs"
version = "4.2.0"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
version = "4.3.6"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
optional = false
python-versions = ">=3.8"
groups = ["dev"]
files = [
{file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"},
{file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"},
{file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"},
{file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"},
]
[package.extras]
docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"]
type = ["mypy (>=1.11.2)"]
[[package]]
name = "pluggy"
version = "1.4.0"
version = "1.5.0"
description = "plugin and hook calling mechanisms for python"
category = "dev"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
files = [
{file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"},
{file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"},
{file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},
{file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},
]
[package.extras]
@@ -235,11 +238,11 @@ testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "pybricks"
version = "3.5.0b2"
version = "4.0.0b10"
description = "Documentation and user-API stubs for Pybricks MicroPython"
category = "main"
optional = false
python-versions = "^3.8"
groups = ["main", "dev"]
files = []
develop = true
@@ -251,9 +254,9 @@ url = ".."
name = "pycodestyle"
version = "2.8.0"
description = "Python style guide checker"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
groups = ["dev"]
files = [
{file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"},
{file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"},
@@ -263,9 +266,9 @@ files = [
name = "pyflakes"
version = "2.4.0"
description = "passive checker of Python programs"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
groups = ["dev"]
files = [
{file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"},
{file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"},
@@ -275,9 +278,9 @@ files = [
name = "pytest"
version = "7.4.4"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
python-versions = ">=3.7"
groups = ["dev"]
files = [
{file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"},
{file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"},
@@ -296,29 +299,60 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no
[[package]]
name = "tomli"
version = "2.0.1"
version = "2.2.1"
description = "A lil' TOML parser"
category = "dev"
optional = false
python-versions = ">=3.7"
python-versions = ">=3.8"
groups = ["dev"]
markers = "python_full_version < \"3.11.0a7\""
files = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"},
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"},
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"},
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"},
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"},
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"},
{file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"},
{file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"},
{file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"},
{file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"},
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"},
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"},
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"},
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"},
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"},
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"},
{file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"},
{file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"},
{file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"},
{file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"},
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"},
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"},
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"},
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"},
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"},
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"},
{file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"},
{file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"},
{file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"},
{file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
]
[[package]]
name = "typing-extensions"
version = "4.2.0"
description = "Backported and Experimental Type Hints for Python 3.7+"
category = "main"
optional = false
python-versions = ">=3.7"
groups = ["main"]
files = [
{file = "typing_extensions-4.2.0-py3-none-any.whl", hash = "sha256:6657594ee297170d19f67d55c05852a874e7eb634f4f753dbd667855e07c1708"},
{file = "typing_extensions-4.2.0.tar.gz", hash = "sha256:f1c24655a0da0d1b67f07e17a5e6b2a105894e6824b92096378bb3668ef02376"},
]
[metadata]
lock-version = "2.0"
lock-version = "2.1"
python-versions = ">= 3.10, < 3.12"
content-hash = "a634c0231937213565b3dff33539075fd544a4261bf8f84e99b294f34ec7edd4"
content-hash = "6efcdeb3ce02cdd64b69d4d58466e0c7241681aa7f71432bf1a1d53764f305c0"
+5 -3
View File
@@ -1,18 +1,20 @@
[tool.poetry]
name = "pybricks_jedi"
version = "1.16.0"
# Version is set automatically at build time from the root pyproject.toml. Do not edit.
version = "0.0.0"
description = "Code completion for Pybricks."
authors = ["The Pybricks Authors <team@pybricks.com>"]
license = "MIT"
[tool.poetry.dependencies]
python = ">= 3.10, < 3.12"
pybricks = "3.5.0b2"
# Version is set automatically at build time from the root pyproject.toml. Do not edit.
pybricks = "*"
jedi = "0.18.1"
typing-extensions = "4.2.0"
docstring-parser = "0.14.1"
[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pytest = "^7.1.2"
black = "^22.3.0"
flake8 = "^4.0.1"
+2
View File
@@ -15,6 +15,7 @@ PYBRICKS_CODE_PACKAGES = {
"pybricks",
"pybricks.hubs",
"pybricks.iodevices",
"pybricks.messaging",
"pybricks.parameters",
"pybricks.pupdevices",
"pybricks.robotics",
@@ -490,6 +491,7 @@ def initialize():
"pybricks.ev3dev.speaker",
"pybricks.hubs",
"pybricks.iodevices",
"pybricks.messaging",
"pybricks.parameters",
"pybricks.pupdevices",
"pybricks.robotics",
+2 -4
View File
@@ -5,7 +5,6 @@
Tests for correct code completion of the CityHub class.
"""
import json
from pybricks_jedi import CompletionItem, complete
@@ -33,7 +32,6 @@ def test_hub_dot():
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"battery",
"ble",
"buttons",
"light",
"system",
@@ -76,8 +74,8 @@ def test_hub_dot_system_dot():
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"name",
"reset_reason",
"info",
"reset_storage",
"set_stop_button",
"shutdown",
"storage",
+2 -4
View File
@@ -5,7 +5,6 @@
Tests for correct code completion of the EssentialHub class.
"""
import json
from pybricks_jedi import CompletionItem, complete
@@ -33,7 +32,6 @@ def test_hub_dot():
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"battery",
"ble",
"buttons",
"charger",
"imu",
@@ -108,8 +106,8 @@ def test_hub_dot_system_dot():
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"name",
"reset_reason",
"info",
"reset_storage",
"set_stop_button",
"shutdown",
"storage",
+5 -1
View File
@@ -61,6 +61,7 @@ def test_from_pybricks_import():
assert [c["insertText"] for c in completions] == [
"hubs",
"iodevices",
"messaging",
"parameters",
"pupdevices",
"robotics",
@@ -75,6 +76,7 @@ def test_from_pybricks_dot():
assert [c["insertText"] for c in completions] == [
"hubs",
"iodevices",
"messaging",
"parameters",
"pupdevices",
"robotics",
@@ -102,7 +104,6 @@ def test_from_pybricks_iodevices_import():
assert [c["insertText"] for c in completions] == [
"AnalogSensor",
"DCMotor",
"Ev3devSensor",
"I2CDevice",
"LUMPDevice",
"LWP3Device",
@@ -135,12 +136,15 @@ def test_from_pybricks_pupdevices_import():
"ColorLightMatrix",
"ColorSensor",
"DCMotor",
"DuploTrain",
"ForceSensor",
"InfraredSensor",
"Light",
"MarioHub",
"Motor",
"PFMotor",
"Remote",
"TechnicMoveHub",
"TiltSensor",
"UltrasonicSensor",
]
-1
View File
@@ -5,7 +5,6 @@
Tests for correct code completion of the InventorHub class.
"""
import json
from pybricks_jedi import complete, CompletionItem
+61
View File
@@ -0,0 +1,61 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 The Pybricks Authors
"""
Tests for correct code completion of the messaging module.
"""
import json
import pytest
from pybricks_jedi import CompletionItem, complete
def test_from_pybricks_messaging_import():
code = "from pybricks.messaging import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"AppData",
"BLERadio",
"BluetoothMailboxClient",
"BluetoothMailboxServer",
"Connection",
"LogicMailbox",
"Mailbox",
"NumericMailbox",
"TextMailbox",
]
def test_ble_radio_dot():
code = "\n".join(
[
"from pybricks.messaging import BLERadio",
"ble = BLERadio()",
"ble.",
]
)
completions: list[CompletionItem] = json.loads(complete(code, 3, 5))
assert [c["insertText"] for c in completions] == [
"broadcast",
"observe",
"signal_strength",
"version",
]
def test_app_data_dot():
code = "\n".join(
[
"from pybricks.messaging import AppData",
"app = AppData([(0, 4)])",
"app.",
]
)
completions: list[CompletionItem] = json.loads(complete(code, 3, 5))
assert [c["insertText"] for c in completions] == [
"close",
"configure",
"get_bytes",
"write_bytes",
]
+2 -4
View File
@@ -5,7 +5,6 @@
Tests for correct code completion of the MoveHub class.
"""
import json
from pybricks_jedi import CompletionItem, complete
@@ -33,7 +32,6 @@ def test_hub_dot():
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"battery",
"ble",
"buttons",
"imu",
"light",
@@ -88,8 +86,8 @@ def test_hub_dot_system_dot():
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"name",
"reset_reason",
"info",
"reset_storage",
"set_stop_button",
"shutdown",
"storage",
+2 -4
View File
@@ -5,7 +5,6 @@
Tests for correct code completion of the PrimeHub class.
"""
import json
from pybricks_jedi import CompletionItem, complete
@@ -33,7 +32,6 @@ def test_hub_dot():
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"battery",
"ble",
"buttons",
"charger",
"display",
@@ -137,8 +135,8 @@ def test_hub_dot_system_dot():
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"name",
"reset_reason",
"info",
"reset_storage",
"set_stop_button",
"shutdown",
"storage",
+2 -4
View File
@@ -5,7 +5,6 @@
Tests for correct code completion of the TechnicHub class.
"""
import json
from pybricks_jedi import CompletionItem, complete
@@ -33,7 +32,6 @@ def test_hub_dot():
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"battery",
"ble",
"buttons",
"imu",
"light",
@@ -96,8 +94,8 @@ def test_hub_dot_system_dot():
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"name",
"reset_reason",
"info",
"reset_storage",
"set_stop_button",
"shutdown",
"storage",
+86 -44
View File
@@ -5,7 +5,6 @@
Tests for correct signatures of the pupdevices.Motor class.
"""
from itertools import zip_longest
import json
@@ -86,12 +85,17 @@ CONSTRUCTOR_PARAMS = [
pytest.param(
"pybricks.hubs",
"MoveHub",
[["broadcast_channel: int=0", "observe_channels: Sequence[int]=[]"]],
[
[
"top_side: Axis=Axis.Z",
"front_side: Axis=Axis.X",
]
],
),
pytest.param(
"pybricks.hubs",
"CityHub",
[["broadcast_channel: int=0", "observe_channels: Sequence[int]=[]"]],
[[]],
),
pytest.param(
"pybricks.hubs",
@@ -100,8 +104,6 @@ CONSTRUCTOR_PARAMS = [
[
"top_side: Axis=Axis.Z",
"front_side: Axis=Axis.X",
"broadcast_channel: int=0",
"observe_channels: Sequence[int]=[]",
]
],
),
@@ -112,8 +114,6 @@ CONSTRUCTOR_PARAMS = [
[
"top_side: Axis=Axis.Z",
"front_side: Axis=Axis.X",
"broadcast_channel: int=0",
"observe_channels: Sequence[int]=[]",
]
],
),
@@ -124,8 +124,6 @@ CONSTRUCTOR_PARAMS = [
[
"top_side: Axis=Axis.Z",
"front_side: Axis=Axis.X",
"broadcast_channel: int=0",
"observe_channels: Sequence[int]=[]",
]
],
),
@@ -170,7 +168,7 @@ CONSTRUCTOR_PARAMS = [
pytest.param(
"pybricks.pupdevices",
"Remote",
[["name: Optional[str]=None", "timeout: int=10000"]],
[["name: Optional[str]=None", "timeout: int=10000", "connect: bool=True"]],
),
# TODO: iodevices go here
pytest.param(
@@ -264,7 +262,6 @@ METHOD_PARAMS = [
"system.set_stop_button",
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
),
pytest.param("pybricks.hubs", "MoveHub", "system.name", [([], "str")]),
pytest.param("pybricks.hubs", "MoveHub", "system.shutdown", [([], "None")]),
pytest.param(
"pybricks.hubs",
@@ -275,7 +272,6 @@ METHOD_PARAMS = [
(["offset: int", "*", "write: bytes"], "None"),
],
),
pytest.param("pybricks.hubs", "MoveHub", "system.reset_reason", [([], "int")]),
pytest.param("pybricks.hubs", "CityHub", "light.on", [(["color: Color"], "None")]),
pytest.param("pybricks.hubs", "CityHub", "light.off", [([], "None")]),
pytest.param(
@@ -299,7 +295,6 @@ METHOD_PARAMS = [
"system.set_stop_button",
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
),
pytest.param("pybricks.hubs", "CityHub", "system.name", [([], "str")]),
pytest.param("pybricks.hubs", "CityHub", "system.shutdown", [([], "None")]),
pytest.param(
"pybricks.hubs",
@@ -310,7 +305,6 @@ METHOD_PARAMS = [
(["offset: int", "*", "write: bytes"], "None"),
],
),
pytest.param("pybricks.hubs", "CityHub", "system.reset_reason", [([], "int")]),
pytest.param(
"pybricks.hubs", "TechnicHub", "light.on", [(["color: Color"], "None")]
),
@@ -327,19 +321,35 @@ METHOD_PARAMS = [
"light.animate",
[(["colors: Collection[Color]", "interval: Number"], "None")],
),
pytest.param("pybricks.hubs", "TechnicHub", "imu.up", [([], "Side")]),
pytest.param("pybricks.hubs", "TechnicHub", "imu.tilt", [([], "Tuple[int, int]")]),
pytest.param(
"pybricks.hubs",
"TechnicHub",
"imu.up",
[(["calibrated: bool=True"], "Side")],
),
pytest.param(
"pybricks.hubs",
"TechnicHub",
"imu.tilt",
[(["calibrated: bool=True"], "Tuple[int, int]")],
),
pytest.param(
"pybricks.hubs",
"TechnicHub",
"imu.acceleration",
[(["axis: Axis"], "float"), ([], "Matrix")],
[
(["axis: Axis=None", "calibrated: bool=True"], "float"),
(["calibrated: bool=True"], "Matrix"),
],
),
pytest.param(
"pybricks.hubs",
"TechnicHub",
"imu.angular_velocity",
[(["axis: Axis"], "float"), ([], "Matrix")],
[
(["axis: Axis=None", "calibrated: bool=True"], "float"),
(["calibrated: bool=True"], "Matrix"),
],
),
pytest.param("pybricks.hubs", "TechnicHub", "imu.heading", [([], "float")]),
pytest.param("pybricks.hubs", "TechnicHub", "imu.orientation", [([], "Matrix")]),
@@ -353,7 +363,7 @@ METHOD_PARAMS = [
"pybricks.hubs",
"TechnicHub",
"imu.rotation",
[(["axis: Axis"], "float")],
[(["axis: Axis", "calibrated: bool=True"], "float")],
),
pytest.param("pybricks.hubs", "TechnicHub", "battery.voltage", [([], "int")]),
pytest.param("pybricks.hubs", "TechnicHub", "battery.current", [([], "int")]),
@@ -366,7 +376,6 @@ METHOD_PARAMS = [
"system.set_stop_button",
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
),
pytest.param("pybricks.hubs", "TechnicHub", "system.name", [([], "str")]),
pytest.param("pybricks.hubs", "TechnicHub", "system.shutdown", [([], "None")]),
pytest.param(
"pybricks.hubs",
@@ -377,7 +386,6 @@ METHOD_PARAMS = [
(["offset: int", "*", "write: bytes"], "None"),
],
),
pytest.param("pybricks.hubs", "TechnicHub", "system.reset_reason", [([], "int")]),
pytest.param("pybricks.hubs", "PrimeHub", "light.on", [(["color: Color"], "None")]),
pytest.param("pybricks.hubs", "PrimeHub", "light.off", [([], "None")]),
pytest.param(
@@ -424,19 +432,32 @@ METHOD_PARAMS = [
[(["text: str", "on: Number=500", "off: Number=50"], "None")],
),
pytest.param("pybricks.hubs", "PrimeHub", "buttons.pressed", [([], "Set[Button]")]),
pytest.param("pybricks.hubs", "PrimeHub", "imu.up", [([], "Side")]),
pytest.param("pybricks.hubs", "PrimeHub", "imu.tilt", [([], "Tuple[int, int]")]),
pytest.param(
"pybricks.hubs", "PrimeHub", "imu.up", [(["calibrated: bool=True"], "Side")]
),
pytest.param(
"pybricks.hubs",
"PrimeHub",
"imu.tilt",
[(["calibrated: bool=True"], "Tuple[int, int]")],
),
pytest.param(
"pybricks.hubs",
"PrimeHub",
"imu.acceleration",
[(["axis: Axis"], "float"), ([], "Matrix")],
[
(["axis: Axis=None", "calibrated: bool=True"], "float"),
(["calibrated: bool=True"], "Matrix"),
],
),
pytest.param(
"pybricks.hubs",
"PrimeHub",
"imu.angular_velocity",
[(["axis: Axis"], "float"), ([], "Matrix")],
[
(["axis: Axis=None", "calibrated: bool=True"], "float"),
(["calibrated: bool=True"], "Matrix"),
],
),
pytest.param("pybricks.hubs", "PrimeHub", "imu.heading", [([], "float")]),
pytest.param("pybricks.hubs", "PrimeHub", "imu.orientation", [([], "Matrix")]),
@@ -450,7 +471,7 @@ METHOD_PARAMS = [
"pybricks.hubs",
"PrimeHub",
"imu.rotation",
[(["axis: Axis"], "float")],
[(["axis: Axis", "calibrated: bool=True"], "float")],
),
pytest.param(
"pybricks.hubs",
@@ -481,7 +502,6 @@ METHOD_PARAMS = [
"system.set_stop_button",
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
),
pytest.param("pybricks.hubs", "PrimeHub", "system.name", [([], "str")]),
pytest.param("pybricks.hubs", "PrimeHub", "system.shutdown", [([], "None")]),
pytest.param(
"pybricks.hubs",
@@ -492,7 +512,6 @@ METHOD_PARAMS = [
(["offset: int", "*", "write: bytes"], "None"),
],
),
pytest.param("pybricks.hubs", "PrimeHub", "system.reset_reason", [([], "int")]),
pytest.param(
"pybricks.hubs", "EssentialHub", "light.on", [(["color: Color"], "None")]
),
@@ -512,21 +531,32 @@ METHOD_PARAMS = [
pytest.param(
"pybricks.hubs", "EssentialHub", "buttons.pressed", [([], "Set[Button]")]
),
pytest.param("pybricks.hubs", "EssentialHub", "imu.up", [([], "Side")]),
pytest.param(
"pybricks.hubs", "EssentialHub", "imu.tilt", [([], "Tuple[int, int]")]
"pybricks.hubs", "EssentialHub", "imu.up", [(["calibrated: bool=True"], "Side")]
),
pytest.param(
"pybricks.hubs",
"EssentialHub",
"imu.tilt",
[(["calibrated: bool=True"], "Tuple[int, int]")],
),
pytest.param(
"pybricks.hubs",
"EssentialHub",
"imu.acceleration",
[(["axis: Axis"], "float"), ([], "Matrix")],
[
(["axis: Axis=None", "calibrated: bool=True"], "float"),
(["calibrated: bool=True"], "Matrix"),
],
),
pytest.param(
"pybricks.hubs",
"EssentialHub",
"imu.angular_velocity",
[(["axis: Axis"], "float"), ([], "Matrix")],
[
(["axis: Axis=None", "calibrated: bool=True"], "float"),
(["calibrated: bool=True"], "Matrix"),
],
),
pytest.param("pybricks.hubs", "EssentialHub", "imu.heading", [([], "float")]),
pytest.param("pybricks.hubs", "EssentialHub", "imu.orientation", [([], "Matrix")]),
@@ -540,7 +570,7 @@ METHOD_PARAMS = [
"pybricks.hubs",
"EssentialHub",
"imu.rotation",
[(["axis: Axis"], "float")],
[(["axis: Axis", "calibrated: bool=True"], "float")],
),
pytest.param("pybricks.hubs", "EssentialHub", "battery.voltage", [([], "int")]),
pytest.param("pybricks.hubs", "EssentialHub", "battery.current", [([], "int")]),
@@ -553,7 +583,6 @@ METHOD_PARAMS = [
"system.set_stop_button",
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
),
pytest.param("pybricks.hubs", "EssentialHub", "system.name", [([], "str")]),
pytest.param("pybricks.hubs", "EssentialHub", "system.shutdown", [([], "None")]),
pytest.param(
"pybricks.hubs",
@@ -564,7 +593,6 @@ METHOD_PARAMS = [
(["offset: int", "*", "write: bytes"], "None"),
],
),
pytest.param("pybricks.hubs", "EssentialHub", "system.reset_reason", [([], "int")]),
# TODO: iodevices module here
pytest.param("pybricks.pupdevices", "DCMotor", "dc", [(["duty: Number"], "None")]),
pytest.param("pybricks.pupdevices", "DCMotor", "stop", [([], "None")]),
@@ -905,7 +933,7 @@ METHOD_PARAMS = [
"pybricks.pupdevices",
"Remote",
"name",
[(["name: str"], "None"), ([], "str")],
[(["name: str"], "MaybeAwaitable"), ([], "str")],
),
pytest.param(
"pybricks.pupdevices",
@@ -943,7 +971,12 @@ METHOD_PARAMS = [
"turn",
[
(
["angle: Number", "then: Stop=Stop.HOLD", "wait: bool=True"],
[
"angle: Number",
"then: Stop=Stop.HOLD",
"wait: bool=True",
"absolute: bool=False",
],
"MaybeAwaitable",
)
],
@@ -951,12 +984,13 @@ METHOD_PARAMS = [
pytest.param(
"pybricks.robotics",
"DriveBase",
"curve",
"arc",
[
(
[
"radius: Number",
"angle: Number",
"angle: Number=None",
"distance: Number=None",
"then: Stop=Stop.HOLD",
"wait: bool=True",
],
@@ -972,13 +1006,16 @@ METHOD_PARAMS = [
(
[
"straight_speed: Optional[Number]=None",
"straight_acceleration: Optional[Number]=None",
"straight_acceleration: Optional[Union[Number, Tuple[Number, Number]]]=None",
"turn_rate: Optional[Number]=None",
"turn_acceleration: Optional[Number]=None",
"turn_acceleration: Optional[Union[Number, Tuple[Number, Number]]]=None",
],
"None",
),
([], "Tuple[int, int, int, int]"),
(
[],
"Tuple[int, Union[int, Tuple[int, int]], int, Union[int, Tuple[int, int]]]",
),
],
),
pytest.param(
@@ -990,11 +1027,16 @@ METHOD_PARAMS = [
pytest.param("pybricks.robotics", "DriveBase", "stop", [([], "None")]),
pytest.param("pybricks.robotics", "DriveBase", "brake", [([], "None")]),
pytest.param("pybricks.robotics", "DriveBase", "distance", [([], "int")]),
pytest.param("pybricks.robotics", "DriveBase", "angle", [([], "int")]),
pytest.param("pybricks.robotics", "DriveBase", "angle", [([], "float")]),
pytest.param(
"pybricks.robotics", "DriveBase", "state", [([], "Tuple[int, int, int, int]")]
),
pytest.param("pybricks.robotics", "DriveBase", "reset", [([], "None")]),
pytest.param(
"pybricks.robotics",
"DriveBase",
"reset",
[(["distance: Number=0", "angle: Number=0"], "None")],
),
pytest.param("pybricks.robotics", "DriveBase", "done", [([], "bool")]),
pytest.param("pybricks.robotics", "DriveBase", "stalled", [([], "bool")]),
]
-2
View File
@@ -1,2 +0,0 @@
version-tag-prefix "@pybricks/ide-docs/v"
version-git-message "@pybricks/ide-docs v%s"
-109
View File
@@ -1,109 +0,0 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 2.19.0 - 2024-04-11
### Changed
- Updated docs to v3.5.0.
## 2.18.0 - 2024-04-05
### Changed
- Updated docs to v3.5.0b2.
## 2.17.0 - 2024-03-21
### Changed
- Updated docs to v3.5.0b1.
## 2.16.0 - 2024-03-11
### Changed
- Updated docs to v3.4.0.
## 2.15.0 - 2024-03-05
### Changed
- Updated docs to v3.4.0b5.
## 2.14.0 - 2024-01-30
### Changed
- Updated docs to v3.4.0b3.
## 2.13.0 - 2023-11-24
### Changed
- Updated docs to v3.4.0b1.
## 2.12.0 - 2023-11-24
### Changed
- Updated docs to v3.3.0.
## 2.11.0 - 2023-11-20
### Changed
- Updated docs to v3.3.0c1.
## 2.10.0 - 2023-10-26
### Changed
- Updated docs to v3.3.0b9.
## 2.9.0 - 2023-05-16
### Changed
- Updated docs to v3.3.0b5.
## 2.8.0 - 2023-04-21
### Changed
- Updated docs to v3.3.0b4.
## 2.7.0 - 2022-12-20
### Changed
- Updated docs to v3.2.0c2.
## 2.6.0 - 2022-12-09
### Changed
- Updated docs to v3.2.0c1.
## 2.5.0 - 2022-12-02
### Changed
- Updated docs to v3.2.0b6.
## 2.4.0 - 2022-11-11
### Changed
- Updated docs to v3.2.0b5.
## 2.3.0 - 2022-10-21
### Changed
- Updated docs to v3.2.0b4.
## 2.2.0 - 2022-06-02
### Changed
- Updated docs to v3.2.0b1.
## 2.1.0 - 2021-12-16
### Changed
- Updated docs to v3.1.0.
## 2.0.1 - 2021-11-19
### Fixed
- Fixed link to Color Light Matrix page.
## 2.0.0 - 2021-11-19
### Changed
- Changed package directory structure.
- Updated docs to v3.1.0rc1.
+2 -2
View File
@@ -1,10 +1,10 @@
{
"name": "@pybricks/ide-docs",
"version": "2.19.0",
"version": "0.0.0",
"description": "Special build of Pybricks API docs for embedding in an IDE.",
"repository": {
"type": "git",
"url": "https://github.com/pybricks/pybricks-api",
"url": "git+https://github.com/pybricks/pybricks-api.git",
"directory": "npm/ide-docs"
},
"publishConfig": {
+5
View File
@@ -2,6 +2,11 @@
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 1.4.0 - 2022-12-19
### Added
- Added existing NXT and EV3 hub images to published package.
## 1.3.0 - 2022-12-19
### Added
+3 -3
View File
@@ -9,16 +9,16 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
IMAGE_DIR = (
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "diagrams"
).resolve()
HUBS = ["move", "city", "technic", "prime", "essential", "inventor"]
HUBS = ["move", "city", "technic", "prime", "essential", "inventor", "ev3", "nxt"]
package_json = {
"name": "@pybricks/images",
"version": "1.3.0",
"version": "1.4.0",
"description": "Distribution of Pybricks images.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pybricks/pybricks-api",
"url": "git+https://github.com/pybricks/pybricks-api.git",
"directory": "npm/images",
},
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
-2
View File
@@ -1,2 +0,0 @@
version-tag-prefix "@pybricks/jedi/v"
version-git-message "@pybricks/jedi v%s"

Some files were not shown because too many files have changed in this diff Show More