From 4e21c3bbcfd0b36007dff0fc67216bb8aeb818ab Mon Sep 17 00:00:00 2001 From: Michael Scott Asato Cuthbert Date: Sun, 4 Jan 2026 16:25:27 -1000 Subject: [PATCH 1/3] Run github tests w/ uv instead of pip --- .github/scripts/install_ubuntu_deps.sh | 4 +- .github/workflows/maincheck.yml | 55 +++++++++++++++++--------- documentation/nbvalNotebook.py | 12 +++--- pyproject.toml | 22 +++++++++++ 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/.github/scripts/install_ubuntu_deps.sh b/.github/scripts/install_ubuntu_deps.sh index 31a3751940..a36b74d9ba 100755 --- a/.github/scripts/install_ubuntu_deps.sh +++ b/.github/scripts/install_ubuntu_deps.sh @@ -9,6 +9,6 @@ sudo apt-get install -y libpng-dev wget -q https://lilypond.org/download/binaries/linux-64/lilypond-2.22.1-1.linux-64.sh sh lilypond-2.22.1-1.linux-64.sh --batch export PATH=/home/runner/bin:$PATH -pip3 install wheel -pip3 install -r requirements_dev.txt +uv pip install wheel +uv pip install -e '.[dev]' python3 -m compileall music21 diff --git a/.github/workflows/maincheck.yml b/.github/workflows/maincheck.yml index 7b21a16de4..b32fe874df 100644 --- a/.github/workflows/maincheck.yml +++ b/.github/workflows/maincheck.yml @@ -16,10 +16,16 @@ jobs: matrix: python-version: [3.11, 3.12, 3.13, 3.14] steps: + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + cache-dependency-glob: | + pyproject.toml - name: Install Ubuntu dependencies run: ./.github/scripts/install_ubuntu_deps.sh - name: Setup Lilypond @@ -42,19 +48,23 @@ jobs: with: python-version: '3.14' cache: 'pip' + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + cache-dependency-glob: | + pyproject.toml - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install wheel - pip install -r requirements.txt - pip install -r requirements_dev.txt + uv pip install wheel + uv pip install -e '.[dev]' - name: Install music21 in editable mode run: | - python -m pip install -e . + uv pip install -e . - name: Lint with pylint run: | - pylint -j0 music21 - pylint -j0 documentation + uv run pylint -j0 music21 + uv run pylint -j0 documentation ruff: runs-on: ubuntu-latest @@ -65,16 +75,20 @@ jobs: with: python-version: '3.14' cache: 'pip' + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + cache-dependency-glob: | + pyproject.toml - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install wheel - pip install -r requirements.txt - pip install -r requirements_dev.txt + uv pip install wheel + uv pip install -e '.[dev]' - name: Code-style etc. with Ruff run: | - ruff check music21 - ruff check documentation + uv run ruff check music21 + uv run ruff check documentation mypy: runs-on: ubuntu-latest @@ -85,11 +99,16 @@ jobs: with: python-version: '3.14' cache: 'pip' + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + cache-dependency-glob: | + pyproject.toml - name: Install dependencies run: | - pip install wheel - python -m pip install -r requirements.txt - python -m pip install -r requirements_dev.txt + uv pip install wheel + uv pip install -e '.[dev]' - name: Type-check all modules with mypy run: | - mypy music21 + uv run mypy music21 diff --git a/documentation/nbvalNotebook.py b/documentation/nbvalNotebook.py index 613a8c2103..26aee567bf 100644 --- a/documentation/nbvalNotebook.py +++ b/documentation/nbvalNotebook.py @@ -76,11 +76,13 @@ def runOne(nbFile): us['musescoreDirectPNGPath'] = '/skip' + str(museScore) # this config file changes 0x39f3a0 to 0xADDRESS. - sanitize_fn = str(common.getRootFilePath() - / 'documentation' - / 'docbuild' - / 'nbval-sanitize.cfg' - ) + sanitize_fn = str( + common.getRootFilePath() + / 'documentation' + / 'docbuild' + / 'nbval-sanitize.cfg' + ) + try: retVal = subprocess.run( ['pytest', diff --git a/pyproject.toml b/pyproject.toml index a6cf23be56..0ff7bbd428 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,28 @@ dependencies = [ "webcolors>=1.5", ] +[project.optional-dependencies] +dev = [ + 'coverage', + 'coveralls', + 'docutils', + 'hatch', + 'hatchling', + 'jupyter', + 'mypy>=1.16.0', + 'nbconvert', + 'nbval', + 'pylint>=3.2.0', + 'pytest', + 'python-Levenshtein', + 'ruff', + 'scipy', + 'sphinx', + 'twine', + 'types-requests', + 'wheel', +] + [[project.authors]] name = "Michael Scott Asato Cuthbert" email = "michael.asato.cuthbert@gmail.com" From dc37b85ba91615296d8463fa41cd0589f1049b59 Mon Sep 17 00:00:00 2001 From: Michael Scott Asato Cuthbert Date: Sun, 4 Jan 2026 16:29:43 -1000 Subject: [PATCH 2/3] system installs --- .github/scripts/install_ubuntu_deps.sh | 2 -- .github/workflows/maincheck.yml | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/scripts/install_ubuntu_deps.sh b/.github/scripts/install_ubuntu_deps.sh index a36b74d9ba..ea2035017f 100755 --- a/.github/scripts/install_ubuntu_deps.sh +++ b/.github/scripts/install_ubuntu_deps.sh @@ -9,6 +9,4 @@ sudo apt-get install -y libpng-dev wget -q https://lilypond.org/download/binaries/linux-64/lilypond-2.22.1-1.linux-64.sh sh lilypond-2.22.1-1.linux-64.sh --batch export PATH=/home/runner/bin:$PATH -uv pip install wheel -uv pip install -e '.[dev]' python3 -m compileall music21 diff --git a/.github/workflows/maincheck.yml b/.github/workflows/maincheck.yml index b32fe874df..2142412652 100644 --- a/.github/workflows/maincheck.yml +++ b/.github/workflows/maincheck.yml @@ -26,6 +26,9 @@ jobs: enable-cache: true cache-dependency-glob: | pyproject.toml + - name: Install dependencies + run: | + uv pip install --system -e '.[dev]' - name: Install Ubuntu dependencies run: ./.github/scripts/install_ubuntu_deps.sh - name: Setup Lilypond @@ -56,8 +59,7 @@ jobs: pyproject.toml - name: Install dependencies run: | - uv pip install wheel - uv pip install -e '.[dev]' + uv pip install --system -e '.[dev]' - name: Install music21 in editable mode run: | uv pip install -e . @@ -83,8 +85,7 @@ jobs: pyproject.toml - name: Install dependencies run: | - uv pip install wheel - uv pip install -e '.[dev]' + uv pip install --system -e '.[dev]' - name: Code-style etc. with Ruff run: | uv run ruff check music21 @@ -107,8 +108,7 @@ jobs: pyproject.toml - name: Install dependencies run: | - uv pip install wheel - uv pip install -e '.[dev]' + uv pip install --system -e '.[dev]' - name: Type-check all modules with mypy run: | uv run mypy music21 From d76dc81bc0c4c6ae83101785d6ea0465664def0b Mon Sep 17 00:00:00 2001 From: Michael Scott Asato Cuthbert Date: Sun, 4 Jan 2026 16:34:39 -1000 Subject: [PATCH 3/3] fix lint --- .github/workflows/maincheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maincheck.yml b/.github/workflows/maincheck.yml index 2142412652..25bc3c8b5f 100644 --- a/.github/workflows/maincheck.yml +++ b/.github/workflows/maincheck.yml @@ -62,7 +62,7 @@ jobs: uv pip install --system -e '.[dev]' - name: Install music21 in editable mode run: | - uv pip install -e . + uv pip install --system -e . - name: Lint with pylint run: | uv run pylint -j0 music21