Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
- 'docs/**'
- 'mkdocs.yml'
- 'scripts/mkdocs_gen_ref_pages.py'
- 'src/**'
- 'lib/**'
pull_request:
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'scripts/mkdocs_gen_ref_pages.py'
- 'src/**'
- 'lib/**'
workflow_dispatch:

jobs:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
push:
branches: [main]
paths:
- 'src/**'
- 'lib/**'
- 'tests/**'
- 'scripts/**'
pull_request:
paths:
- 'src/**'
- 'lib/**'
- 'tests/**'
- 'scripts/**'
workflow_dispatch:
Expand All @@ -25,23 +25,29 @@ jobs:
path: pydisplay
sparse-checkout: |
src/lib
/src/add_ons/framebuf.py
sparse-checkout-cone-mode: false
- uses: actions/checkout@v4
with:
repository: PyDevices/graphics
path: graphics
sparse-checkout: |
lib/graphics
sparse-checkout-cone-mode: false
- uses: actions/checkout@v4
with:
repository: PyDevices/palettes
path: palettes
sparse-checkout: |
src/palettes
lib/palettes
sparse-checkout-cone-mode: false
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install ruff
run: pip install ruff
- name: Ruff
run: ruff check src tests scripts
run: ruff check lib tests scripts
- name: Unit tests
env:
PYTHONPATH: src:tests/stubs:pydisplay/src/lib:pydisplay/src/add_ons:palettes/src
PYTHONPATH: lib:tests/stubs:pydisplay/src/lib:graphics/lib:palettes/lib
run: python -m unittest discover -s tests
10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Cross-platform widget toolkit for pydisplay (`import pdwidgets`).

- Python venv at `.venv` — `.venv/bin/python`, `.venv/bin/ruff`
- Depends on pydisplay packages: `eventsys`, `graphics`, `multimer`, `palettes`
- Source layout: `src/pdwidgets/` (import name `pdwidgets`)
- Source layout: `lib/pdwidgets/` (import name `pdwidgets`)

## Tests and lint

```bash
.venv/bin/python -m unittest discover -s tests
.venv/bin/ruff check src tests scripts
.venv/bin/ruff check lib tests scripts
```

Headless bench (needs pydisplay `board_config` on path):
Expand Down Expand Up @@ -45,10 +45,10 @@ multi-repo workspace `palettes` comes from the sibling `palettes` repo (not
pydisplay's `add_ons`, unlike CI's sparse-checkout):

```bash
PYTHONPATH="src:tests/stubs:/agent/repos/palettes/src:/agent/repos/pydisplay/src/lib:/agent/repos/pydisplay/src/add_ons" \
PYTHONPATH="lib:tests/stubs:/agent/repos/palettes/lib:/agent/repos/graphics/lib:/agent/repos/pydisplay/src/lib" \
.venv/bin/python -m unittest discover -s tests
```

