diff --git a/.github/workflows/download_test.yml b/.github/workflows/download_test.yml index 2aebff525..14970ded4 100644 --- a/.github/workflows/download_test.yml +++ b/.github/workflows/download_test.yml @@ -185,28 +185,24 @@ jobs: - uses: actions/checkout@v3 - name: Set up Rust uses: ./.github/actions/rust-toolchain-from-file - - name: Get prerelease latest version if: ${{ env.VERSION == 'prerelease-latest' }} run: | VERSION=$( - curl -s https://api.github.com/repos/VOICEVOX/voicevox_core/releases \ + curl -sSf https://api.github.com/repos/VOICEVOX/voicevox_core/releases \ -H 'authorization: Bearer ${{ github.token }}' \ -H 'content-type: application/json' | jq -er '.[0].tag_name' ) echo "VERSION=$VERSION" >> "$GITHUB_ENV" - - name: Execute download command run: ${{ matrix.download_command }} --version ${{ env.VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check downloaded version run: | [ -e "${{ matrix.download_dir }}/VERSION" ] [ "$(cat "${{ matrix.download_dir }}/VERSION")" = "${{ env.VERSION }}" ] - - name: Check downloaded files run: | mapfile -t items < <(echo -n '${{ matrix.check_items }}') diff --git a/.github/workflows/java_lint.yml b/.github/workflows/java_lint.yml new file mode 100644 index 000000000..b631819b8 --- /dev/null +++ b/.github/workflows/java_lint.yml @@ -0,0 +1,31 @@ +name: "Lint Java code" + +on: + push: + branches: + - main + pull_request: + paths: + - ./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: + 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/python_lint.yml b/.github/workflows/python_lint.yml new file mode 100644 index 000000000..c12b256cf --- /dev/null +++ b/.github/workflows/python_lint.yml @@ -0,0 +1,40 @@ +name: "Lint Python code" + +on: + push: + branches: + - 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 + - ./.github/workflows/python_lint.yml + +defaults: + run: + shell: bash + working-directory: ./crates/voicevox_core_python_api + +jobs: + python: + 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 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/crates/download/src/main.rs b/crates/download/src/main.rs index fba1bc342..e52ca45f2 100644 --- a/crates/download/src/main.rs +++ b/crates/download/src/main.rs @@ -53,15 +53,15 @@ struct Args { min: bool, /// 出力先の指定 - #[arg(short, long, default_value(DEFAULT_OUTPUT))] + #[arg(short, long, value_name("DIRECTORY"), default_value(DEFAULT_OUTPUT))] output: PathBuf, /// ダウンロードするvoicevox_coreのバージョンの指定 - #[arg(short, long, default_value("latest"))] + #[arg(short, long, value_name("GIT_TAG_OR_LATEST"), default_value("latest"))] version: String, /// 追加でダウンロードするライブラリのバージョン - #[arg(long, default_value("latest"))] + #[arg(long, value_name("GIT_TAG_OR_LATEST"), default_value("latest"))] additional_libraries_version: String, /// ダウンロードするデバイスを指定する(cudaはlinuxのみ) 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 5047048b8..98bf9f403 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が不正な場合。 */ diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java index 6b157fdba..518f1de31 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java @@ -47,25 +47,25 @@ public static class SpeakerMeta { @SerializedName("name") @Expose @Nonnull - final String name; + public final String name; /** 話者に属するスタイル。 */ @SerializedName("styles") @Expose @Nonnull - final StyleMeta[] styles; + public final StyleMeta[] styles; /** 話者のUUID。 */ @SerializedName("speaker_uuid") @Expose @Nonnull - final String speakerUuid; + public final String speakerUuid; /** 話者のバージョン。 */ @SerializedName("version") @Expose @Nonnull - final String version; + public final String version; private SpeakerMeta() { // GSONからコンストラクトするため、このメソッドは呼ばれることは無い。 @@ -83,12 +83,12 @@ public static class StyleMeta { @SerializedName("name") @Expose @Nonnull - final String name; + public final String name; /** スタイルID。 */ @SerializedName("id") @Expose - final int id; + public final int id; private StyleMeta() { this.name = ""; 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 e9c700a91..324ea0117 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 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: