diff --git a/build_util/make_docs.py b/build_util/make_docs.py index 696a38041..6634642fd 100644 --- a/build_util/make_docs.py +++ b/build_util/make_docs.py @@ -8,7 +8,7 @@ from voicevox_engine.dev.tts_engine.mock import MockTTSEngine from voicevox_engine.engine_manifest import load_manifest from voicevox_engine.preset.Preset import PresetManager -from voicevox_engine.setting.Setting import USER_SETTING_PATH, SettingHandler +from voicevox_engine.setting.setting_manager import USER_SETTING_PATH, SettingHandler from voicevox_engine.tts_pipeline.tts_engine import TTSEngineManager from voicevox_engine.user_dict.user_dict import UserDictionary from voicevox_engine.utility.path_utility import engine_manifest_path, engine_root diff --git a/run.py b/run.py index dc34dbe32..1168b4c28 100644 --- a/run.py +++ b/run.py @@ -16,11 +16,8 @@ from voicevox_engine.core.core_initializer import initialize_cores from voicevox_engine.engine_manifest import load_manifest from voicevox_engine.preset.Preset import PresetManager -from voicevox_engine.setting.Setting import ( - USER_SETTING_PATH, - CorsPolicyMode, - SettingHandler, -) +from voicevox_engine.setting.model import CorsPolicyMode +from voicevox_engine.setting.setting_manager import USER_SETTING_PATH, SettingHandler from voicevox_engine.tts_pipeline.tts_engine import make_tts_engines_from_cores from voicevox_engine.user_dict.user_dict import UserDictionary from voicevox_engine.utility.path_utility import engine_manifest_path, engine_root diff --git a/test/benchmark/engine_preparation.py b/test/benchmark/engine_preparation.py index 059d2c791..36dcf9787 100644 --- a/test/benchmark/engine_preparation.py +++ b/test/benchmark/engine_preparation.py @@ -11,7 +11,7 @@ from voicevox_engine.core.core_initializer import initialize_cores from voicevox_engine.engine_manifest import load_manifest from voicevox_engine.preset.PresetManager import PresetManager -from voicevox_engine.setting.Setting import SettingHandler +from voicevox_engine.setting.setting_manager import SettingHandler from voicevox_engine.tts_pipeline.tts_engine import make_tts_engines_from_cores from voicevox_engine.user_dict.user_dict import UserDictionary from voicevox_engine.utility.core_version_utility import get_latest_version diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py index d755e54f0..01acbbbb0 100644 --- a/test/e2e/conftest.py +++ b/test/e2e/conftest.py @@ -10,7 +10,7 @@ from voicevox_engine.core.core_initializer import initialize_cores from voicevox_engine.engine_manifest import load_manifest from voicevox_engine.preset.Preset import PresetManager -from voicevox_engine.setting.Setting import SettingHandler +from voicevox_engine.setting.setting_manager import SettingHandler from voicevox_engine.tts_pipeline.tts_engine import make_tts_engines_from_cores from voicevox_engine.user_dict.user_dict import UserDictionary from voicevox_engine.utility.path_utility import engine_manifest_path diff --git a/test/setting/test_setting.py b/test/setting/test_setting.py index 677c2b3d3..879dbf4d8 100644 --- a/test/setting/test_setting.py +++ b/test/setting/test_setting.py @@ -3,7 +3,8 @@ import pytest from pydantic import ValidationError -from voicevox_engine.setting.Setting import CorsPolicyMode, Setting, SettingHandler +from voicevox_engine.setting.model import CorsPolicyMode +from voicevox_engine.setting.setting_manager import Setting, SettingHandler def test_setting_handler_load_not_exist_file() -> None: diff --git a/voicevox_engine/app/application.py b/voicevox_engine/app/application.py index bbe435f1d..d6e4a2714 100644 --- a/voicevox_engine/app/application.py +++ b/voicevox_engine/app/application.py @@ -21,7 +21,8 @@ from voicevox_engine.library_manager import LibraryManager from voicevox_engine.metas.MetasStore import MetasStore from voicevox_engine.preset.Preset import PresetManager -from voicevox_engine.setting.Setting import CorsPolicyMode, SettingHandler +from voicevox_engine.setting.model import CorsPolicyMode +from voicevox_engine.setting.setting_manager import SettingHandler from voicevox_engine.tts_pipeline.tts_engine import TTSEngineManager from voicevox_engine.user_dict.user_dict import UserDictionary from voicevox_engine.utility.path_utility import engine_root, get_save_dir diff --git a/voicevox_engine/app/middlewares.py b/voicevox_engine/app/middlewares.py index 11aad4d88..3c44a2125 100644 --- a/voicevox_engine/app/middlewares.py +++ b/voicevox_engine/app/middlewares.py @@ -9,7 +9,7 @@ from fastapi.responses import JSONResponse from starlette.middleware.errors import ServerErrorMiddleware -from voicevox_engine.setting.Setting import CorsPolicyMode +from voicevox_engine.setting.model import CorsPolicyMode def configure_middlewares( diff --git a/voicevox_engine/app/routers/setting.py b/voicevox_engine/app/routers/setting.py index 94f50a86a..b01bb3049 100644 --- a/voicevox_engine/app/routers/setting.py +++ b/voicevox_engine/app/routers/setting.py @@ -6,7 +6,8 @@ from fastapi.templating import Jinja2Templates from voicevox_engine.engine_manifest import BrandName -from voicevox_engine.setting.Setting import CorsPolicyMode, Setting, SettingHandler +from voicevox_engine.setting.model import CorsPolicyMode +from voicevox_engine.setting.setting_manager import Setting, SettingHandler from voicevox_engine.utility.path_utility import resource_root from ..dependencies import check_disabled_mutable_api diff --git a/voicevox_engine/setting/model.py b/voicevox_engine/setting/model.py new file mode 100644 index 000000000..9ddd07d66 --- /dev/null +++ b/voicevox_engine/setting/model.py @@ -0,0 +1,15 @@ +""" +エンジン設定機能に関して API と ENGINE 内部実装が共有するモデル +「API と ENGINE 内部実装が共有するモデル」については `voicevox_engine/model.py` の module docstring を確認すること。 +""" + +from enum import Enum + + +class CorsPolicyMode(str, Enum): + """ + CORSの許可モード + """ + + all = "all" # 全てのオリジンからのリクエストを許可 + localapps = "localapps" # ローカルアプリケーションからのリクエストを許可 diff --git a/voicevox_engine/setting/Setting.py b/voicevox_engine/setting/setting_manager.py similarity index 88% rename from voicevox_engine/setting/Setting.py rename to voicevox_engine/setting/setting_manager.py index 967592d9b..7f0008884 100644 --- a/voicevox_engine/setting/Setting.py +++ b/voicevox_engine/setting/setting_manager.py @@ -5,15 +5,7 @@ from pydantic import BaseModel, Field from ..utility.path_utility import get_save_dir - - -class CorsPolicyMode(str, Enum): - """ - CORSの許可モード - """ - - all = "all" # 全てのオリジンからのリクエストを許可 - localapps = "localapps" # ローカルアプリケーションからのリクエストを許可 +from .model import CorsPolicyMode class Setting(BaseModel):