lytk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. lytk-0.1.0/.cargo/config.toml +7 -0
  2. lytk-0.1.0/.gitignore +56 -0
  3. lytk-0.1.0/.pre-commit-config.yaml +16 -0
  4. lytk-0.1.0/.python-version +1 -0
  5. lytk-0.1.0/CONTRIBUTING.md +60 -0
  6. lytk-0.1.0/Cargo.lock +1451 -0
  7. lytk-0.1.0/Cargo.toml +62 -0
  8. lytk-0.1.0/LICENSE +21 -0
  9. lytk-0.1.0/PKG-INFO +214 -0
  10. lytk-0.1.0/README.md +169 -0
  11. lytk-0.1.0/SECURITY.md +30 -0
  12. lytk-0.1.0/benches/bench_python.py +229 -0
  13. lytk-0.1.0/benches/benchmarks.rs +300 -0
  14. lytk-0.1.0/docs/changelog.md +2458 -0
  15. lytk-0.1.0/docs/cli.md +242 -0
  16. lytk-0.1.0/docs/design.md +295 -0
  17. lytk-0.1.0/docs/development.md +213 -0
  18. lytk-0.1.0/docs/import-export.md +385 -0
  19. lytk-0.1.0/docs/roadmap.md +755 -0
  20. lytk-0.1.0/pyproject.toml +95 -0
  21. lytk-0.1.0/src/adapters/abc_to_ir.rs +1117 -0
  22. lytk-0.1.0/src/adapters/dynamics_velocity.rs +47 -0
  23. lytk-0.1.0/src/adapters/gm.rs +247 -0
  24. lytk-0.1.0/src/adapters/humdrum_to_ir.rs +699 -0
  25. lytk-0.1.0/src/adapters/ir_to_abc.rs +740 -0
  26. lytk-0.1.0/src/adapters/ir_to_humdrum.rs +441 -0
  27. lytk-0.1.0/src/adapters/ir_to_ly/emit.rs +854 -0
  28. lytk-0.1.0/src/adapters/ir_to_ly/helpers.rs +108 -0
  29. lytk-0.1.0/src/adapters/ir_to_ly/lyrics.rs +257 -0
  30. lytk-0.1.0/src/adapters/ir_to_ly/maps.rs +348 -0
  31. lytk-0.1.0/src/adapters/ir_to_ly/mod.rs +403 -0
  32. lytk-0.1.0/src/adapters/ir_to_ly/music_emit.rs +1038 -0
  33. lytk-0.1.0/src/adapters/ir_to_ly/parts.rs +249 -0
  34. lytk-0.1.0/src/adapters/ir_to_ly/tests.rs +1948 -0
  35. lytk-0.1.0/src/adapters/ir_to_midi.rs +1058 -0
  36. lytk-0.1.0/src/adapters/ir_to_mxml/direction.rs +732 -0
  37. lytk-0.1.0/src/adapters/ir_to_mxml/helpers.rs +101 -0
  38. lytk-0.1.0/src/adapters/ir_to_mxml/mod.rs +134 -0
  39. lytk-0.1.0/src/adapters/ir_to_mxml/note.rs +1078 -0
  40. lytk-0.1.0/src/adapters/ir_to_mxml/part.rs +779 -0
  41. lytk-0.1.0/src/adapters/ir_to_mxml/score.rs +534 -0
  42. lytk-0.1.0/src/adapters/ir_to_mxml/tests.rs +1879 -0
  43. lytk-0.1.0/src/adapters/ly_flatten.rs +631 -0
  44. lytk-0.1.0/src/adapters/ly_to_ir/apply.rs +432 -0
  45. lytk-0.1.0/src/adapters/ly_to_ir/chord_mode.rs +220 -0
  46. lytk-0.1.0/src/adapters/ly_to_ir/consume.rs +932 -0
  47. lytk-0.1.0/src/adapters/ly_to_ir/figured_bass.rs +231 -0
  48. lytk-0.1.0/src/adapters/ly_to_ir/lyrics.rs +240 -0
  49. lytk-0.1.0/src/adapters/ly_to_ir/merge.rs +249 -0
  50. lytk-0.1.0/src/adapters/ly_to_ir/mod.rs +392 -0
  51. lytk-0.1.0/src/adapters/ly_to_ir/modifiers.rs +392 -0
  52. lytk-0.1.0/src/adapters/ly_to_ir/music.rs +942 -0
  53. lytk-0.1.0/src/adapters/ly_to_ir/postprocess.rs +609 -0
  54. lytk-0.1.0/src/adapters/ly_to_ir/state.rs +474 -0
  55. lytk-0.1.0/src/adapters/ly_to_ir/tests.rs +3407 -0
  56. lytk-0.1.0/src/adapters/ly_to_ir/timeline.rs +732 -0
  57. lytk-0.1.0/src/adapters/ly_to_ir/walk.rs +1384 -0
  58. lytk-0.1.0/src/adapters/midi_to_ir.rs +1169 -0
  59. lytk-0.1.0/src/adapters/mod.rs +238 -0
  60. lytk-0.1.0/src/adapters/mxml_to_ir/direction.rs +445 -0
  61. lytk-0.1.0/src/adapters/mxml_to_ir/mod.rs +568 -0
  62. lytk-0.1.0/src/adapters/mxml_to_ir/note.rs +809 -0
  63. lytk-0.1.0/src/adapters/mxml_to_ir/part.rs +598 -0
  64. lytk-0.1.0/src/adapters/mxml_to_ir/tests.rs +2517 -0
  65. lytk-0.1.0/src/ir/annotation.rs +73 -0
  66. lytk-0.1.0/src/ir/articulation.rs +146 -0
  67. lytk-0.1.0/src/ir/direction.rs +197 -0
  68. lytk-0.1.0/src/ir/duration.rs +329 -0
  69. lytk-0.1.0/src/ir/harmony.rs +77 -0
  70. lytk-0.1.0/src/ir/interval.rs +166 -0
  71. lytk-0.1.0/src/ir/language.rs +721 -0
  72. lytk-0.1.0/src/ir/lift.rs +683 -0
  73. lytk-0.1.0/src/ir/lower/build.rs +629 -0
  74. lytk-0.1.0/src/ir/lower/mod.rs +39 -0
  75. lytk-0.1.0/src/ir/lower/state.rs +123 -0
  76. lytk-0.1.0/src/ir/lower/tests.rs +352 -0
  77. lytk-0.1.0/src/ir/lower/walk.rs +263 -0
  78. lytk-0.1.0/src/ir/measure.rs +344 -0
  79. lytk-0.1.0/src/ir/mod.rs +72 -0
  80. lytk-0.1.0/src/ir/moment.rs +169 -0
  81. lytk-0.1.0/src/ir/music.rs +428 -0
  82. lytk-0.1.0/src/ir/note.rs +300 -0
  83. lytk-0.1.0/src/ir/part.rs +62 -0
  84. lytk-0.1.0/src/ir/pitch.rs +487 -0
  85. lytk-0.1.0/src/ir/score.rs +227 -0
  86. lytk-0.1.0/src/ir/voice.rs +42 -0
  87. lytk-0.1.0/src/lib.rs +48 -0
  88. lytk-0.1.0/src/lytk/__init__.py +106 -0
  89. lytk-0.1.0/src/lytk/_core.pyi +359 -0
  90. lytk-0.1.0/src/lytk/cli.py +740 -0
  91. lytk-0.1.0/src/lytk/datasets/__init__.py +28 -0
  92. lytk-0.1.0/src/lytk/datasets/base.py +434 -0
  93. lytk-0.1.0/src/lytk/metrics.py +209 -0
  94. lytk-0.1.0/src/lytk/py.typed +0 -0
  95. lytk-0.1.0/src/navigation.rs +577 -0
  96. lytk-0.1.0/src/parser.rs +205 -0
  97. lytk-0.1.0/src/python.rs +1020 -0
  98. lytk-0.1.0/src/representations/event_sequence.rs +408 -0
  99. lytk-0.1.0/src/representations/metrics.rs +422 -0
  100. lytk-0.1.0/src/representations/mod.rs +27 -0
  101. lytk-0.1.0/src/representations/note_array.rs +702 -0
  102. lytk-0.1.0/src/representations/piano_roll.rs +267 -0
  103. lytk-0.1.0/src/transforms/invert.rs +265 -0
  104. lytk-0.1.0/src/transforms/language.rs +110 -0
  105. lytk-0.1.0/src/transforms/mod.rs +119 -0
  106. lytk-0.1.0/src/transforms/retrograde.rs +681 -0
  107. lytk-0.1.0/src/transforms/transpose.rs +789 -0
  108. lytk-0.1.0/src/tree-sitter/LICENSE +7 -0
  109. lytk-0.1.0/src/tree-sitter/README.md +11 -0
  110. lytk-0.1.0/src/tree-sitter/bindings/rust/build.rs +26 -0
  111. lytk-0.1.0/src/tree-sitter/bindings/rust/lib.rs +47 -0
  112. lytk-0.1.0/src/tree-sitter/lilypond-scheme/src/grammar.json +4800 -0
  113. lytk-0.1.0/src/tree-sitter/lilypond-scheme/src/node-types.json +1441 -0
  114. lytk-0.1.0/src/tree-sitter/lilypond-scheme/src/parser.c +19700 -0
  115. lytk-0.1.0/src/tree-sitter/lilypond-scheme/src/tree_sitter/alloc.h +54 -0
  116. lytk-0.1.0/src/tree-sitter/lilypond-scheme/src/tree_sitter/array.h +291 -0
  117. lytk-0.1.0/src/tree-sitter/lilypond-scheme/src/tree_sitter/parser.h +286 -0
  118. lytk-0.1.0/src/tree-sitter/queries/highlights-builtins.scm +189 -0
  119. lytk-0.1.0/src/tree-sitter/queries/highlights-lilypond-builtins.scm +4 -0
  120. lytk-0.1.0/src/tree-sitter/queries/highlights-scheme-builtins.scm +8 -0
  121. lytk-0.1.0/src/tree-sitter/queries/highlights-scheme-lilypond-builtins.scm +4 -0
  122. lytk-0.1.0/src/tree-sitter/queries/highlights-scheme.scm +40 -0
  123. lytk-0.1.0/src/tree-sitter/queries/highlights.scm +89 -0
  124. lytk-0.1.0/src/tree-sitter/queries/injections.scm +3 -0
  125. lytk-0.1.0/src/tree-sitter/src/grammar.json +4800 -0
  126. lytk-0.1.0/src/tree-sitter/src/node-types.json +1453 -0
  127. lytk-0.1.0/src/tree-sitter/src/parser.c +19760 -0
  128. lytk-0.1.0/src/tree-sitter/src/tree_sitter/alloc.h +54 -0
  129. lytk-0.1.0/src/tree-sitter/src/tree_sitter/array.h +291 -0
  130. lytk-0.1.0/src/tree-sitter/src/tree_sitter/parser.h +286 -0
  131. lytk-0.1.0/uv.lock +2179 -0
