Skip to content

Commit 8ac9495

Browse files
committed
Update CI, devcontainers and deps
1 parent 3c4c7de commit 8ac9495

10 files changed

Lines changed: 393 additions & 311 deletions

File tree

.devcontainer/cpu/devcontainer.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
"vincent-templier.vscode-netron"
1616
],
1717
"settings": {
18-
"python-env.globalSearchPaths": [
19-
"~/.venvs"
20-
],
21-
"python-envs.terminal.autoActivationType": "shellStartup",
2218
"python.defaultInterpreterPath": "~/.venvs/default/bin/python"
2319
}
2420
}

.devcontainer/cuda/devcontainer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"gpu": true
1010
},
1111
"features": {
12-
"ghcr.io/devcontainers/features/common-utils:2": {}
12+
"ghcr.io/devcontainers/features/common-utils:2": {
13+
"username": "ubuntu"
14+
}
1315
},
1416
"customizations": {
1517
"vscode": {
@@ -23,16 +25,13 @@
2325
"vincent-templier.vscode-netron"
2426
],
2527
"settings": {
26-
"python-env.globalSearchPaths": [
27-
"~/.venvs"
28-
],
29-
"python-envs.terminal.autoActivationType": "shellStartup",
3028
"python.defaultInterpreterPath": "~/.venvs/default/bin/python"
3129
}
3230
}
3331
},
32+
"remoteUser": "ubuntu",
3433
"remoteEnv": {
35-
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venvs/default"
34+
"UV_PROJECT_ENVIRONMENT": "/home/ubuntu/.venvs/default"
3635
},
3736
"postCreateCommand": "curl -LsSf https://astral.sh/uv/install.sh | sh",
3837
"postStartCommand": "uv sync"

.github/workflows/python-package.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,42 +78,50 @@ jobs:
7878
macos-latest,
7979
ubuntu-24.04-arm,
8080
windows-11-arm,
81+
macos-15-intel,
8182
]
8283
include:
84+
- soundfile: soundfile
8385
- python-version: "3.10"
84-
numpy-version: numpy==1.22.4
85-
onnxruntime-version: onnxruntime==1.18.1
86-
hf-hub-version: huggingface-hub==0.30.2
87-
typing-version: typing-extensions==4.6.0
86+
numpy: numpy==1.22.4
87+
onnxruntime: onnxruntime==1.18.1
88+
hf-hub: huggingface-hub==0.30.2
89+
typing: typing-extensions==4.6.0
8890
- python-version: "3.11"
89-
numpy-version: numpy~=1.26
90-
onnxruntime-version: onnxruntime~=1.20.1
91-
hf-hub-version: huggingface-hub~=0.36
91+
numpy: numpy~=1.26
92+
onnxruntime: onnxruntime~=1.20.1
93+
hf-hub: huggingface-hub~=0.36
9294
- python-version: "3.12"
93-
numpy-version: numpy~=2.0.2
94-
onnxruntime-version: onnxruntime~=1.22.1
95-
hf-hub-version: huggingface-hub~=1.0.1
95+
numpy: numpy~=2.0.2
96+
onnxruntime: onnxruntime~=1.22.1
97+
hf-hub: huggingface-hub~=1.0.1
9698
- python-version: "3.13"
97-
numpy-version: numpy~=2.3.5
98-
onnxruntime-version: onnxruntime~=1.23.2
99+
numpy: numpy~=2.3.5
100+
onnxruntime: onnxruntime~=1.23.2
99101
- python-version: "3.13t"
100102
os: ubuntu-latest
103+
soundfile: ""
101104
- python-version: "3.13t"
102105
os: ubuntu-24.04-arm
106+
soundfile: ""
103107
- python-version: "3.14t"
104108
os: ubuntu-latest
109+
soundfile: soundfile
105110
- python-version: "3.14t"
106111
os: ubuntu-24.04-arm
112+
soundfile: soundfile
107113
- os: windows-11-arm
108-
numpy-version: numpy~=2.3.5
109-
onnxruntime-version: onnxruntime>=1.24.2
114+
numpy: numpy~=2.3.5
115+
onnxruntime: onnxruntime~=1.24.2
110116
- os: windows-11-arm
111117
python-version: "3.14"
112-
numpy-version: numpy>=2.4.2
118+
numpy: ""
119+
onnxruntime: ""
113120
exclude:
114121
- os: windows-11-arm
115122
python-version: "3.10"
116-
123+
- os: macos-15-intel
124+
python-version: "3.14"
117125
steps:
118126
- uses: actions/checkout@v6
119127
- name: Install uv with Python ${{ matrix.python-version }}
@@ -130,10 +138,11 @@ jobs:
130138
shell: bash
131139
run: >-
132140
uv pip install --group test ./dist/onnx_asr-*.whl
133-
${{ matrix.numpy-version }}
134-
${{ matrix.onnxruntime-version }}
135-
${{ matrix.hf-hub-version }}
136-
${{ matrix.typing-version }}
141+
${{ matrix.numpy }}
142+
${{ matrix.onnxruntime }}
143+
${{ matrix.hf-hub }}
144+
${{ matrix.typing }}
145+
${{ matrix.soundfile }}
137146
138147
- name: Cache HF models
139148
uses: actions/cache@v5

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@
1414
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
1515
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format",
1616
"tag:yaml.org,2002:python/object/apply:pymdownx.slugs.slugify mapping"
17-
]
17+
],
18+
"files.exclude": {
19+
".coverage": true,
20+
".mypy_cache": true,
21+
".pytest_cache": true,
22+
".ruff_cache": true,
23+
"**/__pycache__": true
24+
}
1825
}

