Skip to content

Commit 3376e56

Browse files
committed
prepare for release
1 parent 1afd920 commit 3376e56

9 files changed

Lines changed: 98 additions & 236 deletions

File tree

.github/workflows/release.yml

Lines changed: 74 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -1,260 +1,111 @@
11
name: Release Workflow
2+
permissions: {}
23

34
on:
45
push:
56
tags:
67
- "*"
78

89
jobs:
9-
build:
10-
name: Build wheel
11-
strategy:
12-
fail-fast: true
13-
matrix:
14-
include:
15-
- { os: "macos-14", torch-version: "2.6.0", torch-backend: "cpu" }
16-
- { os: "macos-14", torch-version: "2.7.1", torch-backend: "cpu" }
17-
- { os: "macos-14", torch-version: "2.8.0", torch-backend: "cpu" }
18-
- { os: "macos-14", torch-version: "2.9.0", torch-backend: "cpu" }
19-
- { os: "ubuntu-22.04", torch-version: "2.6.0", torch-backend: "cpu" }
20-
- { os: "ubuntu-22.04", torch-version: "2.6.0", torch-backend: "cu124" }
21-
- { os: "ubuntu-22.04", torch-version: "2.6.0", torch-backend: "cu126" }
22-
- { os: "ubuntu-22.04", torch-version: "2.7.1", torch-backend: "cpu" }
23-
- { os: "ubuntu-22.04", torch-version: "2.7.1", torch-backend: "cu126" }
24-
- { os: "ubuntu-22.04", torch-version: "2.7.1", torch-backend: "cu128" }
25-
- { os: "ubuntu-22.04", torch-version: "2.8.0", torch-backend: "cpu" }
26-
- { os: "ubuntu-22.04", torch-version: "2.8.0", torch-backend: "cu126" }
27-
- { os: "ubuntu-22.04", torch-version: "2.8.0", torch-backend: "cu128" }
28-
- { os: "ubuntu-22.04", torch-version: "2.8.0", torch-backend: "cu129" }
29-
- { os: "ubuntu-22.04", torch-version: "2.9.0", torch-backend: "cpu" }
30-
- { os: "ubuntu-22.04", torch-version: "2.9.0", torch-backend: "cu126" }
31-
- { os: "ubuntu-22.04", torch-version: "2.9.0", torch-backend: "cu128" }
32-
- { os: "ubuntu-22.04", torch-version: "2.9.0", torch-backend: "cu130" }
33-
- { os: "windows-latest", torch-version: "2.6.0", torch-backend: "cpu" }
34-
- { os: "windows-latest", torch-version: "2.6.0", torch-backend: "cu124" }
35-
- { os: "windows-latest", torch-version: "2.6.0", torch-backend: "cu126" }
36-
- { os: "windows-latest", torch-version: "2.7.1", torch-backend: "cpu" }
37-
- { os: "windows-latest", torch-version: "2.7.1", torch-backend: "cu126" }
38-
- { os: "windows-latest", torch-version: "2.7.1", torch-backend: "cu128" }
39-
- { os: "windows-latest", torch-version: "2.8.0", torch-backend: "cpu" }
40-
- { os: "windows-latest", torch-version: "2.8.0", torch-backend: "cu126" }
41-
- { os: "windows-latest", torch-version: "2.8.0", torch-backend: "cu128" }
42-
- { os: "windows-latest", torch-version: "2.8.0", torch-backend: "cu129" }
43-
- { os: "windows-latest", torch-version: "2.9.0", torch-backend: "cpu" }
44-
- { os: "windows-latest", torch-version: "2.9.0", torch-backend: "cu126" }
45-
- { os: "windows-latest", torch-version: "2.9.0", torch-backend: "cu128" }
46-
- { os: "windows-latest", torch-version: "2.9.0", torch-backend: "cu130" }
47-
env:
48-
GLIBC_VERSION: "2_34"
49-
DEFAULT_VERSION: "2.9.0"
50-
runs-on: ${{ matrix.os }}
51-
10+
lint:
11+
name: Linters
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
5215
steps:
53-
- name: Check if this is the default version
54-
shell: bash
55-
run: |
56-
DEFAULT_BACKEND=$(jq -rn '{"Linux": "cu128", "Windows": "cpu", "macOS": "cpu"}["${{ runner.os }}"]')
57-
if [[ "${{ matrix.torch-version }}" == "$DEFAULT_VERSION" && "${{ matrix.torch-backend }}" == "$DEFAULT_BACKEND" ]]; then
58-
echo "IS_DEFAULT=true" >> $GITHUB_ENV
59-
else
60-
echo "IS_DEFAULT=false" >> $GITHUB_ENV
61-
fi
62-
6316
- name: Checkout code
64-
uses: actions/checkout@v4
65-
66-
- name: Free up disk space
67-
if: ${{ runner.os == 'Linux' }}
68-
# https://github.com/easimon/maximize-build-space/blob/master/action.yml
69-
# https://github.com/easimon/maximize-build-space/tree/test-report
70-
run: |
71-
sudo rm -rf /usr/share/dotnet
72-
sudo rm -rf /opt/ghc
73-
sudo rm -rf /opt/hostedtoolcache/CodeQL
74-
75-
- name: Set up swap space
76-
if: runner.os == 'Linux'
77-
uses: pierotofy/set-swap-space@v1.0
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7818
with:
79-
swap-size-gb: 10
19+
persist-credentials: false
8020