@@ -0,0 +1,7 @@
1
+ # pyo3 is built with the "extension-module" feature, which intentionally does
2
+ # not link libpython. On macOS the linker then rejects the undefined Python
3
+ # symbols when building the `cargo test` harness. These flags let macOS resolve
4
+ # them lazily at runtime (dynamic lookup). Our Rust tests never call into Python,
5
+ # so the symbols are never actually invoked. Linux/Windows link fine without this.
6
+ [target.'cfg(target_os = "macos")']
7
+ rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
lytk-0.1.0/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ .vscode/
10
+
11
+ # Scratch / test output files (root-level only)
12
+ /out.xml
13
+ /example.xml
14
+ /pedal.xml
15
+ /rep.xml
16
+ /test*.ly
17
+ /test*.midi
18
+ /test*.pdf
19
+
20
+ # Virtual environments
21
+ .venv
22
+ lily/
23
+ target/
24
+ lilybert/
25
+ lilypond/
26
+ lilypond-export/
27
+ MEILER/
28
+ lilypond-midi-input/
29
+ PDMX/
30
+ lilypond-musicxml2ly-dev/
31
+ oll-core/
32
+ openlilylib/
33
+ tree-sitter-lilypond/
34
+ abjad/
35
+ hum2ly/
36
+ lilypond-rs/
37
+ quickly/
38
+ python-ly/
39
+ # Anchor to repo root: these are vendored reference crates. Without the leading
40
+ # slash, `musicxml/` also ignored `tests/fixtures/musicxml/` (a real fixture dir).
41
+ /musicxml/
42
+ /musicxml-std/
43
+ symusic/
44
+ MuseScore/
45
+ lyp/
46
+ music21/
47
+ muspy/
48
+ *.so
49
+
50
+ # Proptest regression files
51
+ *.proptest-regressions
52
+
53
+ # Generated/scratch conversion outputs
54
+ /example_*.xml
55
+ tests/fixtures/**/*.pdf
56
+ tests/fixtures/ly/*.midi
@@ -0,0 +1,16 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v6.0.0
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ - id: check-yaml
10
+ - id: check-added-large-files
11
+
12
+ - repo: https://github.com/AndrejOrsula/pre-commit-cargo
13
+ rev: 0.5.0
14
+ hooks:
15
+ - id: cargo-fmt
16
+ - id: cargo-clippy
@@ -0,0 +1 @@
1
+ 3.10
@@ -0,0 +1,60 @@
1
+ # Contributing to lytk
2
+
3
+ Thanks for your interest. Bug reports with a minimal input file are especially
4
+ welcome — most issues in this codebase are format edge cases.
5
+
6
+ ## Setup
7
+
8
+ ```bash
9
+ cargo build # Rust library + CLI
10
+ uv sync # Python dev environment
11
+ maturin develop # build the extension module into the venv
12
+ ```
13
+
14
+ ## Before opening a pull request
15
+
16
+ ```bash
17
+ cargo fmt
18
+ cargo clippy --all-targets -- -D warnings
19
+ cargo test
20
+ pytest tests/
21
+ ```
22
+
23
+ `pre-commit install` wires up the formatting and clippy checks locally.
24
+
25
+ ## Conventions
26
+
27
+ - **Tests first.** Every behaviour change needs a test that fails before the fix.
28
+ Round-trip tests assert *semantic* equivalence (pitches, durations, structure),
29
+ never string equality — emitters are free to reformat.
30
+ - **Fixtures** live in `tests/fixtures/`. Add the smallest file that reproduces
31
+ the problem.
32
+ - **New formats** go through the IR: implement `ToIrAdapter`/`FromIrAdapter` (or
33
+ the Layer-1 `ToMusicAdapter`/`FromMusicAdapter`) rather than converting
34
+ format-to-format directly. See `docs/design.md`.
35
+ - **New transforms** implement both `Transform` and `MusicTransform`, and must be
36
+ idempotent and composable.
37
+ - The PyO3 bindings live in `src/python.rs` and `src/navigation.rs`; the rest of
38
+ the crate stays pyo3-free so `src/lib.rs` remains a plain Rust root.
39
+ Python-visible changes need a matching entry in `src/lytk/_core.pyi`.
40
+ - **Optional dependencies stay optional.** torch and TensorFlow are imported
41
+ inside the method that needs them, never at module scope, so `import lytk`
42
+ works without either. Their tests use `pytest.importorskip`.
43
+ - A new input format needs adding to **both** `lytk.cli._SUPPORTED_EXTS` and
44
+ `lytk.datasets.SUPPORTED_EXTENSIONS` — `test_extensions_match_the_cli` enforces
45
+ that they agree.
46
+ - `src/tree-sitter/` is vendored generated code — never edit it by hand.
47
+
48
+ ## Releasing
49
+
50
+ lytk is distributed on **PyPI only**; the Rust crate is the implementation, not a
51
+ published artifact.
52
+
53
+ Maintainers: bump the version in both `Cargo.toml` and `pyproject.toml`, update
54
+ `docs/changelog.md`, then push a `v*` tag. `.github/workflows/release.yml` builds
55
+ the abi3 wheels and the sdist, gates on the test suite, and publishes to PyPI via
56
+ Trusted Publishing.
57
+
58
+ ## Licence
59
+
60
+ Contributions are accepted under the MIT licence of this project.