From 7a302ec794d00fe60847d6838a11c5885e82b326 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 2 Sep 2023 22:54:59 +0900 Subject: [PATCH 1/8] =?UTF-8?q?Add:=20Python=E3=81=AElint=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../python/test/test_user_dict_load.py | 3 ++- .../python/test/test_user_dict_manipulate.py | 3 ++- .../python/voicevox_core/__init__.py | 8 ++++---- .../python/voicevox_core/_models.py | 2 +- .../python/voicevox_core/_rust.pyi | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/voicevox_core_python_api/python/test/test_user_dict_load.py b/crates/voicevox_core_python_api/python/test/test_user_dict_load.py index 8c506a50f..d9829e6da 100644 --- a/crates/voicevox_core_python_api/python/test/test_user_dict_load.py +++ b/crates/voicevox_core_python_api/python/test/test_user_dict_load.py @@ -2,8 +2,9 @@ # AudioQueryのkanaを比較して変化するかどうかで判断する。 from uuid import UUID -import pytest + import conftest # noqa: F401 +import pytest import voicevox_core # noqa: F401 diff --git a/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py b/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py index c9bc2c454..f7902ea94 100644 --- a/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py +++ b/crates/voicevox_core_python_api/python/test/test_user_dict_manipulate.py @@ -2,8 +2,9 @@ # どのコードがどの操作を行っているかはコメントを参照。 import os -from uuid import UUID import tempfile +from uuid import UUID + import pytest import voicevox_core # noqa: F401 diff --git a/crates/voicevox_core_python_api/python/voicevox_core/__init__.py b/crates/voicevox_core_python_api/python/voicevox_core/__init__.py index f59f705dd..ce6245bfc 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/__init__.py +++ b/crates/voicevox_core_python_api/python/voicevox_core/__init__.py @@ -11,15 +11,15 @@ UserDictWord, UserDictWordType, ) -from ._rust import ( - __version__, +from ._rust import ( # noqa: F401 OpenJtalk, Synthesizer, + UserDict, VoiceModel, VoicevoxError, - UserDict, + __version__, supported_devices, -) # noqa: F401 +) __all__ = [ "__version__", diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_models.py b/crates/voicevox_core_python_api/python/voicevox_core/_models.py index b559100be..c1cd9ccca 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_models.py +++ b/crates/voicevox_core_python_api/python/voicevox_core/_models.py @@ -4,7 +4,7 @@ import pydantic -from ._rust import _validate_pronunciation, _to_zenkaku +from ._rust import _to_zenkaku, _validate_pronunciation @pydantic.dataclasses.dataclass diff --git a/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi b/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi index fcc726b25..611510259 100644 --- a/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi +++ b/crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Dict, Final, List, Literal, Union, TYPE_CHECKING +from typing import TYPE_CHECKING, Dict, Final, List, Literal, Union from uuid import UUID import numpy as np From 30b7fb537eb44b44a1dd1a38565948fb7f324391 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 2 Sep 2023 22:57:20 +0900 Subject: [PATCH 2/8] =?UTF-8?q?Add:=20Java=E3=81=AElint=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python_lint.yml | 45 +++++++++++++++++++ .../hiroshiba/voicevoxcore/Synthesizer.java | 4 -- .../jp/hiroshiba/voicevoxcore/UserDict.java | 3 +- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/python_lint.yml diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml new file mode 100644 index 000000000..3e1b45790 --- /dev/null +++ b/.github/workflows/python_lint.yml @@ -0,0 +1,45 @@ +name: "Lint code" + +on: + push: + paths: + - "**.py" + - "./.github/workflows/python_lint.yml" + +defaults: + run: + shell: bash + +jobs: + python: + defaults: + run: + working-directory: ./crates/voicevox_core_python_api + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + - name: Check code style + run: | + black --check . + isort --check . + java: + defaults: + run: + working-directory: ./crates/voicevox_core_java_api + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 + with: + java-version: "11" + distribution: "adopt" + - name: Check code style + run: | + ./gradlew spotlessCheck --info diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java index 2e97cc59c..dd0fdbb1f 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java @@ -55,7 +55,6 @@ public boolean isLoadedVoiceModel(String voiceModelId) { * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAudioQueryConfigurator}。 - * * @see CreateAudioQueryConfigurator#execute */ @Nonnull @@ -69,7 +68,6 @@ public CreateAudioQueryConfigurator createAudioQuery(String text, int styleId) { * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAccentPhrasesConfigurator}。 - * * @see CreateAccentPhrasesConfigurator#execute */ @Nonnull @@ -137,7 +135,6 @@ public List replaceMoraPitch(List accentPhrases, int * @param audioQuery {@link AudioQuery}。 * @param styleId スタイルID。 * @return {@link SynthesisConfigurator}。 - * * @see SynthesisConfigurator#execute */ @Nonnull @@ -151,7 +148,6 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) { * @param text テキスト。 * @param styleId スタイルID。 * @return {@link TtsConfigurator}。 - * * @see TtsConfigurator#execute */ @Nonnull diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java index e31d56338..d75924feb 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java @@ -6,7 +6,6 @@ import com.google.gson.internal.LinkedTreeMap; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; - import java.lang.ref.Cleaner; import java.util.HashMap; import javax.annotation.Nonnull; @@ -177,7 +176,7 @@ public static class Word { /** * UserDict.Wordを作成する。 * - * @param surface 言葉の表層形。 + * @param surface 言葉の表層形。 * @param pronunciation 言葉の発音。 * @throws IllegalArgumentException pronunciationが不正な場合。 */ From 1a2a01507fc6622a379ce18fc851836d80a96175 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 2 Sep 2023 22:57:58 +0900 Subject: [PATCH 3/8] Change: python_lint.yml -> lint.yml --- .github/workflows/{python_lint.yml => lint.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{python_lint.yml => lint.yml} (100%) diff --git a/.github/workflows/python_lint.yml b/.github/workflows/lint.yml similarity index 100% rename from .github/workflows/python_lint.yml rename to .github/workflows/lint.yml From b170e1af3e370539c7a8f5e80993a0edb15c8439 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 2 Sep 2023 23:01:49 +0900 Subject: [PATCH 4/8] =?UTF-8?q?Change:=20=E5=88=86=E9=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/java_lint.yml | 25 +++++++++++++++++++ .../workflows/{lint.yml => python_lint.yml} | 18 +------------ 2 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/java_lint.yml rename .github/workflows/{lint.yml => python_lint.yml} (55%) diff --git a/.github/workflows/java_lint.yml b/.github/workflows/java_lint.yml new file mode 100644 index 000000000..786d317e5 --- /dev/null +++ b/.github/workflows/java_lint.yml @@ -0,0 +1,25 @@ +name: "Lint code" + +on: + push: + paths: + - "**.java" + - "./.github/workflows/java_lint.yml" + +defaults: + run: + shell: bash + working-directory: ./crates/voicevox_core_java_api + +jobs: + java-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 + with: + java-version: "11" + distribution: "adopt" + - name: Check code style + run: | + ./gradlew spotlessCheck --info diff --git a/.github/workflows/lint.yml b/.github/workflows/python_lint.yml similarity index 55% rename from .github/workflows/lint.yml rename to .github/workflows/python_lint.yml index 3e1b45790..954bd2554 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/python_lint.yml @@ -9,12 +9,10 @@ on: defaults: run: shell: bash + working-directory: ./crates/voicevox_core_python_api jobs: python: - defaults: - run: - working-directory: ./crates/voicevox_core_python_api runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -29,17 +27,3 @@ jobs: run: | black --check . isort --check . - java: - defaults: - run: - working-directory: ./crates/voicevox_core_java_api - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 - with: - java-version: "11" - distribution: "adopt" - - name: Check code style - run: | - ./gradlew spotlessCheck --info From b2605ea063874c06fd1b85a847925110d7f393ce Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 2 Sep 2023 23:06:17 +0900 Subject: [PATCH 5/8] =?UTF-8?q?Fix:=20pull=5Frequest=E3=81=A7=E3=82=82?= =?UTF-8?q?=E5=8B=95=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/java_lint.yml | 6 +++++- .github/workflows/python_lint.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/java_lint.yml b/.github/workflows/java_lint.yml index 786d317e5..5bccb5be1 100644 --- a/.github/workflows/java_lint.yml +++ b/.github/workflows/java_lint.yml @@ -1,10 +1,14 @@ -name: "Lint code" +name: "Lint Java code" on: push: paths: - "**.java" - "./.github/workflows/java_lint.yml" + pull_request: + paths: + - "**.java" + - "./.github/workflows/java_lint.yml" defaults: run: diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml index 954bd2554..246b54cf4 100644 --- a/.github/workflows/python_lint.yml +++ b/.github/workflows/python_lint.yml @@ -1,10 +1,14 @@ -name: "Lint code" +name: "Lint Python code" on: push: paths: - "**.py" - "./.github/workflows/python_lint.yml" + pull_request: + paths: + - "**.py" + - "./.github/workflows/python_lint.yml" defaults: run: From f26425cd636fa15ec53a17bb4fc404403b32e21c Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 3 Sep 2023 20:20:32 +0900 Subject: [PATCH 6/8] =?UTF-8?q?Change:=20=E5=AE=9F=E8=A1=8C=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E3=82=92download=5Ftest=E3=81=A8=E3=81=BB=E3=81=BC?= =?UTF-8?q?=E5=90=8C=E3=81=98=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: qryxip --- .github/workflows/java_lint.yml | 12 +++++++----- .github/workflows/python_lint.yml | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/java_lint.yml b/.github/workflows/java_lint.yml index 5bccb5be1..b631819b8 100644 --- a/.github/workflows/java_lint.yml +++ b/.github/workflows/java_lint.yml @@ -2,13 +2,15 @@ name: "Lint Java code" on: push: - paths: - - "**.java" - - "./.github/workflows/java_lint.yml" + branches: + - main pull_request: paths: - - "**.java" - - "./.github/workflows/java_lint.yml" + - ./crates/voicevox_core_java_api/**/*.java + - ./crates/voicevox_core_java_api/gradle/** + - ./crates/voicevox_core_java_api/gradlew + - ./crates/voicevox_core_java_api/settings.gradle + - ./.github/workflows/java_lint.yml defaults: run: diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml index 246b54cf4..177afae54 100644 --- a/.github/workflows/python_lint.yml +++ b/.github/workflows/python_lint.yml @@ -2,13 +2,14 @@ name: "Lint Python code" on: push: - paths: - - "**.py" - - "./.github/workflows/python_lint.yml" + branches: + - main pull_request: paths: - - "**.py" - - "./.github/workflows/python_lint.yml" + - ./crates/voicevox_core_python_api/**/*.py + - ./crates/voicevox_core_python_api/requirements*.txt + - ./crates/voicevox_core_python_api/pyproject.toml + - ./.github/workflows/python_lint.yml defaults: run: From a4a8f64990dff9e889019adacab2d78c87d4f000 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 3 Sep 2023 20:22:22 +0900 Subject: [PATCH 7/8] =?UTF-8?q?Add:=20example=E3=82=92=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python_lint.yml | 8 +++++++- example/python/run.py | 9 ++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml index 177afae54..f4302ac88 100644 --- a/.github/workflows/python_lint.yml +++ b/.github/workflows/python_lint.yml @@ -6,6 +6,7 @@ on: - main pull_request: paths: + - ./example/python/**/*.py - ./crates/voicevox_core_python_api/**/*.py - ./crates/voicevox_core_python_api/requirements*.txt - ./crates/voicevox_core_python_api/pyproject.toml @@ -28,7 +29,12 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - - name: Check code style + - name: Check code style for voicevox_core_python_api + run: | + black --check . + isort --check . + - name: Check code style for example/python + working-directory: ../example/python run: | black --check . isort --check . diff --git a/example/python/run.py b/example/python/run.py index 04feef83e..026b67a80 100644 --- a/example/python/run.py +++ b/example/python/run.py @@ -7,13 +7,8 @@ from typing import Tuple import voicevox_core -from voicevox_core import ( - AccelerationMode, - AudioQuery, - OpenJtalk, - Synthesizer, - VoiceModel, -) +from voicevox_core import (AccelerationMode, AudioQuery, OpenJtalk, + Synthesizer, VoiceModel) async def main() -> None: From 567faa5f6a1d90e62e4e7ee8496adcdb84944407 Mon Sep 17 00:00:00 2001 From: Nanashi Date: Sat, 9 Sep 2023 01:13:55 +0900 Subject: [PATCH 8/8] =?UTF-8?q?Fix:=20working-directory=E3=81=8C=E9=96=93?= =?UTF-8?q?=E9=81=95=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml index f4302ac88..c12b256cf 100644 --- a/.github/workflows/python_lint.yml +++ b/.github/workflows/python_lint.yml @@ -34,7 +34,7 @@ jobs: black --check . isort --check . - name: Check code style for example/python - working-directory: ../example/python + working-directory: ./example/python run: | black --check . isort --check .