tame-mt 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 (90) hide show
  1. tame_mt-0.1.0/.github/dependabot.yml +40 -0
  2. tame_mt-0.1.0/.github/workflows/ci.yml +212 -0
  3. tame_mt-0.1.0/.github/workflows/release.yml +130 -0
  4. tame_mt-0.1.0/.github/workflows/wheels.yml +56 -0
  5. tame_mt-0.1.0/.gitignore +13 -0
  6. tame_mt-0.1.0/CHANGELOG.md +169 -0
  7. tame_mt-0.1.0/CITATION.cff +10 -0
  8. tame_mt-0.1.0/CONTRIBUTING.md +40 -0
  9. tame_mt-0.1.0/Cargo.lock +250 -0
  10. tame_mt-0.1.0/Cargo.toml +30 -0
  11. tame_mt-0.1.0/LICENSE +21 -0
  12. tame_mt-0.1.0/MANIFEST.in +14 -0
  13. tame_mt-0.1.0/PKG-INFO +786 -0
  14. tame_mt-0.1.0/README.md +745 -0
  15. tame_mt-0.1.0/SECURITY.md +49 -0
  16. tame_mt-0.1.0/benchmarks/README.md +77 -0
  17. tame_mt-0.1.0/benchmarks/bench_synthetic.py +282 -0
  18. tame_mt-0.1.0/benchmarks/validate_fast_recall.py +274 -0
  19. tame_mt-0.1.0/docs/api.md +267 -0
  20. tame_mt-0.1.0/docs/cli.md +266 -0
  21. tame_mt-0.1.0/docs/interpretation.md +33 -0
  22. tame_mt-0.1.0/docs/json_schema.md +173 -0
  23. tame_mt-0.1.0/docs/metric_card.md +81 -0
  24. tame_mt-0.1.0/docs/native_backend.md +122 -0
  25. tame_mt-0.1.0/docs/paper_protocol.md +47 -0
  26. tame_mt-0.1.0/docs/performance.md +164 -0
  27. tame_mt-0.1.0/docs/release.md +84 -0
  28. tame_mt-0.1.0/examples/public_corpora_demo/opus100_demo_summary.csv +5 -0
  29. tame_mt-0.1.0/examples/public_corpora_demo/opus100_demo_summary.md +26 -0
  30. tame_mt-0.1.0/examples/public_corpora_demo/performance_notes.md +84 -0
  31. tame_mt-0.1.0/examples/public_corpora_demo/run_opus100_demo.py +259 -0
  32. tame_mt-0.1.0/examples/toy/README.md +16 -0
  33. tame_mt-0.1.0/examples/toy/hyp.out +4 -0
  34. tame_mt-0.1.0/examples/toy/test.ref +4 -0
  35. tame_mt-0.1.0/examples/toy/test.src +4 -0
  36. tame_mt-0.1.0/examples/toy/train.src +4 -0
  37. tame_mt-0.1.0/examples/toy/train.tgt +4 -0
  38. tame_mt-0.1.0/pyproject.toml +88 -0
  39. tame_mt-0.1.0/scripts/acceptance.sh +97 -0
  40. tame_mt-0.1.0/scripts/wheel_smoke.py +222 -0
  41. tame_mt-0.1.0/src/lib.rs +763 -0
  42. tame_mt-0.1.0/src/tame_mt/__init__.py +52 -0
  43. tame_mt-0.1.0/src/tame_mt/__main__.py +4 -0
  44. tame_mt-0.1.0/src/tame_mt/api.py +493 -0
  45. tame_mt-0.1.0/src/tame_mt/artifacts.py +321 -0
  46. tame_mt-0.1.0/src/tame_mt/bins.py +199 -0
  47. tame_mt-0.1.0/src/tame_mt/cli.py +790 -0
  48. tame_mt-0.1.0/src/tame_mt/config.py +246 -0
  49. tame_mt-0.1.0/src/tame_mt/exact.py +19 -0
  50. tame_mt-0.1.0/src/tame_mt/exceptions.py +27 -0
  51. tame_mt-0.1.0/src/tame_mt/exposure.py +399 -0
  52. tame_mt-0.1.0/src/tame_mt/index.py +462 -0
  53. tame_mt-0.1.0/src/tame_mt/io.py +99 -0
  54. tame_mt-0.1.0/src/tame_mt/json_utils.py +59 -0
  55. tame_mt-0.1.0/src/tame_mt/metrics/__init__.py +1 -0
  56. tame_mt-0.1.0/src/tame_mt/metrics/sacre.py +234 -0
  57. tame_mt-0.1.0/src/tame_mt/native.py +88 -0
  58. tame_mt-0.1.0/src/tame_mt/ngrams.py +15 -0
  59. tame_mt-0.1.0/src/tame_mt/normalize.py +52 -0
  60. tame_mt-0.1.0/src/tame_mt/persistence.py +667 -0
  61. tame_mt-0.1.0/src/tame_mt/py.typed +1 -0
  62. tame_mt-0.1.0/src/tame_mt/report.py +333 -0
  63. tame_mt-0.1.0/src/tame_mt/schema.py +104 -0
  64. tame_mt-0.1.0/src/tame_mt/scoring.py +138 -0
  65. tame_mt-0.1.0/src/tame_mt/similarity.py +26 -0
  66. tame_mt-0.1.0/src/tame_mt/tm.py +35 -0
  67. tame_mt-0.1.0/src/tame_mt/version.py +1 -0
  68. tame_mt-0.1.0/src/tame_mt/warnings.py +68 -0
  69. tame_mt-0.1.0/tests/fixtures/hyp.out +4 -0
  70. tame_mt-0.1.0/tests/fixtures/test.ref +4 -0
  71. tame_mt-0.1.0/tests/fixtures/test.src +4 -0
  72. tame_mt-0.1.0/tests/fixtures/train.src +4 -0
  73. tame_mt-0.1.0/tests/fixtures/train.tgt +4 -0
  74. tame_mt-0.1.0/tests/test_api.py +277 -0
  75. tame_mt-0.1.0/tests/test_artifacts.py +321 -0
  76. tame_mt-0.1.0/tests/test_bins.py +27 -0
  77. tame_mt-0.1.0/tests/test_cli.py +1018 -0
  78. tame_mt-0.1.0/tests/test_config.py +142 -0
  79. tame_mt-0.1.0/tests/test_exact.py +5 -0
  80. tame_mt-0.1.0/tests/test_exposure.py +165 -0
  81. tame_mt-0.1.0/tests/test_index.py +285 -0
  82. tame_mt-0.1.0/tests/test_io.py +49 -0
  83. tame_mt-0.1.0/tests/test_ngrams.py +7 -0
  84. tame_mt-0.1.0/tests/test_normalize.py +17 -0
  85. tame_mt-0.1.0/tests/test_persistence.py +364 -0
  86. tame_mt-0.1.0/tests/test_report.py +114 -0
  87. tame_mt-0.1.0/tests/test_scoring.py +109 -0
  88. tame_mt-0.1.0/tests/test_similarity.py +8 -0
  89. tame_mt-0.1.0/tests/test_tm.py +17 -0
  90. tame_mt-0.1.0/tests/test_version.py +63 -0
