Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
dev

See merge request bhairava/musiclib!158
  • Loading branch information
tandav committed Jan 19, 2025
2 parents ea90931 + f6e33c3 commit a3c3ef4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_version: ['3.11', '3.12']
python_version: ['3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'

- name: Install pypa/build
run: python -m pip install --upgrade setuptools build twine
Expand Down
8 changes: 3 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
stages:
# - build
- test

variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
RUFF_CACHE_DIR: "$CI_PROJECT_DIR/.cache/ruff_cache"
MYPY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/mypy_cache"
PIP_INDEX_URL: https://pypi.tandav.me/index/

cache:
key: $CI_PROJECT_NAME
Expand All @@ -17,9 +17,8 @@ test:
stage: test
needs: []
tags:
- u61
- docker
image: python:3.12
image: python:3.13@sha256:d57ec66c94b9497b9f3c66f6cdddc1e4e0bad4c584397e0b57a721baef0e6fdc
script:
- pip install .[dev]
- pytest --cov musiclib --cov-report term --cov-report xml --junitxml report.xml
Expand All @@ -37,9 +36,8 @@ lint:
stage: test
needs: []
tags:
- u61
- docker
image: python:3.12
image: python:3.13@sha256:d57ec66c94b9497b9f3c66f6cdddc1e4e0bad4c584397e0b57a721baef0e6fdc
script:
- pip install .[dev]
- pre-commit run --all-files
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-yaml
Expand All @@ -27,7 +27,7 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.1
hooks:
- id: pyupgrade

Expand All @@ -42,7 +42,7 @@ repos:
- id: autoflake

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.6.4
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ dev = [
"bumpver==2023.1129",
"hypothesis==6.98.8",
"pre-commit==3.6.2",
"pytest==8.0.1",
"pytest==8.3.4",
"pytest-asyncio==0.23.5",
"pytest-cov==4.1.0", # https://github.com/pytest-dev/pytest/issues/11868#issuecomment-1913516238
"pytest-cov==6.0.0",
]

rtmidi = [
Expand Down Expand Up @@ -109,8 +109,6 @@ ignore = [
"D", # docstrings
"ERA001",
"N802",
"ANN101",
"ANN102",
"ANN401",
"EM101",
"EM102",
Expand Down
24 changes: 12 additions & 12 deletions src/musiclib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@


interval_colors = {
AbstractInterval(0): Color(0xFF0000),
AbstractInterval(1): Color(0x800000),
AbstractInterval(2): Color(0xff60a0),
AbstractInterval(3): Color(0xfffd37),
AbstractInterval(4): Color(0x00ff59),
AbstractInterval(5): Color(0x00d5ff),
AbstractInterval(6): Color(0x8FBC8F),
AbstractInterval(7): Color(0x0000FF),
AbstractInterval(8): Color(0xff7000),
AbstractInterval(9): Color(0x007000),
AbstractInterval(10): Color(0x9c5c02),
AbstractInterval(11): Color(0xa000ff),
AbstractInterval(0): Color(0xFFFFFF),
AbstractInterval(1): Color(0x820000),
AbstractInterval(2): Color(0xFF0000),
AbstractInterval(3): Color(0x007000),
AbstractInterval(4): Color(0x00FB47),
AbstractInterval(5): Color(0x9500B3),
AbstractInterval(6): Color(0xEA7EFF),
AbstractInterval(7): Color(0x787878),
AbstractInterval(8): Color(0x0000FF),
AbstractInterval(9): Color(0x03B9D5),
AbstractInterval(10): Color(0xFF7328),
AbstractInterval(11): Color(0xFFFB00),
}

repr_svg_piano_config = {
Expand Down
1 change: 1 addition & 0 deletions src/musiclib/midi/pitchbend.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PitchPattern:
pitch_st: list[float]


@no_type_check
def interpolate_pattern(pattern: PitchPattern, n_interp_points: int) -> PitchPattern:
if n_interp_points <= len(pattern.time_bars):
raise ValueError(f'n_interp_points should be > len(pattern.time_bars), got {n_interp_points=} and {len(pattern.time_bars)=}')
Expand Down
2 changes: 1 addition & 1 deletion src/musiclib/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self, abstract: Note | str, octave: int) -> None:
self.abstract = abstract
self.is_black = abstract.is_black
self.octave = octave
self.i: int = (octave + 1) * 12 + self.abstract.i # this is also midi_code
self.i: int = (octave + 1) * 12 + self.abstract.i # this is also midi number
self._key = self.abstract, self.octave

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion src/musiclib/rhythm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __repr__(self) -> str:
@functools.cached_property
def has_contiguous_ones(self) -> bool:
return (
self.notes[0] == 1 and self.notes[-1] == 1
(self.notes[0] == 1 and self.notes[-1] == 1)
or any(len(list(g)) > 1 for k, g in itertools.groupby(self.notes, key=bool) if k)
)

Expand Down

0 comments on commit a3c3ef4

Please sign in to comment.