Skip to content

Commit 4e21c3b

Browse files
committed
Run github tests w/ uv instead of pip
1 parent 3199e34 commit 4e21c3b

File tree

4 files changed

+68
-25
lines changed

4 files changed

+68
-25
lines changed

.github/scripts/install_ubuntu_deps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ sudo apt-get install -y libpng-dev
99
wget -q https://lilypond.org/download/binaries/linux-64/lilypond-2.22.1-1.linux-64.sh
1010
sh lilypond-2.22.1-1.linux-64.sh --batch
1111
export PATH=/home/runner/bin:$PATH
12-
pip3 install wheel
13-
pip3 install -r requirements_dev.txt
12+
uv pip install wheel
13+
uv pip install -e '.[dev]'
1414
python3 -m compileall music21

.github/workflows/maincheck.yml

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ jobs:
1616
matrix:
1717
python-version: [3.11, 3.12, 3.13, 3.14]
1818
steps:
19+
- uses: actions/checkout@v4
1920
- uses: actions/setup-python@v4
2021
with:
2122
python-version: ${{ matrix.python-version }}
22-
- uses: actions/checkout@v4
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v7
25+
with:
26+
enable-cache: true
27+
cache-dependency-glob: |
28+
pyproject.toml
2329
- name: Install Ubuntu dependencies
2430
run: ./.github/scripts/install_ubuntu_deps.sh
2531
- name: Setup Lilypond
@@ -42,19 +48,23 @@ jobs:
4248
with:
4349
python-version: '3.14'
4450
cache: 'pip'
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@v7
53+
with:
54+
enable-cache: true
55+
cache-dependency-glob: |
56+
pyproject.toml
4557
- name: Install dependencies
4658
run: |
47-
python -m pip install --upgrade pip
48-
pip install wheel
49-
pip install -r requirements.txt
50-
pip install -r requirements_dev.txt
59+
uv pip install wheel
60+
uv pip install -e '.[dev]'
5161
- name: Install music21 in editable mode
5262
run: |
53-
python -m pip install -e .
63+
uv pip install -e .
5464
- name: Lint with pylint
5565
run: |
56-
pylint -j0 music21
57-
pylint -j0 documentation
66+
uv run pylint -j0 music21
67+
uv run pylint -j0 documentation
5868
5969
ruff:
6070
runs-on: ubuntu-latest
@@ -65,16 +75,20 @@ jobs:
6575
with:
6676
python-version: '3.14'
6777
cache: 'pip'
78+
- name: Install uv
79+
uses: astral-sh/setup-uv@v7
80+
with:
81+
enable-cache: true
82+
cache-dependency-glob: |
83+
pyproject.toml
6884
- name: Install dependencies
6985
run: |
70-
python -m pip install --upgrade pip
71-
pip install wheel
72-
pip install -r requirements.txt
73-
pip install -r requirements_dev.txt
86+
uv pip install wheel
87+
uv pip install -e '.[dev]'
7488
- name: Code-style etc. with Ruff
7589
run: |
76-
ruff check music21
77-
ruff check documentation
90+
uv run ruff check music21
91+
uv run ruff check documentation
7892
7993
mypy:
8094
runs-on: ubuntu-latest
@@ -85,11 +99,16 @@ jobs:
8599
with:
86100
python-version: '3.14'
87101
cache: 'pip'
102+
- name: Install uv
103+
uses: astral-sh/setup-uv@v7
104+
with:
105+
enable-cache: true
106+
cache-dependency-glob: |
107+
pyproject.toml
88108
- name: Install dependencies
89109
run: |
90-
pip install wheel
91-
python -m pip install -r requirements.txt
92-
python -m pip install -r requirements_dev.txt
110+
uv pip install wheel
111+
uv pip install -e '.[dev]'
93112
- name: Type-check all modules with mypy
94113
run: |
95-
mypy music21
114+
uv run mypy music21

documentation/nbvalNotebook.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ def runOne(nbFile):
7676
us['musescoreDirectPNGPath'] = '/skip' + str(museScore)
7777

7878
# this config file changes 0x39f3a0 to 0xADDRESS.
79-
sanitize_fn = str(common.getRootFilePath()
80-
/ 'documentation'
81-
/ 'docbuild'
82-
/ 'nbval-sanitize.cfg'
83-
)
79+
sanitize_fn = str(
80+
common.getRootFilePath()
81+
/ 'documentation'
82+
/ 'docbuild'
83+
/ 'nbval-sanitize.cfg'
84+
)
85+
8486
try:
8587
retVal = subprocess.run(
8688
['pytest',

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ dependencies = [
5353
"webcolors>=1.5",
5454
]
5555

56+
[project.optional-dependencies]
57+
dev = [
58+
'coverage',
59+
'coveralls',
60+
'docutils',
61+
'hatch',
62+
'hatchling',
63+
'jupyter',
64+
'mypy>=1.16.0',
65+
'nbconvert',
66+
'nbval',
67+
'pylint>=3.2.0',
68+
'pytest',
69+
'python-Levenshtein',
70+
'ruff',
71+
'scipy',
72+
'sphinx',
73+
'twine',
74+
'types-requests',
75+
'wheel',
76+
]
77+
5678
[[project.authors]]
5779
name = "Michael Scott Asato Cuthbert"
5880
email = "michael.asato.cuthbert@gmail.com"

0 commit comments

Comments
 (0)