@@ -0,0 +1,40 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ day: "monday"
8
+ time: "09:00"
9
+ timezone: "America/Los_Angeles"
10
+ open-pull-requests-limit: 5
11
+ groups:
12
+ python-runtime:
13
+ patterns:
14
+ - "*"
15
+
16
+ - package-ecosystem: "cargo"
17
+ directory: "/"
18
+ schedule:
19
+ interval: "weekly"
20
+ day: "monday"
21
+ time: "09:15"
22
+ timezone: "America/Los_Angeles"
23
+ open-pull-requests-limit: 5
24
+ groups:
25
+ rust-runtime:
26
+ patterns:
27
+ - "*"
28
+
29
+ - package-ecosystem: "github-actions"
30
+ directory: "/"
31
+ schedule:
32
+ interval: "weekly"
33
+ day: "monday"
34
+ time: "09:30"
35
+ timezone: "America/Los_Angeles"
36
+ open-pull-requests-limit: 5
37
+ groups:
38
+ github-actions:
39
+ patterns:
40
+ - "*"
@@ -0,0 +1,212 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ env:
17
+ CARGO_TERM_COLOR: always
18
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
19
+
20
+ jobs:
21
+ static:
22
+ name: Static analysis
23
+ runs-on: ubuntu-24.04
24
+ timeout-minutes: 15
25
+ steps:
26
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
27
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
28
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
29
+ with:
30
+ python-version: "3.12"
31
+ cache: pip
32
+ cache-dependency-path: pyproject.toml
33
+ - name: Install
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ python -m pip install -e '.[dev]'
37
+ python -m pip check
38
+ - name: Ruff format
39
+ run: ruff format --check .
40
+ - name: Ruff
41
+ run: ruff check .
42
+ - name: Type check
43
+ run: mypy src/tame_mt
44
+
45
+ rust:
46
+ name: Rust checks
47
+ runs-on: ubuntu-24.04
48
+ timeout-minutes: 20
49
+ steps:
50
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
51
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
52
+ with:
53
+ components: rustfmt, clippy
54
+ - name: Rust format
55
+ run: cargo fmt --check
56
+ - name: Rust clippy
57
+ run: cargo clippy --locked --all-targets -- -D warnings
58
+ - name: Rust tests
59
+ run: cargo test --locked
60
+
61
+ test:
62
+ name: Python ${{ matrix.python-version }}
63
+ runs-on: ubuntu-24.04
64
+ timeout-minutes: 20
65
+ strategy:
66
+ fail-fast: false
67
+ matrix:
68
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
69
+ steps:
70
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
71
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
72
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
73
+ with:
74
+ python-version: ${{ matrix.python-version }}
75
+ cache: pip
76
+ cache-dependency-path: pyproject.toml
77
+ - name: Install
78
+ run: |
79
+ python -m pip install --upgrade pip
80
+ python -m pip install -e '.[dev]'
81
+ python -m pip check
82
+ - name: Native extension smoke
83
+ run: tame-mt doctor
84
+ - name: Test
85
+ run: pytest
86
+ - name: Smoke benchmark
87
+ run: python benchmarks/bench_synthetic.py --small --assert-thresholds
88
+ - name: Staged smoke benchmark
89
+ run: python benchmarks/bench_synthetic.py --small --staged --assert-thresholds
90
+ - name: Fast retrieval recall validation
91
+ run: python benchmarks/validate_fast_recall.py --require-native
92
+
93
+ performance:
94
+ name: Performance regression smoke
95
+ runs-on: ubuntu-24.04
96
+ timeout-minutes: 20
97
+ steps:
98
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
99
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
100
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
101
+ with:
102
+ python-version: "3.12"
103
+ cache: pip
104
+ cache-dependency-path: pyproject.toml
105
+ - name: Install
106
+ run: |
107
+ python -m pip install --upgrade pip
108
+ python -m pip install -e '.[dev]'
109
+ python -m pip check
110
+ - name: Larger staged benchmark
111
+ run: |
112
+ python benchmarks/bench_synthetic.py \
113
+ --train-size 50000 \
114
+ --test-size 1000 \
115
+ --staged \
116
+ --max-seconds 20 \
117
+ --max-index-build-seconds 20 \
118
+ --max-indexed-seconds 8 \
119
+ --max-cached-seconds 5 \
120
+ --max-prepared-cached-seconds 2 \
121
+ --max-cached-batch-per-system-seconds 2 \
122
+ --max-index-bytes 80000000 \
123
+ --assert-thresholds
124
+ - name: Broader fast retrieval recall validation
125
+ run: python benchmarks/validate_fast_recall.py --require-native --train-size 5000 --test-size 500
126
+
127
+ dependency-compatibility:
128
+ name: SacreBLEU compatibility (${{ matrix.sacrebleu }})
129
+ runs-on: ubuntu-24.04
130
+ timeout-minutes: 15
131
+ strategy:
132
+ fail-fast: false
133
+ matrix:
134
+ sacrebleu:
135
+ - "sacrebleu>=2.4,<2.5"
136
+ - "sacrebleu>=2.6,<3"
137
+ steps:
138
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
139
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
140
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
141
+ with:
142
+ python-version: "3.12"
143
+ cache: pip
144
+ cache-dependency-path: pyproject.toml
145
+ - name: Install package and selected SacreBLEU range
146
+ run: |
147
+ python -m pip install --upgrade pip
148
+ python -m pip install -e '.[dev]'
149
+ python -m pip install '${{ matrix.sacrebleu }}'
150
+ python -m pip check
151
+ - name: Verify selected SacreBLEU version
152
+ run: |
153
+ python - <<'PY'
154
+ import sacrebleu
155
+ version = tuple(int(part) for part in sacrebleu.__version__.split(".")[:2])
156
+ if version[0] != 2:
157
+ raise SystemExit(f"unsupported SacreBLEU major version: {sacrebleu.__version__}")
158
+ print(sacrebleu.__version__)
159
+ PY
160
+ - name: Compatibility tests
161
+ run: pytest tests/test_scoring.py tests/test_report.py tests/test_cli.py::test_cli_doctor_reports_environment
162
+
163
+ security:
164
+ name: Dependency audit
165
+ runs-on: ubuntu-24.04
166
+ timeout-minutes: 20
167
+ steps:
168
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
169
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
170
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
171
+ with:
172
+ python-version: "3.12"
173
+ cache: pip
174
+ cache-dependency-path: pyproject.toml
175
+ - name: Python dependency audit
176
+ run: |
177
+ python -m pip install --upgrade pip
178
+ python -m pip install 'pip-audit>=2.7'
179
+ python -m pip_audit . --progress-spinner off
180
+ - name: Rust dependency audit
181
+ run: |
182
+ cargo install cargo-audit --locked --version 0.22.2
183
+ cargo audit --deny warnings
184
+
185
+ package:
186
+ name: Build package
187
+ runs-on: ubuntu-24.04
188
+ timeout-minutes: 20
189
+ steps:
190
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
191
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
192
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
193
+ with:
194
+ python-version: "3.12"
195
+ cache: pip
196
+ cache-dependency-path: pyproject.toml
197
+ - name: Install build tools
198
+ run: |
199
+ python -m pip install --upgrade pip
200
+ python -m pip install build twine
201
+ python -m pip check
202
+ - name: Build
203
+ run: python -m build
204
+ - name: Check distributions
205
+ run: python -m twine check dist/*
206
+ - name: Smoke installed wheel
207
+ run: |
208
+ python -m venv /tmp/tame-wheel-smoke
209
+ /tmp/tame-wheel-smoke/bin/python -m pip install dist/*.whl
210
+ /tmp/tame-wheel-smoke/bin/python -m pip check
211
+ /tmp/tame-wheel-smoke/bin/python scripts/wheel_smoke.py
212
+ /tmp/tame-wheel-smoke/bin/tame-mt doctor
@@ -0,0 +1,130 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ publish:
10
+ description: "Publish to PyPI after building and validating artifacts from a tag ref"
11
+ required: true
12
+ default: false
13
+ type: boolean
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ concurrency:
19
+ group: ${{ github.workflow }}-${{ github.ref }}
20
+ cancel-in-progress: false
21
+
22
+ jobs:
23
+ sdist:
24
+ name: Build source distribution
25
+ runs-on: ubuntu-24.04
26
+ timeout-minutes: 20
27
+ steps:
28
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
29
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
30
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
31
+ with:
32
+ python-version: "3.12"
33
+ - name: Build sdist
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ python -m pip install build
37
+ python -m build --sdist
38
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
39
+ with:
40
+ name: sdist
41
+ path: dist/*.tar.gz
42
+
43
+ wheels:
44
+ name: Build wheels on ${{ matrix.os }}
45
+ runs-on: ${{ matrix.os }}
46
+ timeout-minutes: 60
47
+ strategy:
48
+ fail-fast: false
49
+ matrix:
50
+ os: [ubuntu-latest, macos-15, windows-latest]
51
+ steps:
52
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
53
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
54
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
55
+ with:
56
+ python-version: "3.12"
57
+ - name: Build wheels
58
+ uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
59
+ env:
60
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
61
+ CIBW_SKIP: "*-musllinux_*"
62
+ CIBW_TEST_COMMAND: "python -m pip check && python {project}/scripts/wheel_smoke.py"
63
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
64
+ with:
65
+ name: wheels-${{ matrix.os }}
66
+ path: wheelhouse/*.whl
67
+
68
+ release-check:
69
+ name: Validate release artifacts
70
+ needs: [sdist, wheels]
71
+ runs-on: ubuntu-24.04
72
+ timeout-minutes: 20
73
+ steps:
74
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
75
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
76
+ with:
77
+ path: dist
78
+ merge-multiple: true
79
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
80
+ with:
81
+ python-version: "3.12"
82
+ - name: Check distributions
83
+ run: |
84
+ python -m pip install --upgrade pip
85
+ python -m pip install twine
86
+ python -m twine check dist/*
87
+ - name: Prepare SBOM output directory
88
+ run: mkdir -p sbom
89
+ - name: Generate SBOM
90
+ uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0
91
+ with:
92
+ path: .
93
+ format: spdx-json
94
+ output-file: sbom/tame-mt.spdx.json
95
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
96
+ with:
97
+ name: release-artifacts
98
+ path: dist/*
99
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
100
+ with:
101
+ name: release-sbom
102
+ path: sbom/tame-mt.spdx.json
103
+
104
+ publish:
105
+ name: Publish to PyPI
106
+ needs: release-check
107
+ runs-on: ubuntu-24.04
108
+ environment: pypi
109
+ timeout-minutes: 20
110
+ permissions:
111
+ contents: read
112
+ id-token: write
113
+ attestations: write
114
+ if: >-
115
+ startsWith(github.ref, 'refs/tags/v') &&
116
+ github.event_name == 'workflow_dispatch' &&
117
+ github.event.inputs.publish == 'true'
118
+ steps:
119
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
120
+ with:
121
+ name: release-artifacts
122
+ path: dist
123
+ - name: Attest build provenance
124
+ uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
125
+ with:
126
+ subject-path: "dist/*"
127
+ - name: Publish package distributions
128
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
129
+ with:
130
+ print-hash: true
@@ -0,0 +1,56 @@
1
+ name: Wheels
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [main]
7
+ paths:
8
+ - "Cargo.toml"
9
+ - "Cargo.lock"
10
+ - "pyproject.toml"
11
+ - "src/**"
12
+ - "scripts/wheel_smoke.py"
13
+ - "tests/fixtures/**"
14
+ - ".github/workflows/wheels.yml"
15
+ pull_request:
16
+ paths:
17
+ - "Cargo.toml"
18
+ - "Cargo.lock"
19
+ - "pyproject.toml"
20
+ - "src/**"
21
+ - "scripts/wheel_smoke.py"
22
+ - "tests/fixtures/**"
23
+ - ".github/workflows/wheels.yml"
24
+
25
+ permissions:
26
+ contents: read
27
+
28
+ concurrency:
29
+ group: ${{ github.workflow }}-${{ github.ref }}
30
+ cancel-in-progress: true
31
+
32
+ jobs:
33
+ build:
34
+ name: Build wheels on ${{ matrix.os }}
35
+ runs-on: ${{ matrix.os }}
36
+ timeout-minutes: 60
37
+ strategy:
38
+ fail-fast: false
39
+ matrix:
40
+ os: [ubuntu-latest, macos-15, windows-latest]
41
+ steps:
42
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
43
+ - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
44
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
45
+ with:
46
+ python-version: "3.12"
47
+ - name: Build wheels
48
+ uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
49
+ env:
50
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
51
+ CIBW_SKIP: "*-musllinux_*"
52
+ CIBW_TEST_COMMAND: "python -m pip check && python {project}/scripts/wheel_smoke.py"
53
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
54
+ with:
55
+ name: wheels-${{ matrix.os }}
56
+ path: wheelhouse/*.whl
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ build/
8
+ dist/
9
+ target/
10
+ demo_runs/
11
+ *.log
12
+ *.so
13
+ .DS_Store
@@ -0,0 +1,169 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial TAME-MT package and CLI.
6
+ - Added source, target, and approximate pair exposure diagnostics.
7
+ - Added nearest-neighbor translation-memory baseline scoring with BLEU and chrF.
8
+ - Added text, JSON, segment JSONL, TM output modes, and cached scoring from
9
+ prior segment diagnostics.
10
+ - Added real `score --verbose` and `audit --verbose` stage timing output to
11
+ stderr for long-running jobs.
12
+ - Extended verbose stage timing to cached scoring, cached batch scoring, index
13
+ building, and TM-baseline generation.
14
+ - Added a native Rust/PyO3 nearest-neighbor backend with exact and bounded fast
15
+ retrieval modes, compact integer n-gram indexes, parallel batch query, bulk
16
+ candidate scoring, and pure-Python fallback modes.
17
+ - Optimized the native backend by interning character n-grams from UTF-8 slices
18
+ instead of allocating per-occurrence gram strings, reducing native index build
19
+ time while preserving exact n-gram identity and literal normalized-string
20
+ exact-match maps.
21
+ - Parallelized batched native pair reranking and removed redundant exact-match
22
+ checks from exposure assembly for faster large-test audits.
23
+ - Reused normalized source/reference batches across native search, exact-pair
24
+ checks, and pair reranking to reduce repeated Python preprocessing in
25
+ large-test audits.
26
+ - Added fast-path normalization for ASCII text and common strip-plus-whitespace
27
+ normalization.
28
+ - Added persistent `.tameidx` native index bundles plus `tame-mt index build`,
29
+ `tame-mt index inspect`, and `score`/`audit --index` reuse workflows for
30
+ large training corpora.
31
+ - Switched persisted `.tameidx` bundles to low-compression ZIP storage, cutting
32
+ the synthetic 100k source+target bundle from about 323 MB to about 67 MB in
33
+ local smoke timing while preserving fast indexed reuse.
34
+ - Added explicit `.tameidx` bundle and native index schema versioning so
35
+ incompatible persisted indexes fail with clear rebuild guidance.
36
+ - Made native backend availability require the compiled extension version to
37
+ match the Python package version, preventing stale editable builds from being
38
+ selected silently.
39
+ - Hardened `.tameidx` loading with strict manifest types, duplicate-member
40
+ rejection, and manifest-vs-ZIP member size checks before native index
41
+ deserialization.
42
+ - Hardened `.tameidx` loading further with unexpected-member rejection,
43
+ member-specific hard caps, total uncompressed-size limits, compression-ratio
44
+ checks, and streaming UTF-8 training-text reads before native index
45
+ deserialization.
46
+ - Made `.tameidx` writes atomic by writing a temporary bundle in the destination
47
+ directory and replacing the output path only after the archive closes
48
+ successfully.
49
+ - Optimized native index reuse by avoiding duplicate Python exact maps and by
50
+ persisting normalized exact-pair keys for faster repeated audits.
51
+ - Reduced native query-loop overhead by using the package's lightweight FNV
52
+ hasher for exact-match and per-query candidate-count maps.
53
+ - Reduced large-audit Python overhead by using slotted dataclasses for
54
+ configs, reports, per-segment diagnostics, and internal result containers.
55
+ - Optimized exposure-summary generation by collecting side statistics in one
56
+ pass, sorting each score side once, and using binary search for threshold
57
+ counts.
58
+ - Reduced fresh native-audit memory pressure by releasing Python-side
59
+ normalized training-line copies after exact pair keys have been prepared.
60
+ - Hardened cached segment artifact scoring with strict index validation,
61
+ canonical ordering, and safer JSON type parsing.
62
+ - Rejected cached segment artifacts whose stored exposure-bin labels do not
63
+ match the current bin thresholds, preventing mixed-configuration cached
64
+ reports.
65
+ - Added automatic segment JSONL metadata sidecars and cached-CLI validation for
66
+ artifact-defining config and count drift while preserving legacy sidecar-free
67
+ segment JSONL compatibility.
68
+ - Preserved the original segment-artifact backend in cached JSON reports via
69
+ `backend.artifact_backend` when metadata sidecars are available.
70
+ - Added SacreBLEU runtime versions to report signatures and JSON config
71
+ metadata so metric-affecting dependency changes are visible and reproducible.
72
+ - Bounded the supported SacreBLEU dependency range to `sacrebleu>=2.4,<3` and
73
+ added CI compatibility tests for supported 2.x ranges.
74
+ - Exposed segment metadata path/read/validation helpers in the public Python
75
+ namespace so services can enforce the same cached-artifact checks as the CLI.
76
+ - Extended the built-wheel smoke test to require the native backend up front
77
+ and validate segment metadata sidecars through the public API.
78
+ - Added `target_ref_index` and `pair_ref_index` to segment diagnostics so
79
+ multi-reference audits show which reference produced the target and pair
80
+ exposure maxima; older cached JSONL files without those fields remain valid.
81
+ - Hardened cached segment JSONL parsing so malformed bin labels and non-string
82
+ TM hypotheses fail closed instead of being coerced.
83
+ - Rejected non-finite numeric config and cached-artifact values and made JSON
84
+ report/segment writers fail closed instead of emitting non-standard `NaN` or
85
+ infinity values.
86
+ - Rejected out-of-range exposure thresholds and malformed comma-separated
87
+ numeric CLI lists so large batch runs fail fast on invalid configuration.
88
+ - Tightened Python API configuration validation so malformed numeric, boolean,
89
+ metric-list, normalization, and nested config options raise
90
+ `ConfigurationError` consistently.
91
+ - Rejected unordered and duplicate metric selections in `ScoreConfig` so report
92
+ key order and signatures remain deterministic.
93
+ - Rejected duplicate CLI metric selections instead of silently deduplicating
94
+ them before configuration validation.
95
+ - Centralized strict JSON parsing/serialization for package artifacts so
96
+ cached segment JSONL and `.tameidx` manifests reject non-standard `NaN` and
97
+ infinity constants and duplicate object keys even in ignored fields.
98
+ - Wrapped output serialization failures in user-facing `OutputError` exceptions
99
+ and serialize full JSON reports before opening the destination path to avoid
100
+ partial report files.
101
+ - Improved malformed artifact and index-bundle errors so corrupt numeric fields,
102
+ manifests, and UTF-8 members fail with user-facing TAME-MT exceptions.
103
+ - Optimized cached and repeated scoring by aggregating SacreBLEU segment
104
+ statistics once per metric/system instead of rescoring every exposure bin
105
+ separately.
106
+ - Reduced cached-scoring allocation by fast-pathing already ordered segment
107
+ artifacts, building exposure-bin groups in one pass, and reusing whole-corpus
108
+ SacreBLEU statistics without copying.
109
+ - Added `score-cached-batch` and a batch artifact-scoring API so many systems
110
+ can share one segment-artifact read, one reference cache, and one TM baseline
111
+ scoring pass.
112
+ - Added `CachedSegmentScorer` and `TameScorer.prepare_from_artifacts()` so
113
+ services and notebooks can validate cached diagnostics once, keep SacreBLEU
114
+ reference caches and TM baseline scores alive, and score later hypotheses with
115
+ prepared cached-score latency.
116
+ - Made prepared cached scorers snapshot validated segment diagnostics so later
117
+ caller-side mutation of artifact objects cannot corrupt cached state.
118
+ - Exposed cached-scoring artifact types, `read_segment_jsonl`, and
119
+ `MetricConfig` from the top-level Python package API.
120
+ - Reduced source-only audit and TM-baseline retrieval work by querying only the
121
+ nearest source neighbor unless pair exposure is being computed.
122
+ - Moved native pair-exposure reranking into a batched Rust path to reduce
123
+ Python/Rust boundary overhead in large indexed audits.
124
+ - Hardened text-file decoding so invalid UTF-8 in corpus or cached segment
125
+ artifacts produces user-facing TAME-MT errors instead of raw tracebacks.
126
+ - Hardened malformed gzip handling so compressed corpus and cached segment
127
+ inputs produce user-facing TAME-MT input errors.
128
+ - Tightened API and cached-scoring validation for empty references and
129
+ non-positive training counts.
130
+ - Removed an unused experimental weighted-BLEU helper from the package surface.
131
+ - Added transparent `.gz` support for corpus inputs and text/JSONL/JSON outputs.
132
+ - Applied `.gz` output support consistently to TM baseline metadata JSONL.
133
+ - Extended the synthetic benchmark with staged index-build, indexed-audit, and
134
+ cached-scoring timings.
135
+ - Extended staged benchmark guards with prepared cached-score and batch
136
+ per-system latency checks.
137
+ - Added the staged synthetic benchmark to CI so indexed, cached, prepared
138
+ cached, and batch cached performance regressions are caught before merge.
139
+ - Added `benchmarks/validate_fast_recall.py` and CI/acceptance coverage for
140
+ deterministic fast-vs-exact retrieval recall, agreement, and score-gap
141
+ characterization.
142
+ - Made staged benchmark indexed timings include persisted `.tameidx` load time.
143
+ - Tightened release acceptance performance checks to cover the 100k staged
144
+ benchmark path with explicit build, indexed-audit, and cached-score
145
+ thresholds.
146
+ - Added a persisted index-size threshold to the staged benchmark acceptance
147
+ guard.
148
+ - Replaced inline wheel smoke tests with a cross-platform script covering gzip
149
+ IO, index reuse, cached scoring, and TM metadata outputs.
150
+ - Added clean-venv built-wheel smoke testing to the acceptance script.
151
+ - Added built-wheel smoke testing to package CI and ensured wheel CI reruns when
152
+ smoke fixtures or the smoke script change.
153
+ - Extended wheel smoke coverage to exercise the public prepared cached-scoring
154
+ API from the installed package.
155
+ - Added deterministic fuzz-style parser tests for segment JSONL scalar
156
+ encodings, native/Python retrieval parity tests, and a SacreBLEU segment-stat
157
+ acceleration sentinel.
158
+ - Added release CI for dependency audits, tag-driven trusted PyPI publishing,
159
+ build provenance attestation, and SPDX SBOM artifact generation.
160
+ - Added `tame-mt doctor` for install/backend diagnostics.
161
+ - Added OPUS-100 public-corpus demo outputs and local performance notes for the
162
+ 50k-train/2k-test benchmark scale.
163
+ - Added synthetic benchmark smoke checks and an acceptance script.
164
+ - Added toy corpus, documentation, unit tests, native tests, and CI checks.
165
+ - Added typed exceptions, typed package marker, maturin package metadata, and
166
+ release-oriented docs for public distribution.
167
+ - Polished package classifiers and contributor release guidance for the
168
+ hardened acceptance workflow.
169
+ - Removed unnecessary runtime dependencies beyond SacreBLEU.
@@ -0,0 +1,10 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use TAME-MT, please cite it using this metadata."
3
+ title: "TAME-MT: Training-Aware Machine Translation Evaluation for Machine Translation"
4
+ version: "0.1.0"
5
+ date-released: "2026-06-26"
6
+ authors:
7
+ - family-names: "Scheppat"
8
+ given-names: "Hunter M"
9
+ license: "MIT"
10
+ repository-code: "https://github.com/hunterschep/TAME-MT"
@@ -0,0 +1,40 @@
1
+ # Contributing
2
+
3
+ TAME-MT is intended to be a small, deterministic, low-dependency evaluation
4
+ tool. Contributions should preserve that shape.
5
+
6
+ ## Development Setup
7
+
8
+ ```bash
9
+ pip install -e '.[dev]'
10
+ pytest
11
+ ruff check .
12
+ mypy src/tame_mt
13
+ python -m build
14
+ python -m twine check dist/*
15
+ ```
16
+
17
+ ## Design Constraints
18
+
19
+ - Do not add heavyweight runtime dependencies without a strong reason.
20
+ - Do not download models or external resources at runtime.
21
+ - Do not change metric definitions without updating the signature and
22
+ changelog.
23
+ - Do not print training-neighbor text by default.
24
+ - Keep source-side nearest-neighbor retrieval as the TM baseline behavior.
25
+ - Add tests for user-visible CLI, JSON, or metric-definition changes.
26
+
27
+ ## Release Checklist
28
+
29
+ Use [`docs/release.md`](docs/release.md) as the canonical checklist.
30
+
31
+ 1. Update `CHANGELOG.md`.
32
+ 2. Run `scripts/acceptance.sh`.
33
+ 3. Confirm the staged synthetic benchmark output stays under the release
34
+ thresholds for fresh, indexed, cached, prepared cached, and batch cached
35
+ scoring.
36
+ 4. Confirm the fast-retrieval recall validation, built-wheel smoke test, and
37
+ `twine check` pass.
38
+ 5. Confirm CI dependency audits and SacreBLEU compatibility jobs pass.
39
+ 6. Remove generated `dist/`, build, and editable native-extension artifacts
40
+ before committing.