The pydisplay repo's `.venv` also gets a `pydevices_siblings.pth` (added by the
update script) listing `palettes/src` and `pdwidgets/src`, so pydisplay examples
that import them run in the cross-runtime matrix.
update script) listing `palettes/lib`, `pdwidgets/lib`, and `graphics/lib`, so
pydisplay examples that import them run in the cross-runtime matrix.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Cross-platform widget toolkit for [pydisplay](https://github.com/PyDevices/pydis
pip install \
-i https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
pdwidgets displaysys pydisplay-graphics eventsys multimer palettes
pdwidgets displaysys graphics-py eventsys multimer palettes
```

Requires a pydisplay `board_config` and display stack.
Expand Down Expand Up @@ -62,7 +62,7 @@ MIT — see [LICENSE](LICENSE).

## Icon assets (maintainers)

Runtime icons are **importable Python modules** under [`src/pdwidgets/icons/`](src/pdwidgets/icons/)
Runtime icons are **importable Python modules** under [`lib/pdwidgets/icons/`](lib/pdwidgets/icons/)
(no binary mip). Authoring:

```bash
Expand Down
2 changes: 1 addition & 1 deletion assets/icons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Source PNGs: https://github.com/google/material-design-icons/tree/master/png

Regenerate with ``scripts/assets_convert_md_png_to_pbm.py`` (bulk tree) from the
pdwidgets repo root. This tree is **not** the runtime widget set —
see [`src/pdwidgets/icons/`](../src/pdwidgets/icons/) for icons shipped with the
see [`lib/pdwidgets/icons/`](../lib/pdwidgets/icons/) for icons shipped with the
package (``.py`` modules via ``scripts/assets_icons_to_py.py`` after the
Material Design generate / color scripts).

Expand Down
4 changes: 2 additions & 2 deletions ci/github-workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
- 'docs/**'
- 'mkdocs.yml'
- 'scripts/mkdocs_gen_ref_pages.py'
- 'src/**'
- 'lib/**'
pull_request:
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'scripts/mkdocs_gen_ref_pages.py'
- 'src/**'
- 'lib/**'
workflow_dispatch:

jobs:
Expand Down
24 changes: 18 additions & 6 deletions ci/github-workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
push:
branches: [main]
paths:
- 'src/**'
- 'lib/**'
- 'tests/**'
- 'scripts/**'
pull_request:
paths:
- 'src/**'
- 'lib/**'
- 'tests/**'
- 'scripts/**'
workflow_dispatch:
Expand All @@ -25,17 +25,29 @@ jobs:
path: pydisplay
sparse-checkout: |
src/lib
src/add_ons/palettes
/src/add_ons/framebuf.py
sparse-checkout-cone-mode: false
- uses: actions/checkout@v4
with:
repository: PyDevices/graphics
path: graphics
sparse-checkout: |
lib/graphics
sparse-checkout-cone-mode: false
- uses: actions/checkout@v4
with:
repository: PyDevices/palettes
path: palettes
sparse-checkout: |
lib/palettes
sparse-checkout-cone-mode: false
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install ruff
run: pip install ruff
- name: Ruff
run: ruff check src tests scripts
run: ruff check lib tests scripts
- name: Unit tests
env:
PYTHONPATH: src:tests/stubs:pydisplay/src/lib:pydisplay/src/add_ons
PYTHONPATH: lib:tests/stubs:pydisplay/src/lib:graphics/lib:palettes/lib
run: python -m unittest discover -s tests
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ package):

## Icons