81-
- name: Get tag name
82-
id: get_tag
83-
shell: bash
84-
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
21+
- name: zizmor
22+
uses: zizmorcore/zizmor-action@135698455da5c3b3e55f73f4419e481ab68cdd95 # v0.4.1
8523

86-
- name: Install CUDA 12 on Linux
87-
if: ${{ runner.os == 'Linux' && matrix.torch-backend != 'cpu' && matrix.torch-backend != 'cu130' }}
88-
run: |
89-
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
90-
sudo dpkg -i cuda-keyring_1.1-1_all.deb
91-
sudo apt-get update
92-
sudo apt-get -y install cuda-nvcc-12-9 cuda-libraries-dev-12.9
93-
echo "CUDA_HOME=/usr/local/cuda-12.9" >> $GITHUB_ENV
94-
echo "/usr/local/cuda-12.9/bin" >> $GITHUB_PATH
24+
- name: typos
25+
uses: crate-ci/typos@65120634e79d8374d1aa2f27e54baa0c364fff5a # v1.42.1
9526

96-
- name: Install CUDA 13 on Linux
97-
if: ${{ runner.os == 'Linux' && matrix.torch-backend == 'cu130' }}
98-
run: |
99-
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
100-
sudo dpkg -i cuda-keyring_1.1-1_all.deb
101-
sudo apt-get update
102-
sudo apt-get -y install cuda-nvcc-13-0 cuda-libraries-dev-13.0
103-
echo "CUDA_HOME=/usr/local/cuda-13.0" >> $GITHUB_ENV
104-
echo "/usr/local/cuda-13.0/bin" >> $GITHUB_PATH
27+
- name: Install tombi
28+
uses: tombi-toml/setup-tombi@f7cb38e77d9a62bc27a8445bf50e660e9496b893 # v1.0.7
10529

106-
- name: Install CUDA 12 on Windows
107-
if: ${{ runner.os == 'Windows' && matrix.torch-backend != 'cpu' && matrix.torch-backend != 'cu130' }}
108-
shell: pwsh
109-
run: |
110-
$downloadUrl = "https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda_12.9.1_576.57_windows.exe"
111-
$dst = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.9"
112-
New-Item -Path "cuda" -ItemType Directory
113-
New-Item -Path $dst -ItemType Directory
114-
& "C:\msys64\usr\bin\wget" $downloadUrl -O "cuda.exe" -q
115-
& 'C:\Program Files\7-Zip\7z' x "cuda.exe" -o"cuda"
116-
$directories = Get-ChildItem -Directory -Path "cuda"
117-
foreach ($dir in $directories) {
118-
$items = Get-ChildItem -Path (Join-Path "cuda" $dir.Name)
119-
foreach ($item in $items) {
120-
if ($item.PSIsContainer) {
121-
Write-Output "$($item.FullName)"
122-
Copy-Item -Path "$($item.FullName)\*" -Destination $dst -Recurse -Force
123-
}
124-
}
125-
}
126-
Write-Output "CUDA_HOME=$dst" >> $env:GITHUB_ENV
127-
Write-Output "$dst\bin" >> $env:GITHUB_PATH
30+
- name: Validate TOML files
31+
run: tombi lint
12832

