mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 09:05:07 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5437bd92c0 | ||
|
|
13d9aeea20 | ||
|
|
9594adae48 | ||
|
|
8dd171fc4c | ||
|
|
5effd921b4 | ||
|
|
d503966862 | ||
|
|
7563b1c6cf | ||
|
|
c9132b45db |
@@ -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: Build Python package and docs
|
||||
name: Python package
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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 }}
|
||||
@@ -12,12 +12,3 @@ Powered Up Device
|
||||
.. automethod:: pybricks.iodevices.PUPDevice.read
|
||||
|
||||
.. automethod:: pybricks.iodevices.PUPDevice.write
|
||||
|
||||
Examples
|
||||
-------------------
|
||||
|
||||
Detecting devices
|
||||
******************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/iodevices_pupdevice/port_info.py
|
||||
|
||||
@@ -26,12 +26,6 @@ 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,4 +1,3 @@
|
||||
// Since Pybricks Code is an "app", all external links get opened in new tab/window
|
||||
// https://stackoverflow.com/a/62742435/1976323
|
||||
$(document).ready(function () {
|
||||
$('a[href^="http://"], a[href^="https://"]').not('a[class*=internal]').attr('target', '_blank');
|
||||
+6
-1
@@ -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 = 'xcode'
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
@@ -147,6 +147,11 @@ else:
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
# a little extra javascript
|
||||
html_js_files = [
|
||||
'js/custom.js'
|
||||
]
|
||||
|
||||
html_context = {
|
||||
'disclaimer': _DISCLAIMER,
|
||||
}
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
# 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:
|
||||
|
||||
@@ -18,7 +18,6 @@ html_logo = '../common/images/pybricks-logo-rtd.png'
|
||||
html_show_copyright = False
|
||||
html_show_sphinx = False
|
||||
html_css_files = ['css/ide.css']
|
||||
html_js_files = ['js/ide.js']
|
||||
|
||||
imgmath_image_format = 'svg'
|
||||
imgmath_use_preview = True # requires Sphinx v3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/ide-docs",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.1",
|
||||
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -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 ValueError("Unexpected I2C device ID")
|
||||
raise OSError("Device is not attached")
|
||||
|
||||
# To write data, create a bytes object of one
|
||||
# or more bytes. For example:
|
||||
|
||||
@@ -7,7 +7,7 @@ from math import sin, pi
|
||||
hub = CityHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from math import sin, pi
|
||||
hub = PrimeHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from math import sin, pi
|
||||
hub = ExampleHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from math import sin, pi
|
||||
hub = TechnicHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
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)
|
||||
@@ -1,13 +0,0 @@
|
||||
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)
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (c) 2020 The Pybricks Authors
|
||||
|
||||
from typing import Optional, Tuple, overload, Union
|
||||
from typing import Optional, Tuple, overload
|
||||
from ._common import Control, Motor
|
||||
|
||||
class DriveBase:
|
||||
@@ -11,8 +11,8 @@ class DriveBase:
|
||||
self,
|
||||
left_motor: Motor,
|
||||
right_motor: Motor,
|
||||
wheel_diameter: Union[int, float],
|
||||
axle_track: Union[int, float],
|
||||
wheel_diameter: int,
|
||||
axle_track: int,
|
||||
): ...
|
||||
def drive(self, drive_speed: int, turn_rate: int) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks"
|
||||
version = "3.0.0-rc.1"
|
||||
version = "3.0.0a3"
|
||||
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>" ]
|
||||
|
||||
Reference in New Issue
Block a user