From ab3fe80277cba991bd760f906f953bf117c80132 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 26 Jul 2026 11:21:53 +0000 Subject: [PATCH] Move Python package from src/palettes to lib/palettes. Reserve src/ for C (none here yet); update tests, publish scripts, and docs to use PYTHONPATH=lib. --- .github/workflows/docs.yml | 4 ++-- .github/workflows/tests.yml | 8 ++++---- AGENTS.md | 10 +++++----- docs/getting-started.md | 2 +- {src => lib}/palettes/__init__.py | 0 {src => lib}/palettes/_cube125.py | 0 {src => lib}/palettes/_cube27.py | 0 {src => lib}/palettes/_cube64.py | 0 {src => lib}/palettes/_cube8.py | 0 {src => lib}/palettes/_material_design.py | 0 {src => lib}/palettes/cube.py | 0 {src => lib}/palettes/material_design.py | 0 {src => lib}/palettes/wheel.py | 0 scripts/publish_micropython_lib.sh | 6 +++--- 14 files changed, 15 insertions(+), 15 deletions(-) rename {src => lib}/palettes/__init__.py (100%) rename {src => lib}/palettes/_cube125.py (100%) rename {src => lib}/palettes/_cube27.py (100%) rename {src => lib}/palettes/_cube64.py (100%) rename {src => lib}/palettes/_cube8.py (100%) rename {src => lib}/palettes/_material_design.py (100%) rename {src => lib}/palettes/cube.py (100%) rename {src => lib}/palettes/material_design.py (100%) rename {src => lib}/palettes/wheel.py (100%) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b94f11d..9bf316c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 78f6515..4db8da5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,12 +4,12 @@ on: push: branches: [main] paths: - - 'src/**' + - 'lib/**' - 'tests/**' - 'scripts/**' pull_request: paths: - - 'src/**' + - 'lib/**' - 'tests/**' - 'scripts/**' workflow_dispatch: @@ -25,8 +25,8 @@ jobs: - 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 + PYTHONPATH: lib run: python -m unittest discover -s tests diff --git a/AGENTS.md b/AGENTS.md index 52b6cf0..c485409 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,13 +6,13 @@ Color palette toolkit for pydisplay (`import palettes`). - Python venv at `.venv` — `.venv/bin/python`, `.venv/bin/ruff` - No runtime dependencies on other pydisplay packages -- Source layout: `src/palettes/` (import name `palettes`) +- Source layout: `lib/palettes/` (import name `palettes`) ## 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 ``` ## Publishing @@ -24,9 +24,9 @@ See `PUBLISHING.md`. The Cloud Agent update script creates the repo-root `.venv` (with `ruff`). Since `palettes` is a source-only package (not pip-installed), the `unittest discover` -command above needs `src/` on the path — the bare command fails with -`ModuleNotFoundError: No module named 'palettes'`. Mirror CI (`env: PYTHONPATH: src`): +command above needs `lib/` on the path — the bare command fails with +`ModuleNotFoundError: No module named 'palettes'`. Mirror CI (`env: PYTHONPATH: lib`): ```bash -PYTHONPATH=src .venv/bin/python -m unittest discover -s tests +PYTHONPATH=lib .venv/bin/python -m unittest discover -s tests ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index 91975e8..abe1d89 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -9,7 +9,7 @@ import mip mip.install("palettes", index="https://PyDevices.github.io/micropython-lib/mip/PyDevices") ``` -Development clone — put `src/` on `PYTHONPATH` or copy `src/palettes/` to your device. +Development clone — put `lib/` on `PYTHONPATH` or copy `lib/palettes/` to your device. ## Basic usage diff --git a/src/palettes/__init__.py b/lib/palettes/__init__.py similarity index 100% rename from src/palettes/__init__.py rename to lib/palettes/__init__.py diff --git a/src/palettes/_cube125.py b/lib/palettes/_cube125.py similarity index 100% rename from src/palettes/_cube125.py rename to lib/palettes/_cube125.py diff --git a/src/palettes/_cube27.py b/lib/palettes/_cube27.py similarity index 100% rename from src/palettes/_cube27.py rename to lib/palettes/_cube27.py diff --git a/src/palettes/_cube64.py b/lib/palettes/_cube64.py similarity index 100% rename from src/palettes/_cube64.py rename to lib/palettes/_cube64.py diff --git a/src/palettes/_cube8.py b/lib/palettes/_cube8.py similarity index 100% rename from src/palettes/_cube8.py rename to lib/palettes/_cube8.py diff --git a/src/palettes/_material_design.py b/lib/palettes/_material_design.py similarity index 100% rename from src/palettes/_material_design.py rename to lib/palettes/_material_design.py diff --git a/src/palettes/cube.py b/lib/palettes/cube.py similarity index 100% rename from src/palettes/cube.py rename to lib/palettes/cube.py diff --git a/src/palettes/material_design.py b/lib/palettes/material_design.py similarity index 100% rename from src/palettes/material_design.py rename to lib/palettes/material_design.py diff --git a/src/palettes/wheel.py b/lib/palettes/wheel.py similarity index 100% rename from src/palettes/wheel.py rename to lib/palettes/wheel.py diff --git a/scripts/publish_micropython_lib.sh b/scripts/publish_micropython_lib.sh index 80b5062..326847d 100755 --- a/scripts/publish_micropython_lib.sh +++ b/scripts/publish_micropython_lib.sh @@ -16,7 +16,7 @@ usage() { cat <<'EOF' Usage: ./scripts/publish_micropython_lib.sh [OPTION] -Copy palettes src/ into micropython-lib, optionally upload TestPyPI wheels, +Copy palettes lib/ into micropython-lib, optionally upload TestPyPI wheels, then commit (and optionally push) on the PyDevices branch. Options: @@ -91,7 +91,7 @@ PYPI_NAME=palettes 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/palettes +SOURCE_DIR=$SOURCE_REPO/lib/palettes DEST_DIR=$DEST_REPO/micropython/$BASENAME PYPI_DIR=$SOURCE_REPO/wheels README_FULL_PATH=$SOURCE_REPO/README.md @@ -147,7 +147,7 @@ push_micropython_lib() { echo echo "Processing $BASENAME" mkdir -p "$DEST_DIR/$BASENAME" -# --delete drops removed modules so the sync matches src/ +# --delete drops removed modules so the sync matches lib/ rsync -a --delete "${RSYNC_EXCLUDES[@]}" "$SOURCE_DIR/" "$DEST_DIR/$BASENAME/" cat < "$DEST_DIR/manifest.py"