-
Notifications
You must be signed in to change notification settings - Fork 119
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
PythonのブロッキングAPIを実装 #706
Merged
Merged
PythonのブロッキングAPIを実装 #706
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b9edd5b
`blocking.{OpenJtalk,UserDict}`
qryxip 4b748f5
`voicevox_core.asyncio`
qryxip 8d0ead3
Blackとisortに`--diff`を付ける
qryxip a31760f
isort
qryxip d58ae78
`blocking.{Synthesizer,VoiceModel}`
qryxip 9da8b12
`add_class`
qryxip 16b8428
example/python/run.pyをブロッキング版に
qryxip 9c99edc
テストをコピペで実装
qryxip d7fed1f
#701 の動作チェックにrun-asyncio.pyを追加
qryxip a2a8143
`shell: bash`
qryxip 5000662
#699 のusage.mdを更新
qryxip d5083e5
スタイルの統一
qryxip 6b74f6c
run-asyncio.pyのコメント変更
qryxip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
104 changes: 104 additions & 0 deletions
104
crates/voicevox_core_python_api/python/voicevox_core/_rust/blocking.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING, Dict, Union | ||
from uuid import UUID | ||
|
||
if TYPE_CHECKING: | ||
from voicevox_core import UserDictWord | ||
|
||
class OpenJtalk: | ||
""" | ||
テキスト解析器としてのOpen JTalk。 | ||
|
||
Parameters | ||
---------- | ||
open_jtalk_dict_dir | ||
Open JTalkの辞書ディレクトリ。 | ||
""" | ||
|
||
def __init__(self, open_jtalk_dict_dir: Union[Path, str]) -> None: ... | ||
def use_user_dict(self, user_dict: UserDict) -> None: | ||
""" | ||
ユーザー辞書を設定する。 | ||
|
||
この関数を呼び出した後にユーザー辞書を変更した場合は、再度この関数を呼ぶ必要がある。 | ||
|
||
Parameters | ||
---------- | ||
user_dict | ||
ユーザー辞書。 | ||
""" | ||
... | ||
|
||
class UserDict: | ||
"""ユーザー辞書。""" | ||
|
||
@property | ||
def words(self) -> Dict[UUID, UserDictWord]: | ||
"""このオプジェクトの :class:`dict` としての表現。""" | ||
... | ||
def __init__(self) -> None: ... | ||
def load(self, path: str) -> None: | ||
"""ファイルに保存されたユーザー辞書を読み込む。 | ||
|
||
Parameters | ||
---------- | ||
path | ||
ユーザー辞書のパス。 | ||
""" | ||
... | ||
def save(self, path: str) -> None: | ||
""" | ||
ユーザー辞書をファイルに保存する。 | ||
|
||
Parameters | ||
---------- | ||
path | ||
ユーザー辞書のパス。 | ||
""" | ||
... | ||
def add_word(self, word: UserDictWord) -> UUID: | ||
""" | ||
単語を追加する。 | ||
|
||
Parameters | ||
---------- | ||
word | ||
追加する単語。 | ||
|
||
Returns | ||
------- | ||
単語のUUID。 | ||
""" | ||
... | ||
def update_word(self, word_uuid: UUID, word: UserDictWord) -> None: | ||
""" | ||
単語を更新する。 | ||
|
||
Parameters | ||
---------- | ||
word_uuid | ||
更新する単語のUUID。 | ||
word | ||
新しい単語のデータ。 | ||
""" | ||
... | ||
def remove_word(self, word_uuid: UUID) -> None: | ||
""" | ||
単語を削除する。 | ||
|
||
Parameters | ||
---------- | ||
word_uuid | ||
削除する単語のUUID。 | ||
""" | ||
... | ||
def import_dict(self, other: UserDict) -> None: | ||
""" | ||
ユーザー辞書をインポートする。 | ||
|
||
Parameters | ||
---------- | ||
other | ||
インポートするユーザー辞書。 | ||
""" | ||
... |
3 changes: 3 additions & 0 deletions
3
crates/voicevox_core_python_api/python/voicevox_core/blocking.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from ._rust.blocking import OpenJtalk, UserDict | ||
|
||
__all__ = ["OpenJtalk", "UserDict"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRが出ているが、以下のコメントから約2ヶ月放置されている状態になっている。
readthedocs/sphinx-autoapi#406 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あと、このworkaroundを実行するとコードとしては壊れて実行できなくなる(_rust.abi3.*よりも_rust/__init__.pyの方が優先されるらしい)。
Sphinxを騙すためだけにGHA上で実行。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手元で生成するのに面倒が生じてきてるので、いっそのこと他言語ごと
❯ cargo xtask doc [--only rust c python ...] [--open]
みたいな感じで生成できるようにした方がよいかもしれない。