Compare commits

..
Author SHA1 Message Date
Laurens Valk 8ea780cc9e @pybricks/ide-docs v1.3.3 2021-05-21 14:04:22 +02:00
Laurens Valk 78a8fea78f @pybricks/ide-docs v1.3.2 2021-05-21 14:02:33 +02:00
Laurens Valk 99a7c69ac5 @pybricks/ide-docs v1.3.1 2021-05-21 14:02:33 +02:00
Laurens Valk 1a64ba718f @pybricks/ide-docs v1.3.0 2021-05-21 14:02:32 +02:00
Laurens Valk 6d332deb3f v3: Drop parameters Side and Button. 2021-05-21 14:02:32 +02:00
Laurens Valk a7df6988ab v3: Drop Remote control. 2021-05-21 14:02:32 +02:00
Laurens Valk a2e17f6889 v3: Drop geometry module. 2021-05-21 14:02:31 +02:00
Laurens Valk 866b50fef6 v3: Drop Prime Hub and Inventor Hub. 2021-05-21 14:02:31 +02:00
Laurens Valk 9c7378ce64 v3: Drop IMU documentation.
This is not officially supported yet, so drop from release docs.
2021-05-21 14:02:30 +02:00
Laurens Valk 3b20a811cb examples/pup/motor_dc: Add battery box example. 2021-05-21 14:00:57 +02:00
David Lechner 73cc441edb github: add release action
This publishes the Python package to PyPI when a release is created on
GitHub.
2021-05-17 16:42:16 -05:00
David Lechner 7770a88aa0 github: fix build action name
It does more than just build the Python package.
2021-05-17 16:38:58 -05:00
David Lechner f06caa32bc 3.0.0-rc.1 2021-05-17 16:35:37 -05:00
thesynman fb8198fe8f pybricks/robotics.pyi: improve type hint (#60)
* Allow the wheel diameter and axle track of a DriveBase to be an int or a float
2021-05-10 13:08:25 -05:00
David Lechner 3dad15ac11 examples: fix use of OSError
We generally shouldn't be raising OSError from user code since it
represents an error the bubbles up from the OS. Also, when handling
an OSError, we almost always want to check for a specific error code.
2021-04-29 09:38:16 -05:00
Laurens Valk 790fcfa66a examples/pup/iodevices: Add PUPDevice example. 2021-04-29 13:03:34 +02:00
David Lechner d108d7c163 doc/common/conf: use xcode syntax highlighting
This matches the style used in Pybricks Code.
2021-04-28 15:54:11 -05:00
Martyn Boogaarts 7ce3721b48 examples/pup/hub_shared: Update light animation examples.
See https://github.com/pybricks/support/issues/253

* Update light_animate.py

corrected syntax

* Update light_animate.py

corrected syntax

* Update light_animate.py

corrected syntax

* Update light_animate.py

corrected syntax
2021-04-24 21:36:10 +02:00
David Lechner d0bfbcb4d1 js: only apply target="_blank" to IDE build
On the web, we want to be able to navigate between the various Pybricks
subdomains without opening new tabs. But Pybricks Code is treated as an
"app", we don't want links to open in Pybricks Code.
2021-04-20 12:38:33 -05:00
David Lechner 2aadc75f2c poetry: bump version to match current firmware 2021-04-20 12:07:36 -05:00
David Lechner 8bf42c7d2d poetry: Bump RTD and theme versions.
This is mainly to pull in the requirement of docutils < 0.17 from
sphinx-rtd-theme. Just bumping to latest sphinx doc while we are at it.

Issue: https://github.com/pybricks/pybricks-api/issues/55
2021-04-12 11:12:23 +02:00
12 changed files with 124 additions and 8 deletions
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
name: Build Python package and docs
on: [ push, pull_request ]
+22
View File
@@ -0,0 +1,22 @@
name: Release to PyPI
on:
release:
types: [published]
jobs:
build_and_publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.6
- run: poetry install
- run: poetry build
- run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
+9
View File
@@ -12,3 +12,12 @@ Powered Up Device
.. automethod:: pybricks.iodevices.PUPDevice.read
.. automethod:: pybricks.iodevices.PUPDevice.write
Examples
-------------------
Detecting devices
******************************
.. literalinclude::
../../../examples/pup/iodevices_pupdevice/port_info.py
+6
View File
@@ -26,6 +26,12 @@ Motors without Rotation Sensors
Examples
-------------------
Making a train drive forever
************************************
.. literalinclude::
../../../examples/pup/motor_dc/motor_dc_battery_box.py
Making the motor move back and forth
************************************
+1 -1
View File
@@ -91,7 +91,7 @@ version = re.match(r'(v\d+\.\d+)', release)[0]
language = None
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'xcode'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
+6
View File
@@ -1,3 +1,9 @@
# 1.3.3 - 2021-05-21
## Changed:
- Match example snippet styling to IDE.
- Add more examples.
# 1.3.2 - 2021-04-26
## Changed:
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pybricks/ide-docs",
"version": "1.3.2",
"version": "1.3.3",
"description": "Special build of Pybricks API docs for embedding in an IDE.",
"repository": {
"type": "git",
+1 -1
View File
@@ -13,7 +13,7 @@ device = I2CDevice(Port.S2, 0xD2 >> 1)
# For this device, we can read the Who Am I
# register (0x0F) for the expected value: 211.
if 211 not in device.read(0x0F):
raise OSError("Device is not attached")
raise ValueError("Unexpected I2C device ID")
# To write data, create a bytes object of one
# or more bytes. For example:
@@ -0,0 +1,60 @@
from pybricks.iodevices import PUPDevice
from pybricks.parameters import Port
from uerrno import ENODEV
# Dictionary of device identifiers along with their name.
device_names = {
34: "Wedo 2.0 Tilt Sensor",
35: "Wedo 2.0 Infrared Sensor",
37: "BOOST Color Distance Sensor",
38: "BOOST Interactive Motor",
46: "Technic Large Motor",
47: "Technic Extra Large Motor",
48: "SPIKE Medium Angular Motor",
49: "SPIKE Large Angular Motor",
61: "SPIKE Color Sensor",
62: "SPIKE Ultrasonic Sensor",
63: "SPIKE Force Sensor",
75: "Technic Medium Angular Motor",
76: "Technic Large Angular Motor",
}
# Make a list of known ports.
ports = [Port.A, Port.B]
# On hubs that support it, add more ports.
try:
ports.append(Port.C)
ports.append(Port.D)
except AttributeError:
pass
# On hubs that support it, add more ports.
try:
ports.append(Port.E)
ports.append(Port.F)
except AttributeError:
pass
# Go through all available ports.
for port in ports:
# Try to get the device, if it is attached.
try:
device = PUPDevice(port)
except OSError as ex:
if ex.args[0] == ENODEV:
# No device found on this port.
print(port, ": ---")
continue
else:
raise
# Get the device id
id = device.info()['id']
# Look up the name.
try:
print(port, ":", device_names[id])
except KeyError:
print(port, ":", "Unknown device with ID", id)
@@ -0,0 +1,13 @@
from pybricks.pupdevices import DCMotor
from pybricks.parameters import Port
from pybricks.tools import wait
# Initialize the motor.
train_motor = DCMotor(Port.A)
# Choose the "power" level for your train. Negative means reverse.
train_motor.dc(50)
# Keep doing nothing. The train just keeps going.
while True:
wait(1000)
+3 -3
View File
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Optional, Tuple, overload
from typing import Optional, Tuple, overload, Union
from ._common import Control, Motor
class DriveBase:
@@ -11,8 +11,8 @@ class DriveBase:
self,
left_motor: Motor,
right_motor: Motor,
wheel_diameter: int,
axle_track: int,
wheel_diameter: Union[int, float],
axle_track: Union[int, float],
): ...
def drive(self, drive_speed: int, turn_rate: int) -> None: ...
def stop(self) -> None: ...
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybricks"
version = "3.0.0b6"
version = "3.0.0-rc.1"
description = "Documentation and user-API stubs for Pybricks MicroPython"
authors = ["The Pybricks Authors <dev@pybricks.com>"]
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]