Skip to content

Commit 59cf9ab

Browse files
authored
Merge pull request #1850 from cuthbertLab/github-uv
Run github tests w/ uv instead of pip
2 parents 3199e34 + d76dc81 commit 59cf9ab

File tree

4 files changed

+66
-25
lines changed

4 files changed

+66
-25
lines changed

.github/scripts/install_ubuntu_deps.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ 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
1412
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,19 @@ 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
29+
- name: Install dependencies
30+
run: |
31+
uv pip install --system -e '.[dev]'
2332
- name: Install Ubuntu dependencies
2433
run: ./.github/scripts/install_ubuntu_deps.sh
2534
- name: Setup Lilypond
@@ -42,19 +51,22 @@ jobs:
4251
with:
4352
python-version: '3.14'
4453
cache: 'pip'
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@v7
56+
with:
57+
enable-cache: true
58+
cache-dependency-glob: |
59+
pyproject.toml
4560
- name: Install dependencies
4661
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
62+
uv pip install --system -e '.[dev]'
5163
- name: Install music21 in editable mode
5264
run: |
53-
python -m pip install -e .
65+
uv pip install --system -e .
5466
- name: Lint with pylint
5567
run: |
56-
pylint -j0 music21
57-
pylint -j0 documentation
68+
uv run pylint -j0 music21
69+
uv run pylint -j0 documentation
5870
5971
ruff:
6072
runs-on: ubuntu-latest
@@ -65,16 +77,19 @@ jobs:
6577
with:
6678
python-version: '3.14'
6779
cache: 'pip'
80+
- name: Install uv
81+
uses: astral-sh/setup-uv@v7
82+
with:
83+
enable-cache: true
84+
cache-dependency-glob: |
85+
pyproject.toml
6886
- name: Install dependencies
6987
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
88+
uv pip install --system -e '.[dev]'
7489
- name: Code-style etc. with Ruff
7590
run: |
76-
ruff check music21
77-
ruff check documentation
91+
uv run ruff check music21
92+
uv run ruff check documentation
7893
7994
mypy:
8095
runs-on: ubuntu-latest
@@ -85,11 +100,15 @@ jobs:
85100
with:
86101
python-version: '3.14'
87102
cache: 'pip'
103+
- name: Install uv
104+
uses: astral-sh/setup-uv@v7
105+
with:
106+
enable-cache: true
107+
cache-dependency-glob: |
108+
pyproject.toml
88109
- name: Install dependencies
89110
run: |
90-
pip install wheel
91-
python -m pip install -r requirements.txt
92-
python -m pip install -r requirements_dev.txt
111+
uv pip install --system -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)