Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate: Poetryに移行 #652

Merged
merged 12 commits into from
Oct 23, 2023
4 changes: 3 additions & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ jobs:
id: build-voicevox-core-python-api
run: |
rm -rf ./target/wheels
pip install -r ./crates/voicevox_core_python_api/requirements.txt
pip install --upgrade poetry
poetry config virtualenvs.create false
(cd crates/voicevox_core_python_api && poetry install --with dev)
function build() {
maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --features ${{ matrix.features }}, --target ${{ matrix.target }} --release
}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/generate_document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ jobs:
uses: taiki-e/install-action@cargo-binstall
- name: Create a venv
uses: ./.github/actions/create-venv
- name: pip install
run: pip install -r ./crates/voicevox_core_python_api/requirements.txt
- name: Install python dependencies
working-directory: ./crates/voicevox_core_python_api
run: |
pip install --upgrade poetry
poetry config virtualenvs.create false
poetry install --with test
- name: mkdir public
run: mkdir -p public/apis/c_api
- name: cp docs/apis/index.html
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ jobs:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
python -m pip install --upgrade poetry
poetry config virtualenvs.create false
poetry install --with test
- name: Check code style for voicevox_core_python_api
run: |
black --check .
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ jobs:
- os: macos-latest
- os: ubuntu-latest
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./crates/voicevox_core_python_api
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
Expand All @@ -268,21 +271,19 @@ jobs:
python-version: "3.8"
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file
- name: venv作成
uses: ./.github/actions/create-venv
- run: pip install -r ./crates/voicevox_core_python_api/requirements.txt
- run: |
pip install --upgrade poetry
poetry install --with dev --with test
- run: cargo build -p voicevox_core_c_api -vv
- run: maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked
- run: maturin develop --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked
- run: poetry run maturin build --locked
- run: poetry run maturin develop --locked
- name: 必要なDLLをコピーしてpytestを実行
working-directory: crates/voicevox_core_python_api
run: |
cp -v ../../target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/onnxruntime.dll . || true
cp -v ../../target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* . || true
cp -v ../../target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib . || true

pip install -r requirements-test.txt
pytest
poetry run pytest
build-and-test-java-api:
strategy:
fail-fast: false
Expand Down
25 changes: 3 additions & 22 deletions crates/voicevox_core_python_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,11 @@ VOICEVOX CORE の Python バインディングです。
以下の環境が必要です。

- Rustup
- Python ≧3.8の venv
- `maturin>=0.13.2,<0.14`

[Maturin](https://maturin.rs/)は venv にインストールする必要があります。
適当な場所に venv を作って下さい。

```console
❯ python -m venv ../../.venv
```

```console
❯ ../../.venv/Scripts/Activate.ps1 (Windows)
```

```console
❯ ../../.venv/bin/activate (maxOS/Linux)
```

venv を作ったらその venv 上で Maturin をインストールします。
- Python ≧ 3.8
- Poetry ≧ 1.6

```console
# maturinのインストール
❯ pip install -r ./requirements.txt
❯ poetry install --with dev
```

## ファイル構成
Expand All @@ -49,7 +31,6 @@ venv を作ったらその venv 上で Maturin をインストールします。
│ ├── _rust.abi3.{dll,dylib,so} : maturin developで生成されるpydファイルです。
│ └── _rust.pyi : _rust.abi3.{dll,dylib,so}用のpyiファイルです。
├── README.md
├── requirements.txt
└── src : Rustのソースコードです。_rust.abi3.{dll,dylib,so}にコンパイルされます。
└── lib.rs
```
Expand Down
Loading
Loading