Skip to content

Commit

Permalink
Re-add convenience exports for common features
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Nov 21, 2023
1 parent b196a5a commit b467678
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pip install miditoolkit
## Example Usage

```python
from miditoolkit.midi.parser import MidiFile
from miditoolkit import MidiFile
from miditoolkit.midi.utils import example_midi_file

path_midi = example_midi_file()
Expand Down
33 changes: 30 additions & 3 deletions miditoolkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,34 @@
Update date: 2020.06.23
"""

from .midi import *
from .pianoroll import *

__version__ = "1.0.1"

# Convenience exports for commonly used classes.

from miditoolkit.midi.parser import MidiFile
from miditoolkit.midi.containers import (
ControlChange,
Instrument,
KeySignature,
Lyric,
Marker,
Note,
Pedal,
PitchBend,
TempoChange,
TimeSignature,
)

__all__ = [
"ControlChange",
"Instrument",
"KeySignature",
"Lyric",
"Marker",
"MidiFile",
"Note",
"Pedal",
"PitchBend",
"TempoChange",
"TimeSignature",
]
8 changes: 8 additions & 0 deletions miditoolkit/pianoroll/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .parser import notes2pianoroll, pianoroll2notes

# Convenience re-exports

__all__ = [
"notes2pianoroll",
"pianoroll2notes",
]
4 changes: 3 additions & 1 deletion tests/test_pianoroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

from pathlib import Path

from miditoolkit import MidiFile, notes2pianoroll, pianoroll2notes
from miditoolkit import MidiFile
from miditoolkit.constants import PITCH_RANGE
from tqdm import tqdm

from miditoolkit.pianoroll import notes2pianoroll, pianoroll2notes


def test_pianoroll():
midi_paths = list(Path("tests", "testcases").glob("**/*.mid"))
Expand Down

0 comments on commit b467678

Please sign in to comment.