129-
- name: Install CUDA 13 on Windows
130-
if: ${{ runner.os == 'Windows' && matrix.torch-backend == 'cu130' }}
131-
shell: pwsh
132-
run: |
133-
$downloadUrl = "https://developer.download.nvidia.com/compute/cuda/13.0.2/local_installers/cuda_13.0.2_windows.exe"
134-
$dst = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0"
135-
New-Item -Path "cuda" -ItemType Directory
136-
New-Item -Path $dst -ItemType Directory
137-
& "C:\msys64\usr\bin\wget" $downloadUrl -O "cuda.exe" -q
138-
& 'C:\Program Files\7-Zip\7z' x "cuda.exe" -o"cuda"
139-
$directories = Get-ChildItem -Directory -Path "cuda"
140-
foreach ($dir in $directories) {
141-
$items = Get-ChildItem -Path (Join-Path "cuda" $dir.Name)
142-
foreach ($item in $items) {
143-
if ($item.PSIsContainer) {
144-
Write-Output "$($item.FullName)"
145-
Copy-Item -Path "$($item.FullName)\*" -Destination $dst -Recurse -Force
146-
}
147-
}
148-
}
149-
Write-Output "CUDA_HOME=$dst" >> $env:GITHUB_ENV
150-
Write-Output "$dst\bin" >> $env:GITHUB_PATH
33+
- name: Ruff
34+
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
15135

152-
- name: Check CUDA installation
153-
if: ${{ matrix.torch-backend != 'cpu' }}
154-
shell: bash
155-
run: |
156-
nvcc -V
157-
echo CUDA_HOME=$CUDA_HOME
36+
build:
37+
name: Build distribution
38+
runs-on: ubuntu-latest
39+
needs: lint
40+
permissions:
41+
actions: write # Upload artifact
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
with:
46+
persist-credentials: false
15847

15948
- name: Install uv
160-
uses: astral-sh/setup-uv@v5
49+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
16150
with:
16251
version: "latest"
52+
enable-cache: false
16353

164-
- name: Override torch_version.json
165-
shell: bash
166-
run: |
167-
PLATFORM=$(jq -rn '{"Linux": "linux", "Windows": "win32", "macOS": "darwin"}["${{ runner.os }}"]')
168-
if [ $PLATFORM = "darwin" ]; then
169-
VERSION=${{ matrix.torch-version }}
170-
else
171-
VERSION=${{ matrix.torch-version }}+${{ matrix.torch-backend }}
172-
fi
173-
jq -n --arg platform "$PLATFORM" --arg version "$VERSION" '{($platform): $version}' > src/fastabx/torch_version.json
174-
175-
- name: Override latest git tag
176-
shell: bash
177-
env:
178-
TAG: ${{ steps.get_tag.outputs.TAG_NAME }}
179-
run: |
180-
git config user.name "GitHub Actions Bot"
181-
git config user.email "<>"
182-
git add src/fastabx/torch_version.json
183-
git commit -m "update" || true
184-
git tag --force $TAG
185-
186-
- name: Build wheel
187-
shell: bash
188-
run: |
189-
uv venv -p 3.12
190-
uv pip install setuptools setuptools-scm numpy ninja
191-
uv pip install torch==${{ matrix.torch-version }} --index-url https://download.pytorch.org/whl/${{ matrix.torch-backend }}
192-
uv build --wheel --no-build-isolation
193-
194-
- name: Relabel the Linux wheel
195-
if: runner.os == 'Linux'
196-
run: |
197-
uvx --with patchelf auditwheel repair ./dist/*abi3-linux*.whl -w ./dist --plat manylinux_${GLIBC_VERSION}_x86_64 --exclude "libtorch*" --exclude "libc10*" --exclude "libcu*"
198-
rm ./dist/*abi3-linux*.whl
199-
200-
- name: Copy the wheel with torch version and backend
201-
shell: bash
202-
run: |
203-
wheel=$(ls ./dist/fastabx-*.whl)
204-
if [ "$IS_DEFAULT" = true ]; then
205-
cp "$wheel" "${wheel/-cp/+${{ matrix.torch-backend }}.torch${{ matrix.torch-version }}-cp}"
206-
else
207-
mv "$wheel" "${wheel/-cp/+${{ matrix.torch-backend }}.torch${{ matrix.torch-version }}-cp}"
208-
fi
54+
- name: Build wheel and sdist
55+
run: uv build
20956

210-
- name: Upload artifacts
211-
uses: actions/upload-artifact@v4
57+
- name: Upload dists
58+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
21259
with:
213-
name: dist-${{ matrix.os }}-${{ matrix.torch-backend }}-${{ matrix.torch-version }}
214-
path: ./dist/*
60+
name: python-package-distributions
61+
path: dist/
21562

216-
release:
217-
name: Create release
218-
needs: build
63+
publish-to-pypi:
64+
name: Publish to PyPI
21965
runs-on: ubuntu-latest
66+
needs: build
67+
environment:
68+
name: publish-to-pypi
69+
permissions:
70+
actions: read # Download artifact
71+
id-token: write # Needed for trusted publishing
22072
steps:
221-
- name: Checkout code
222-
uses: actions/checkout@v4
73+
- name: Download all dists
74+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
75+
with:
76+
name: python-package-distributions
77+
path: dist/
22378

22479
- name: Install uv
225-
uses: astral-sh/setup-uv@v5
80+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
22681
with:
22782
version: "latest"
83+
enable-cache: false
22884

229-
- name: Get tag name
230-
id: get_tag
231-
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
232-
233-
- name: Download all artifacts
234-
uses: actions/download-artifact@v4
235-
with:
236-
path: artifacts
85+
- name: Upload to PyPI
86+
run: uv publish --trusted-publishing always
23787

238-
- name: Move the artifacts
239-
run: |
240-
mkdir ./dist
241-
mv ./artifacts/**/*.whl ./dist
24288

