mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 17:46:19 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d49bc548c7 | ||
|
|
492d6cd2d4 | ||
|
|
be3558167e | ||
|
|
4573fd2760 | ||
|
|
2a23c2e81d | ||
|
|
fe126de264 | ||
|
|
b290f7dc6b | ||
|
|
9127afdcbc | ||
|
|
7ee1f66556 |
@@ -7,10 +7,7 @@ jobs:
|
|||||||
if: github.ref_type != 'tag'
|
if: github.ref_type != 'tag'
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
- run: pipx install poetry
|
- run: pipx install poetry
|
||||||
- run: poetry install
|
- run: poetry install
|
||||||
working-directory: ./jedi
|
working-directory: ./jedi
|
||||||
@@ -19,12 +16,9 @@ jobs:
|
|||||||
|
|
||||||
publish:
|
publish:
|
||||||
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'pybricks_jedi/')
|
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'pybricks_jedi/')
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
- run: pipx install poetry
|
- run: pipx install poetry
|
||||||
- run: poetry install
|
- run: poetry install
|
||||||
working-directory: ./jedi
|
working-directory: ./jedi
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
name: Release @pybricks/images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '@pybricks/images/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish_ide_docs:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
# Setup .npmrc file to publish to npm
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '16.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: ./build.py
|
||||||
|
working-directory: npm/images
|
||||||
|
- run: yarn publish
|
||||||
|
working-directory: npm/images/build
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018-2021 The Pybricks Authors
|
Copyright (c) 2018-2022 The Pybricks Authors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class PybricksRequirementsStaticDirective(Directive):
|
|||||||
# Cell with image of a hub.
|
# Cell with image of a hub.
|
||||||
hub_cell = """
|
hub_cell = """
|
||||||
<th><div class="align-default">
|
<th><div class="align-default">
|
||||||
<img alt="" src="{0}_images/compat_{1}_{2}_label.png">
|
<img alt="" src="{0}_images/compat_{1}_{2}.png">
|
||||||
</div></th>
|
</div></th>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -104,3 +104,12 @@
|
|||||||
|
|
||||||
.. autoattribute:: pybricks.robotics.DriveBase.heading_control
|
.. autoattribute:: pybricks.robotics.DriveBase.heading_control
|
||||||
:annotation:
|
:annotation:
|
||||||
|
|
||||||
|
Examples
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Driving straight and turning in place
|
||||||
|
**********************************************
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
../../examples/pup/robotics/drivebase_basics.py
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
from pybricks.pupdevices import Motor
|
||||||
|
from pybricks.parameters import Port, Direction
|
||||||
|
from pybricks.robotics import DriveBase
|
||||||
|
|
||||||
|
# Initialize both motors. In this example, the motor on the
|
||||||
|
# left must turn counterclockwise to make the robot go forward.
|
||||||
|
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
|
||||||
|
right_motor = Motor(Port.B)
|
||||||
|
|
||||||
|
# Initialize the drive base. In this example, the wheel diameter is 56mm.
|
||||||
|
# The distance between the two wheel-ground contact points is 112mm.
|
||||||
|
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=56, axle_track=112)
|
||||||
|
|
||||||
|
# Drive forward by 500mm (half a meter).
|
||||||
|
drive_base.straight(500)
|
||||||
|
|
||||||
|
# Turn around clockwise (180 degrees)
|
||||||
|
drive_base.turn(180)
|
||||||
|
|
||||||
|
# Drive forward again to drive back.
|
||||||
|
drive_base.straight(500)
|
||||||
|
|
||||||
|
# Turn around counterclockwise.
|
||||||
|
drive_base.turn(-180)
|
||||||
@@ -4,9 +4,14 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 1.2.0 - 2022-10-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added LICENSE file.
|
- Added LICENSE file.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated to pybricks API package v3.2.0b4.
|
||||||
|
|
||||||
## 1.1.0 - 2022-06-26
|
## 1.1.0 - 2022-06-26
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
Generated
+9
-9
@@ -15,10 +15,10 @@ optional = false
|
|||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope-interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"]
|
dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "sphinx", "sphinx-notfound-page", "zope.interface"]
|
||||||
docs = ["furo", "sphinx", "zope-interface", "sphinx-notfound-page"]
|
docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"]
|
||||||
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope-interface", "cloudpickle"]
|
tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "zope.interface"]
|
||||||
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"]
|
tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "black"
|
name = "black"
|
||||||
@@ -160,8 +160,8 @@ optional = false
|
|||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"]
|
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx (>=4)", "sphinx-autodoc-typehints (>=1.12)"]
|
||||||
test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"]
|
test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pluggy"
|
name = "pluggy"
|
||||||
@@ -185,7 +185,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pybricks"
|
name = "pybricks"
|
||||||
version = "3.2.0b1-r3"
|
version = "3.2.0b4"
|
||||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
@@ -221,7 +221,7 @@ optional = false
|
|||||||
python-versions = ">=3.6.8"
|
python-versions = ">=3.6.8"
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
diagrams = ["railroad-diagrams", "jinja2"]
|
diagrams = ["jinja2", "railroad-diagrams"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest"
|
name = "pytest"
|
||||||
@@ -263,7 +263,7 @@ python-versions = ">=3.7"
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = ">= 3.10, < 3.11"
|
python-versions = ">= 3.10, < 3.11"
|
||||||
content-hash = "acab2fb183ac5598666cfb333e1dfc1e8a06eb73c7d3297de36b199e9277508c"
|
content-hash = "f3cd92de360fc68d8bc8ad0999eb5d0591e7f33dc5f20a32409b3787cac71965"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
atomicwrites = [
|
atomicwrites = [
|
||||||
|
|||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pybricks_jedi"
|
name = "pybricks_jedi"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
description = "Code completion for Pybricks."
|
description = "Code completion for Pybricks."
|
||||||
authors = ["The Pybricks Authors"]
|
authors = ["The Pybricks Authors"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">= 3.10, < 3.11"
|
python = ">= 3.10, < 3.11"
|
||||||
pybricks = "3.2.0b1-r3"
|
pybricks = "3.2.0b4"
|
||||||
jedi = "0.18.1"
|
jedi = "0.18.1"
|
||||||
typing-extensions = "4.2.0"
|
typing-extensions = "4.2.0"
|
||||||
docstring-parser = "0.14.1"
|
docstring-parser = "0.14.1"
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||||
|
|
||||||
|
## 2.3.0 - 2022-10-21
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated docs to v3.2.0b4.
|
||||||
|
|
||||||
## 2.2.0 - 2022-06-02
|
## 2.2.0 - 2022-06-02
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pybricks/ide-docs",
|
"name": "@pybricks/ide-docs",
|
||||||
"version": "2.2.0",
|
"version": "2.3.0",
|
||||||
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
version-tag-prefix "@pybricks/images/v"
|
||||||
|
version-git-message "@pybricks/images v%s"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||||
|
|
||||||
|
## 1.0.0 - 2022-10-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added new @pybricks/images package.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018-2022 The Pybricks Authors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@pybricks/images
|
||||||
|
================
|
||||||
|
|
||||||
|
Image resource for Pybricks Code.
|
||||||
|
|
||||||
Executable
+47
@@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
import pathlib
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
||||||
|
IMAGE_DIR = (
|
||||||
|
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "cad" / "output"
|
||||||
|
).resolve()
|
||||||
|
HUBS = ["move", "city", "technic", "prime", "essential"]
|
||||||
|
|
||||||
|
package_json = {
|
||||||
|
"name": "@pybricks/images",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Distribution of Pybricks images.",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/pybricks/pybricks-api",
|
||||||
|
"directory": "npm/images",
|
||||||
|
},
|
||||||
|
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure empty build directory so we don't end up with stale files
|
||||||
|
shutil.rmtree(BUILD_DIR, True)
|
||||||
|
BUILD_DIR.mkdir()
|
||||||
|
|
||||||
|
# copy the hub images
|
||||||
|
for h in HUBS:
|
||||||
|
shutil.copyfile(IMAGE_DIR / f"hub-{h}.png", BUILD_DIR / f"hub-{h}.png")
|
||||||
|
|
||||||
|
# generate package.json file
|
||||||
|
|
||||||
|
# create "exports" item for hub images.
|
||||||
|
package_json["exports"] = {f"./hub-{h}.png": f"./hub-{h}.png" for h in HUBS}
|
||||||
|
|
||||||
|
with open(BUILD_DIR / "package.json", "w") as f:
|
||||||
|
json.dump(package_json, f, indent=2)
|
||||||
|
|
||||||
|
# copy additional files
|
||||||
|
|
||||||
|
ROOT_DIR = (pathlib.Path(__file__).parent).resolve()
|
||||||
|
|
||||||
|
for file in "README.md", "CHANGELOG.md", "LICENSE":
|
||||||
|
shutil.copy(ROOT_DIR / file, BUILD_DIR / file)
|
||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||||
|
|
||||||
|
## 1.1.0 - 2022-10-21
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated `pybricks_jedi` Python package to v1.2.0.
|
||||||
|
|
||||||
## 1.0.1 - 2022-09-07
|
## 1.0.1 - 2022-09-07
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
|||||||
|
|
||||||
package_json = {
|
package_json = {
|
||||||
"name": "@pybricks/jedi",
|
"name": "@pybricks/jedi",
|
||||||
"version": "1.0.1",
|
"version": "1.2.0",
|
||||||
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
|
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -38,7 +38,7 @@ subprocess.check_call(
|
|||||||
"pip",
|
"pip",
|
||||||
"download",
|
"download",
|
||||||
"--only-binary=any",
|
"--only-binary=any",
|
||||||
"pybricks-jedi==1.1.0",
|
"pybricks-jedi==1.2.0",
|
||||||
],
|
],
|
||||||
cwd=BUILD_DIR,
|
cwd=BUILD_DIR,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user