Runtime widget icons live under [`src/pdwidgets/icons/`](https://github.com/PyDevices/pdwidgets/tree/main/src/pdwidgets/icons)
Runtime widget icons live under [`lib/pdwidgets/icons/`](https://github.com/PyDevices/pdwidgets/tree/main/lib/pdwidgets/icons)
as importable ``.py`` modules. Regenerate with the Material Design scripts plus
`scripts/assets_icons_to_py.py` (see the [repo README](https://github.com/PyDevices/pdwidgets#icon-assets)).

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Wheels are published to [TestPyPI](https://test.pypi.org/project/pdwidgets/) for
pip install \
-i https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
pdwidgets displaysys pydisplay-graphics eventsys multimer palettes
pdwidgets displaysys graphics-py eventsys multimer palettes
```

You also need a pydisplay `board_config` for your display backend. See [pydisplay desktop quick start](https://pydisplay.readthedocs.io/en/latest/guides/desktop-cpython/).
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.ruff]
exclude = [
"src/pdwidgets/icons/**",
"lib/pdwidgets/icons/**",
]
lint.select = ["E", "F", "I", "W", "B", "SIM", "PLC0415"]
# SIM105 disabled: contextlib.suppress is not available on MicroPython (matches
Expand Down
2 changes: 1 addition & 1 deletion scripts/assets_convert_md_png_to_pbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<material-design-icons>/png/action/3d_rotation/materialicons/18dp/1x/baseline_3d_rotation_black_18dp.png

For the curated runtime set under ``src/pdwidgets/icons/``, use
For the curated runtime set under ``lib/pdwidgets/icons/``, use
``assets_generate_pdwidgets_icons.py`` instead.

Run from the pdwidgets repo root (needs sibling pydisplay for ``graphics`` /
Expand Down
2 changes: 1 addition & 1 deletion scripts/assets_generate_pdwidgets_icons.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
Generate/complete the curated icon set used by ``pdwidgets.icon_theme``
(``src/pdwidgets/icons/``) from a local checkout of
(``lib/pdwidgets/icons/``) from a local checkout of
https://github.com/google/material-design-icons (png/ tree), at
``~/material-design-icons`` by default.

Expand Down
6 changes: 3 additions & 3 deletions scripts/assets_icons_to_py.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""
Convert ``src/pdwidgets/icons/*.{pbm,bmp}`` into importable ``.py`` modules.
Convert ``lib/pdwidgets/icons/*.{pbm,bmp}`` into importable ``.py`` modules.

Installs ``pydisplay-graphics`` from TestPyPI (unless already importable), or
Installs ``graphics-py`` from TestPyPI (unless already importable), or
uses sibling ``pydisplay/src/lib`` when present. Loads each binary via
``FrameBuffer.from_file``, then writes modules via ``FrameBuffer.export``
(``BITMAP = bytearray(...)`` for zero-copy MicroPython loads).
Expand Down Expand Up @@ -57,7 +57,7 @@ def ensure_graphics(*, install: bool) -> None:
"https://test.pypi.org/simple/",
"--extra-index-url",
"https://pypi.org/simple/",
"pydisplay-graphics",
"graphics-py",
]
print("Running:", " ".join(cmd))
subprocess.check_call(cmd)
Expand Down
2 changes: 1 addition & 1 deletion scripts/assets_make_color_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Material Design icons are monochrome black glyphs on transparency. This tool
fetches a few individual PNGs from ``google/material-design-icons`` (via the
GitHub Contents API — no clone), colorizes each glyph with a chosen accent, and
writes a BMP565 file into ``src/pdwidgets/icons/``. Non-glyph pixels are set to
writes a BMP565 file into ``lib/pdwidgets/icons/``. Non-glyph pixels are set to
a magenta chroma key so ``pdwidgets.Icon(chroma=CHROMA_565)`` can render them
with a transparent background. No PNG is shipped or decoded at runtime.

Expand Down
8 changes: 4 additions & 4 deletions scripts/publish_micropython_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ usage() {
cat <<'EOF'
Usage: ./scripts/publish_micropython_lib.sh [OPTION]

Copy pdwidgets src/ into micropython-lib, optionally upload TestPyPI wheels,
Copy pdwidgets lib/ into micropython-lib, optionally upload TestPyPI wheels,
then commit (and optionally push) on the PyDevices branch.

Options:
Expand Down Expand Up @@ -90,7 +90,7 @@ BASENAME=pdwidgets
DEST_REPO="${MICROPYTHON_LIB_DIR:-$SOURCE_REPO/../micropython-lib}"
DEST_REPO="$(cd "$DEST_REPO" 2>/dev/null && pwd || echo "$DEST_REPO")"
export MICROPYTHON_LIB_DIR="$DEST_REPO"
SOURCE_DIR=$SOURCE_REPO/src/pdwidgets
SOURCE_DIR=$SOURCE_REPO/lib/pdwidgets
DEST_DIR=$DEST_REPO/micropython/$BASENAME
PYPI_DIR=$SOURCE_REPO/wheels
README_FULL_PATH=$SOURCE_REPO/README.md
Expand Down Expand Up @@ -146,7 +146,7 @@ push_micropython_lib() {
echo
echo "Processing $BASENAME"
mkdir -p "$DEST_DIR/$BASENAME"
# --delete drops removed assets (e.g. old .pbm/.bmp icons) so the sync matches src/
# --delete drops removed assets (e.g. old .pbm/.bmp icons) so the sync matches lib/
rsync -a --delete "${RSYNC_EXCLUDES[@]}" "$SOURCE_DIR/" "$DEST_DIR/$BASENAME/"

cat <<EOF > "$DEST_DIR/manifest.py"
Expand All @@ -158,7 +158,7 @@ metadata(
pypi_publish="$BASENAME",
)
require("eventsys")
require("graphics", pypi="pydisplay-graphics")
require("graphics", pypi="graphics-py")
require("multimer")
require("palettes")
package("$BASENAME")
Expand Down
1 change: 0 additions & 1 deletion tests/test_button_backdrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from unittest.mock import MagicMock, PropertyMock, patch

from graphics import Area

from pdwidgets.widgets.button import Button


Expand Down
2 changes: 1 addition & 1 deletion tests/test_raised.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_row_cache_reuses_recipe(self):
)
self.assertEqual(len(fb_a.fills), len(fb_b.fills))
# Same relative insets/colors (absolute x/y shifted).
for a, b in zip(fb_a.fills, fb_b.fills):
for a, b in zip(fb_a.fills, fb_b.fills, strict=True):
self.assertEqual(a[0] + 4, b[0])
self.assertEqual(a[1] + 5, b[1])
self.assertEqual(a[2:], b[2:])
Expand Down
Loading