243-
- name: Build sdist
244-
run: uv build --sdist
89+
github-release:
90+
name: GitHub release
91+
runs-on: ubuntu-latest
92+
needs: build
93+
permissions:
94+
actions: read # Download artifact
95+
contents: write # Create GitHub release
96+
steps:
97+
- name: Checkout code
98+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
99+
with:
100+
persist-credentials: false
245101

246-
- name: List artifacts
247-
run: find ./dist
102+
- name: Download all dists
103+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
104+
with:
105+
name: python-package-distributions
106+
path: ./dist/
248107

249-
- name: Create Release
108+
- name: Create release
250109
env:
251-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252-
TAG: ${{ steps.get_tag.outputs.TAG_NAME }}
253-
run: gh release create "$TAG" ./dist/*
254-
255-
- name: Remove non default wheels
256-
run:
257-
rm ./dist/*torch*.whl
258-
259-
- name: Upload to PyPI
260-
run: uv publish -t ${{ secrets.UV_PUBLISH_TOKEN }}
110+
GITHUB_TOKEN: ${{ github.token }}
111+
run: gh release create "${GITHUB_REF#refs/tags/}" ./dist/*

.github/workflows/togitlab.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Push to Gitlab Workflow
2+
permissions: {}
23

34
on:
45
push:
@@ -14,9 +15,10 @@ jobs:
1415
GITLAB_REPO: gitlab.cognitive-ml.fr/mpoli/fastabx.git
1516
steps:
1617
- name: Checkout code
17-
uses: actions/checkout@v4
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1819
with:
1920
fetch-depth: 0
21+
persist-credentials: false
2022

2123
- name: Push
2224
shell: bash

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
repos:
2+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
3+
rev: v1.22.0
4+
hooks:
5+
- id: zizmor
26
- repo: https://github.com/crate-ci/typos
37
rev: v1.42.1
48
hooks:
59
- id: typos
10+
- repo: https://github.com/tombi-toml/tombi-pre-commit
11+
rev: v0.7.25
12+
hooks:
13+
- id: tombi-format
14+
- id: tombi-lint
615
- repo: https://github.com/astral-sh/ruff-pre-commit
716
rev: v0.14.13
817
hooks:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Maxime Poli.
3+
Copyright (c) 2025-2026 Maxime Poli.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies = [
2424
"numpy>=1.26.4",
2525
"polars>=1.35.1",
2626
"torch>=2.10.0",
27-
"torchdtw>=0.0.2",
27+
"torchdtw>=0.1.0",
2828
"tqdm>=4.67.1",
2929
]
3030
dynamic = ["version"]

src/fastabx/constraints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def apply_constraints(
4949
columns_to_retrieve = {
5050
name.removesuffix("_x").removesuffix("_a").removesuffix("_b")
5151
for constraint in constraints
52-
for name in constraint.meta.root_names()
52+
for name in constraint.meta.root_names() # ty: ignore[possibly-missing-attribute]
5353
}
5454
if not columns_to_retrieve or not columns_to_retrieve.issubset(labels.columns):
5555
raise NoConstraintsError

0 commit comments

Comments
 (0)