Skip to content

Commit 5bf732e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into doc-ja
# Conflicts: # doc/common/conf.py
2 parents f1e7b4f + e610a0a commit 5bf732e

657 files changed

Lines changed: 8829 additions & 336228 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build.yml‎

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,28 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: Build Python package and docs
52

6-
on:
7-
push:
8-
tags-ignore:
9-
- '**'
10-
pull_request:
11-
paths:
12-
- doc/**
13-
- src/**
14-
- poetry.lock
15-
- poetry.toml
16-
- pyproject.toml
17-
- setup.cfg
18-
3+
on: push
194

205
jobs:
216
build:
227

23-
runs-on: ubuntu-22.04
8+
runs-on: ubuntu-24.04
249
steps:
2510
- uses: actions/checkout@v6
2611
with:
2712
submodules: recursive
2813
- name: Install dependencies
2914
run: |
30-
pip install poetry
31-
poetry run python -m pip install --upgrade pip
32-
poetry run python -m pip install --upgrade setuptools
15+
pipx install poetry
3316
poetry install
3417
- name: Lint Python code
35-
run: poetry run flake8
18+
run: poetry run ruff check
19+
- name: Check Python formatting
20+
run: poetry run ruff format --check
3621
- name: Build package
3722
run: poetry build
3823
- name: Lint docs
3924
run: poetry run doc8
4025
- name: Build html docs for Read the Docs
4126
run: poetry run make -C doc html
42-
- name: Install IDE docs dependencies
43-
run: |
44-
sudo apt-get update
45-
sudo apt-get install dvisvgm preview-latex-style texlive texlive-fonts-extra texlive-latex-extra
4627
- name: Build html docs for Pybricks Code IDE
4728
run: poetry run make -C doc html TAG=ide

‎.github/workflows/jedi.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [push, pull_request]
55
jobs:
66
test:
77
if: github.ref_type != 'tag'
8-
runs-on: ubuntu-22.04
8+
runs-on: ubuntu-24.04
99
steps:
1010
- uses: actions/checkout@v6
1111
- run: pipx install poetry

‎.github/workflows/publish-ide-docs.yml‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
publish_ide_docs:
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Get version from tag
1717
run: |
@@ -20,24 +20,14 @@ jobs:
2020
echo "VERSION=$VERSION" >> $GITHUB_ENV
2121
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_ENV
2222
echo "NPM_TAG=$(echo "$NPM_VERSION" | grep -q '-' && echo 'next' || echo 'latest')" >> $GITHUB_ENV
23-
- name: Ubuntu packages
24-
run: |
25-
sudo apt-get update
26-
sudo apt-get install -y dvisvgm preview-latex-style texlive texlive-fonts-extra texlive-latex-extra
2723
- uses: actions/checkout@v6
2824
with:
2925
submodules: recursive
30-
- name: Set up Python 3.8
31-
uses: actions/setup-python@v5
32-
with:
33-
python-version: 3.8
3426
- name: Install dependencies
3527
run: |
36-
pip install poetry
37-
poetry run python -m pip install --upgrade pip
38-
poetry run python -m pip install --upgrade setuptools
28+
pipx install poetry
3929
poetry install --only=doc
40-
- uses: actions/setup-node@v4
30+
- uses: actions/setup-node@v6
4131
with:
4232
node-version: '24'
4333
registry-url: 'https://registry.npmjs.org'

‎.github/workflows/publish-images.yml‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎.github/workflows/publish-jedi.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
publish_jedi:
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515
steps:
1616
- uses: actions/checkout@v6
1717
- name: Get version from tag
@@ -21,10 +21,6 @@ jobs:
2121
echo "VERSION=$VERSION" >> $GITHUB_ENV
2222
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_ENV
2323
echo "NPM_TAG=$(echo "$NPM_VERSION" | grep -q '-' && echo 'next' || echo 'latest')" >> $GITHUB_ENV
24-
- name: Set up Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: '3.11'
2824
- name: Install poetry
2925
run: pipx install poetry
3026
- name: Set pybricks-jedi version
@@ -34,7 +30,7 @@ jobs:
3430
run: |
3531
poetry version "$VERSION"
3632
sed -i "s/^pybricks = \".*\"/pybricks = \"$VERSION\"/" jedi/pyproject.toml
37-
- uses: actions/setup-node@v4
33+
- uses: actions/setup-node@v6
3834
with:
3935
node-version: '24'
4036
registry-url: 'https://registry.npmjs.org'

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
create_release:
1313
name: Create release on GitHub
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v6
@@ -36,7 +36,7 @@ jobs:
3636
-F CHANGELOG.md \
3737
$PRERELEASE_FLAG
3838
build_and_publish:
39-
runs-on: ubuntu-22.04
39+
runs-on: ubuntu-24.04
4040
steps:
4141
- uses: actions/checkout@v6
4242
- run: pipx run poetry build

‎.readthedocs.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
version: 2
77

88
build:
9-
os: "ubuntu-22.04"
9+
os: "ubuntu-24.04"
1010
tools:
11-
python: "3.10"
11+
python: "3.12"
1212
jobs:
1313
post_create_environment:
1414
- pip install poetry
@@ -18,7 +18,3 @@ build:
1818
# Build documentation in the doc/main/ directory with Sphinx
1919
sphinx:
2020
configuration: doc/main/conf.py
21-
22-
# Optionally build your docs in additional formats such as PDF
23-
formats:
24-
- pdf

‎.vscode/extensions.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// List of extensions which should be recommended for users of this workspace.
66
"recommendations": [
77
"ms-python.python",
8-
"ms-python.black-formatter"
8+
"charliermarsh.ruff"
99
],
1010
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
1111
"unwantedRecommendations": [
1212
]
13-
}
13+
}

‎.vscode/settings.json‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@
44
},
55
"python.defaultInterpreterPath": ".venv/bin/python",
66
"python.autoComplete.extraPaths": ["jedi/src"],
7-
"python.formatting.provider": "none",
8-
"python.linting.pylintEnabled": false,
9-
"python.linting.flake8Enabled": true,
10-
"python.linting.pycodestyleEnabled": false,
11-
"python.linting.enabled": true,
127
"[python]": {
138
"editor.formatOnSave": true,
14-
"editor.defaultFormatter": "ms-python.black-formatter"
9+
"editor.defaultFormatter": "charliermarsh.ruff"
1510
},
1611
"python.languageServer": "Pylance",
1712
"python.testing.pytestArgs": [

‎build-all.sh‎

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ set -euo pipefail
44

55
REPO_ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
66

7+
# Option: --pybricks-code <path> copies built npm packages into that
8+
# checkout's node_modules/@pybricks/ for easy local testing.
9+
PYBRICKS_CODE=""
10+
while [[ $# -gt 0 ]]; do
11+
case "$1" in
12+
--pybricks-code)
13+
PYBRICKS_CODE="$(realpath "$2")"
14+
shift 2
15+
;;
16+
*)
17+
echo "usage: $0 [--pybricks-code <path-to-pybricks-code-checkout>]" >&2
18+
exit 1
19+
;;
20+
esac
21+
done
22+
if [[ -n "$PYBRICKS_CODE" && ! -d "$PYBRICKS_CODE/node_modules/@pybricks" ]]; then
23+
echo "error: $PYBRICKS_CODE/node_modules/@pybricks not found (run yarn install there first)" >&2
24+
exit 1
25+
fi
26+
727
# Activate the project venv so python/make/etc. all use it without poetry run
828
source "$REPO_ROOT/.venv/bin/activate"
929

@@ -13,30 +33,57 @@ VERSION=$(grep '^version = ' "$REPO_ROOT/pyproject.toml" | head -1 | sed 's/vers
1333
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/')
1434
echo "==> Building version $VERSION (npm: $NPM_VERSION)"
1535

16-
# lint
36+
# lint (same as CI build.yml)
1737
echo "==> Linting"
1838
cd "$REPO_ROOT"
19-
flake8
39+
ruff check
40+
ruff format --check
2041
doc8
2142

22-
# pybricks-jedi tests
43+
# Python package
44+
echo "==> Building Python package"
45+
rm -rf "$REPO_ROOT/dist" # stale wheels would get globbed into the jedi npm package
46+
poetry build
47+
48+
# pybricks-jedi tests (own poetry env, same as CI jedi.yml)
2349
echo "==> Testing pybricks-jedi"
2450
cd "$REPO_ROOT/jedi"
2551
poetry run pytest -vv
2652

2753
# @pybricks/jedi npm package
2854
echo "==> Building @pybricks/jedi"
2955
cd "$REPO_ROOT/jedi"
56+
rm -rf dist # build.py globs dist/*.whl, stale wheels would get shipped
3057
python3 build.py "$NPM_VERSION"
3158

32-
# @pybricks/ide-docs npm package
33-
echo "==> Building @pybricks/ide-docs"
59+
# html docs for Read the Docs
60+
echo "==> Building Read the Docs html docs"
3461
cd "$REPO_ROOT"
62+
make -C doc clean html
63+
64+
# @pybricks/ide-docs npm package (builds the TAG=ide docs)
65+
echo "==> Building @pybricks/ide-docs"
3566
make -C doc clean
3667
cd "$REPO_ROOT/npm/ide-docs"
3768
yarn build
3869

3970
echo ""
4071
echo "Build complete."
72+
echo " python package : dist/"
4173
echo " jedi npm package : jedi/npm-build/"
4274
echo " ide-docs : npm/ide-docs/html/"
75+
76+
if [[ -n "$PYBRICKS_CODE" ]]; then
77+
DEST="$PYBRICKS_CODE/node_modules/@pybricks"
78+
echo "==> Copying packages to $DEST"
79+
rm -rf "$DEST/jedi" "$DEST/ide-docs"
80+
mkdir -p "$DEST/jedi" "$DEST/ide-docs"
81+
cp -r "$REPO_ROOT/jedi/npm-build/." "$DEST/jedi/"
82+
cp -r "$REPO_ROOT/npm/ide-docs/package.json" \
83+
"$REPO_ROOT/npm/ide-docs/LICENSE" \
84+
"$REPO_ROOT/npm/ide-docs/README.md" \
85+
"$REPO_ROOT/npm/ide-docs/html" \
86+
"$DEST/ide-docs/"
87+
echo "Copied @pybricks/jedi and @pybricks/ide-docs. Restart the dev server to pick them up."
88+
fi
89+

0 commit comments

Comments
 (0)