Skip to content

Commit 1ad3a26

Browse files
misc: release v0.3.1 (#42)
* misc: update dependencies * misc: release v0.3.1 * misc: format code * fix: pyo3 extension-module * fix: ci python macos working-directory
1 parent a4b285a commit 1ad3a26

File tree

5 files changed

+47
-21
lines changed

5 files changed

+47
-21
lines changed

.github/workflows/ci-python.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
name: Build & Test the Python Bindings
2-
32
defaults:
43
run:
54
working-directory: python
6-
75
on:
86
push:
97
pull_request:
108
workflow_dispatch:
11-
129
permissions:
1310
contents: read
14-
1511
jobs:
1612
format:
1713
name: Check Python format
@@ -28,7 +24,6 @@ jobs:
2824
run: ruff check .
2925
- name: Black
3026
run: black --check --diff .
31-
3227
rustfmt:
3328
name: Check Rust format
3429
runs-on: ubuntu-latest
@@ -39,14 +34,12 @@ jobs:
3934
- run: rustup update stable && rustup default stable
4035
- run: rustup component add rustfmt
4136
- run: cargo fmt --all --check
42-
4337
test:
4438
name: Run tests
4539
runs-on: ubuntu-latest
4640
strategy:
4741
matrix:
4842
python-version: ["3.10", "3.11", "3.12", "3.13"]
49-
5043
steps:
5144
- uses: actions/checkout@v5
5245
with:
@@ -70,7 +63,6 @@ jobs:
7063
working-directory: python
7164
sccache: true
7265
manylinux: auto
73-
7466
linux:
7567
runs-on: ubuntu-latest
7668
strategy:
@@ -121,7 +113,6 @@ jobs:
121113
pip3 install -U pip
122114
pip3 install --pre "mtc_token_healing[test]" --find-links dist --force-reinstall
123115
pytest --import-mode=importlib
124-
125116
windows:
126117
runs-on: windows-latest
127118
strategy:
@@ -154,7 +145,37 @@ jobs:
154145
set -e
155146
pip install --pre "mtc_token_healing[test]" --find-links dist --force-reinstall
156147
pytest --import-mode=importlib
157-
148+
macos:
149+
runs-on: macos-latest
150+
strategy:
151+
matrix:
152+
target: [x86_64, aarch64]
153+
steps:
154+
- uses: actions/checkout@v5
155+
with:
156+
fetch-depth: 0
157+
- uses: actions/setup-python@v6
158+
with:
159+
python-version: "3.10"
160+
- name: Build wheels
161+
uses: PyO3/maturin-action@v1
162+
with:
163+
working-directory: python
164+
target: ${{ matrix.target }}
165+
args: --release --out dist --interpreter 3.10
166+
sccache: true
167+
- name: Upload wheels
168+
uses: actions/upload-artifact@v4
169+
with:
170+
name: wheels-macos-${{ matrix.target }}
171+
path: dist
172+
- name: pytest
173+
if: ${{ !startsWith(matrix.target, 'aarch64') }}
174+
shell: bash
175+
run: |
176+
set -e
177+
pip install --pre "mtc_token_healing[test]" --find-links dist --force-reinstall
178+
pytest --import-mode=importlib
158179
sdist:
159180
needs: [test]
160181
runs-on: ubuntu-latest
@@ -173,7 +194,6 @@ jobs:
173194
with:
174195
name: wheels-sdist
175196
path: python/dist
176-
177197
release:
178198
name: Release
179199
runs-on: ubuntu-latest

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = ["python"]
33

44
[workspace.package]
5-
version = "0.3.0"
5+
version = "0.3.1"
66
edition = "2024"
77
license = "MIT OR Apache-2.0"
88
description = "Token healing implementation"
@@ -12,7 +12,7 @@ documentation = "https://docs.rs/mtc-token-healing"
1212
authors = ["Chielo Newctle <[email protected]>"]
1313

1414
[workspace.dependencies]
15-
general-sam = { version = "1.0.1", features = ["trie"] }
15+
general-sam = { version = "1.0.3", features = ["trie"] }
1616

1717
[package]
1818
name = "mtc-token-healing"

python/Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ name = "mtc_token_healing"
1515
crate-type = ["cdylib"]
1616

1717
[dependencies]
18-
mtc-token-healing = { version = "0.3.0", path = "..", features = ["pyo3"] }
18+
derive_more = { version = "2.0.1", features = ["from", "into"] }
1919
general-sam = { workspace = true }
20-
pyo3 = { version = "0.26.0", features = ["extension-module", "generate-import-lib", "abi3-py310"] }
2120
itertools = "0.14.0"
22-
derive_more = { version = "2.0.1", features = ["from", "into"] }
21+
mtc-token-healing = { version = "0.3.0", path = "..", features = ["pyo3"] }
22+
pyo3 = { version = "0.26.0", features = ["extension-module", "generate-import-lib", "abi3-py310"] }
23+
24+
[profile.release]
25+
lto = true
26+
strip = true
27+
opt-level = "z"

python/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ classifiers = [
1313
dynamic = ["version"]
1414

1515
[tool.maturin]
16+
features = ["pyo3/extension-module"]
1617

1718
[project.optional-dependencies]
1819
test = ["pytest"]

python/src/prefix_dfs.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ fn dfs_token_seq_trie(inputs: Vec<TokenSeqInput>) -> Vec<TokenSeqTrieNode> {
142142
});
143143
}
144144
TravelEvent::Pop(node, _) => {
145-
if let Some(id) = rank[node.node_id] {
146-
if let Some(parent) = node.get_node().and_then(|n| rank[n.get_parent()]) {
147-
dfs_order[parent].subtree_upper = dfs_order[id].subtree_upper;
148-
dfs_order[parent].num_children += 1;
149-
}
145+
if let Some(id) = rank[node.node_id]
146+
&& let Some(parent) = node.get_node().and_then(|n| rank[n.get_parent()])
147+
{
148+
dfs_order[parent].subtree_upper = dfs_order[id].subtree_upper;
149+
dfs_order[parent].num_children += 1;
150150
}
151151
}
152152
}

0 commit comments

Comments
 (0)