.vscode/tasks.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "uv: ruff format",
8+
"type": "shell",
9+
"command": "uv run ruff format",
10+
"problemMatcher": [],
11+
"detail": "Format code using Ruff"
12+
},
13+
{
14+
"label": "uv: ruff check",
15+
"type": "shell",
16+
"command": "uv run ruff check",
17+
"problemMatcher": [],
18+
"detail": "Lint with Ruff"
19+
},
20+
{
21+
"label": "uv: mypy",
22+
"type": "shell",
23+
"command": "uv run mypy .",
24+
"problemMatcher": [],
25+
"detail": "Check types with mypy"
26+
},
27+
{
28+
"label": "uv: build",
29+
"type": "shell",
30+
"command": "uv build --clear",
31+
"dependsOrder": "sequence",
32+
"dependsOn": [
33+
"uv: ruff format",
34+
"uv: ruff check",
35+
"uv: mypy"
36+
],
37+
"group": {
38+
"kind": "build",
39+
"isDefault": true
40+
},
41+
"problemMatcher": [],
42+
"detail": "Lint and build dist"
43+
},
44+
{
45+
"label": "uv: mkdocs build",
46+
"type": "shell",
47+
"command": "uv run --group docs mkdocs build --clean --strict",
48+
"problemMatcher": [],
49+
"group": {
50+
"kind": "build",
51+
"isDefault": "**/*.md"
52+
},
53+
"detail": "Build docs with mkdocs"
54+
},
55+
{
56+
"label": "uv: mkdocs serve",
57+
"type": "shell",
58+
"command": "uv run --group docs mkdocs serve",
59+
"problemMatcher": [],
60+
"detail": "Serve docs with mkdocs"
61+
},
62+
{
63+
"label": "uv: pytest",
64+
"type": "shell",
65+
"command": "uv run --group test-all pytest --cov",
66+
"problemMatcher": [],
67+
"group": {
68+
"kind": "test",
69+
"isDefault": true
70+
},
71+
"detail": "Run all tests with pytest"
72+
},
73+
{
74+
"label": "clean",
75+
"type": "shell",
76+
"command": "find . -type d -name '__pycache__' -exec rm -rf {} +; rm -rf .ruff_cache .pytest_cache .mypy_cache dist site",
77+
"windows": {
78+
"command": "Get-ChildItem -Path . -Recurse -Include '__pycache__','.ruff_cache','.pytest_cache','.mypy_cache','dist','site' | Remove-Item -Recurse -Force"
79+
},
80+
"problemMatcher": [],
81+
"detail": "Clean caches and build artifacts"
82+
}
83+
]
84+
}

hatch_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class _BuildPreprocessorsHook(BuildHookInterface): # type: ignore[type-arg]
1111
artifacts_path = Path("src/onnx_asr/preprocessors/data")
1212

1313
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
14-
self.app.display_info(f"Build ONNX preprocessor models ({self.artifacts_path})")
14+
self.app.display_info(f"Build ONNX and NumPy preprocessors ({self.artifacts_path})")
1515
sys.path.append(self.root)
1616

1717
from preprocessors.build import build # noqa: PLC0415

pyproject.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,24 @@ test = [
8383
"onnxruntime>=1.18.1",
8484
"pytest>=9.0.2",
8585
"pytest-cov>=7.0.0",
86-
"soundfile>=0.13.1 ; python_full_version != '3.13.*'", # Don't exist for 3.13t
8786
]
88-
test-preprocessors = [
87+
test-all = [
8988
"kaldi-native-fbank>=1.22.3",
9089
"nemo-toolkit[asr]>=2.6.2",
9190
"openai-whisper>=20250625",
91+
"soundfile>=0.13.1",
9292
{ include-group = "build" },
9393
{ include-group = "test" },
9494
]
9595

96+
[tool.uv]
97+
cache-keys = [
98+
{ file = "pyproject.toml" },
99+
{ file = "hatch_build.py" },
100+
{ file = "preprocessors/*.py" },
101+
{ git = { commit = true, tags = true } },
102+
]
103+
96104
[tool.uv.sources]
97105
torch = { index = "pytorch" }
98106
torchaudio = { index = "pytorch" }
@@ -122,6 +130,10 @@ module = ["onnxruntime.*"]
122130
follow_untyped_imports = true
123131
implicit_reexport = true
124132

133+
[[tool.mypy.overrides]]
134+
module = ["soundfile.*"]
135+
ignore_missing_imports = true
136+
125137
[[tool.mypy.overrides]]
126138
module = ["preprocessors.*"]
127139
follow_imports = "silent"

tests/onnx_asr/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_file_not_found_error(args_list: list[str]) -> None:
4141

4242
def test_cli_run(args_list: list[str]) -> None:
4343
try:
44-
import soundfile as sf # type: ignore[import-untyped] # noqa: PLC0415
44+
import soundfile as sf # noqa: PLC0415
4545
except (ImportError, OSError):
4646
pytest.skip("soundfile not available")
4747
args = parse_args(args_list)

tests/onnx_asr/test_read_wav.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66

77
try:
8-
import soundfile as sf # type: ignore[import-untyped]
8+
import soundfile as sf
99
except (ImportError, OSError):
1010
pytest.skip("soundfile not available", allow_module_level=True)
1111

0 commit comments

Comments
 (0)