Skip to content

Commit

Permalink
Maturin, PyO3, pyo3-asyncio, pyo3-logをアップデート (#664)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
qryxip and Hiroshiba committed Oct 29, 2023
1 parent 47d5ab3 commit eda04a0
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 41 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ jobs:
pip install --upgrade poetry
poetry install --with dev --with test
- run: cargo build -p test_util -vv # build scriptにより/crates/test_util/data/の生成
# `macos-latest`(=`macos-12`)で次の問題が発生するため、それに対するワークアラウンド
# https://github.com/VOICEVOX/voicevox_core/issues/653#issuecomment-1782108410
- if: startsWith(matrix.os, 'mac')
name: Build open_jtalk-sys
run: |
poetry run -- cargo build -p voicevox_core_python_api -vv || true
[ -n "$(find ../../target/debug/deps -name 'libopen_jtalk_sys-*.rlib')" ]
- run: poetry run maturin build --locked
- run: poetry run maturin develop --locked
- name: 必要なDLLをコピーしてpytestを実行
Expand Down
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions crates/voicevox_core_python_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ version = "0.0.0"
edition.workspace = true
publish.workspace = true

[package.metadata.maturin]
name = "voicevox_core._rust"
python-source = "python"

[lib]
crate-type = ["cdylib"]

Expand All @@ -18,9 +14,9 @@ directml = ["voicevox_core/directml"]
easy-ext.workspace = true
log = "0.4.17"
once_cell.workspace = true
pyo3 = { version = "0.18.0", features = ["abi3-py38", "extension-module"] }
pyo3-asyncio = { version = "0.18.0", features = ["tokio-runtime"] }
pyo3-log = "0.8.0"
pyo3 = { version = "0.19.2", features = ["abi3-py38", "extension-module"] }
pyo3-asyncio = { version = "0.19.0", features = ["tokio-runtime"] }
pyo3-log = "0.9.0"
serde.workspace = true
serde_json.workspace = true
tokio.workspace = true
Expand Down
8 changes: 8 additions & 0 deletions crates/voicevox_core_python_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ VOICEVOX CORE の Python バインディングです。
## サンプル実行

`maturin develop` で editable な状態でインストールした後、[example/python](../../example/python) にてサンプルを実行できます。

## トラブルシューティング

Maturinで依存クレート(例: [open\_jtalk-sys](https://github.com/VOICEVOX/open_jtalk-rs))のビルドが失敗する場合は、Maturinの外であらかじめ `cargo build` すれば解決する場合があります。リンクまでは上手くいかないかもしれませんが、該当の依存クレートまではビルドできるかもしれません。

```console
cargo build -p voicevox_core_python_api [--releasee]
```
31 changes: 16 additions & 15 deletions crates/voicevox_core_python_api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions crates/voicevox_core_python_api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ classifiers = [
# readme = "README.md"

[build-system]
requires = ["maturin>=0.13.2,<0.14"]
requires = ["maturin>=1.3.1,<2"]
build-backend = "maturin"

[tool.isort]
profile = "black"

[tool.maturin]
module-name = "voicevox_core._rust"
bindings = "pyo3"
skip-auditwheel = true # Linuxでlibonnxruntime.so.*の不在を許してもらう
python-source = "python"

[tool.poetry]
# Poetryはこれがないと動かない
Expand All @@ -43,7 +45,7 @@ pydata-sphinx-theme = "0.14.1"
sphinx-autoapi = "3.0.0"

[tool.poetry.group.dev.dependencies]
maturin = "0.13.7"
maturin = "1.3.1"

[tool.poetry.group.test.dependencies]
pytest = "7.3.1"
Expand Down

0 comments on commit eda04a0

Please sign in to comment.