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
29 changes: 15 additions & 14 deletions .github/workflows/maincheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
python-version: [3.11, 3.12, 3.13, 3.14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
Expand All @@ -26,28 +26,29 @@ jobs:
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Install dependencies
run: |
uv pip install --system -e '.[dev]'
uv sync --locked
- name: Install Ubuntu dependencies
run: ./.github/scripts/install_ubuntu_deps.sh
- name: Setup Lilypond
run: python -c 'from music21 import environment; environment.UserSettings()["lilypondPath"] = "/home/runner/bin/lilypond"'
run: uv run python -c 'from music21 import environment; environment.UserSettings()["lilypondPath"] = "/home/runner/bin/lilypond"'
- name: Run Main Test script
run: python -c 'from music21.test.testSingleCoreAll import ciMain as ci; ci()'
run: uv run python -c 'from music21.test.testSingleCoreAll import ciMain as ci; ci()'
- name: Coveralls
if: ${{ matrix.python-version == '3.12' }}
env: # when changing number above also change coverageM21.getCoverage
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: coveralls
run: uv run coveralls

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install uv
Expand All @@ -56,12 +57,10 @@ jobs:
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Install dependencies
run: |
uv pip install --system -e '.[dev]'
- name: Install music21 in editable mode
run: |
uv pip install --system -e .
uv sync --locked
- name: Lint with pylint
run: |
uv run pylint -j0 music21
Expand All @@ -72,7 +71,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install uv
Expand All @@ -81,9 +80,10 @@ jobs:
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Install dependencies
run: |
uv pip install --system -e '.[dev]'
uv sync --locked
- name: Code-style etc. with Ruff
run: |
uv run ruff check music21
Expand All @@ -94,7 +94,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install uv
Expand All @@ -103,9 +103,10 @@ jobs:
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Install dependencies
run: |
uv pip install --system -e '.[dev]'
uv sync --locked
- name: Type-check all modules with mypy
run: |
uv run mypy music21
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ __pycache__/
.mypy_cache/**
**/.mypy_cache/**

# we are a library, don't lock the requirements
uv.lock

# PyCharm ignore
# Keep the dictionary to help new users...
.idea/codeStyles
Expand Down
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
- All PRs need to be declared AI-assisted.
- 10 or more lines of code written by an agent needs to be declared as AI-assisted in the docstring. Humans can remove and should remove this note when they do a review.

# Setup

- `uv sync` installs runtime deps + the `dev` group, which self-references `music21[extras]`,
so scipy and python-Levenshtein come along automatically. Tests will not pass without them.

# Worktrees

- When creating a new worktree, create a new virtual environment with `uv sync`.
15 changes: 2 additions & 13 deletions documentation/source/developerReference/developerGuidelines.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,7 @@
},
{
"cell_type": "markdown",
"source": [
"## Preparing to Contribute ##\n",
"\n",
"Be sure to install all requirements in `requirements_dev.txt` via:\n",
"\n",
"```\n",
"pip3 install -r requirements_dev.txt\n",
"```\n",
"\n",
"There are several tools needed for fully testing music21 that aren't included\n",
"in the standard `requirements.txt`."
],
"source": "## Preparing to Contribute ##\n\nThe recommended setup uses [uv](https://docs.astral.sh/uv/). From the repository root:\n\n```\nuv sync\n```\n\nThis creates a virtual environment in `.venv/` and installs runtime dependencies plus the\n`dev` dependency group. The `dev` group self-references `music21[extras]`, so the optional\nextras (`scipy` and `python-Levenshtein`) are pulled in automatically -- the test suite will\nnot pass without them.\n\nIf you prefer pip, the equivalent is:\n\n```\npip install -r requirements_dev.txt\npip install -e '.[extras]'\n```",
"metadata": {
"collapsed": false
}
Expand Down Expand Up @@ -311,4 +300,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ dependencies = [
]

[project.optional-dependencies]
extras = [
'python-Levenshtein',
'scipy',
]

[dependency-groups]
# `dev` pulls in every extra via the `music21[extras]` self-reference
# so `uv sync` alone is enough to develop and test music21.
dev = [
'music21[extras]',
'coverage',
'coveralls',
'docutils',
Expand All @@ -66,9 +75,7 @@ dev = [
'nbval',
'pylint>=3.2.0',
'pytest',
'python-Levenshtein',
'ruff',
'scipy',
'sphinx',
'twine',
'types-requests',
Expand All @@ -84,6 +91,9 @@ Download = "https://github.com/cuthbertLab/music21/releases/"
Homepage = "https://github.com/cuthbertLab/music21"
Documentation = "https://www.music21.org/music21docs/"

[tool.uv]
default-groups = ["dev"]

[tool.hatch.version]
path = "music21/_version.py"

Expand Down
Loading
Loading