Skip to content

Commit

Permalink
cli stub in lib package
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Oct 15, 2024
1 parent 4c1acf2 commit 963e601
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ vocal-remover = { git = "https://github.com/Japan7/vocal-remover.git", branch =
[tool.uv.workspace]
members = ["yohane-cli"]

[project.scripts]
yohane = "yohane.__main__:main"

[project.urls]
Homepage = "https://github.com/Japan7/yohane"

Expand Down
3 changes: 0 additions & 3 deletions yohane-cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ authors = [{ name = "NextFire", email = "[email protected]" }]
requires-python = ">=3.10"
dependencies = ["typer-slim[standard]==0.12.5"]

[project.scripts]
yohane = "yohane_cli:app"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
2 changes: 1 addition & 1 deletion yohane-cli/yohane_cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import typer
from rich import print

from yohane import Yohane
from yohane.audio import (
HybridDemucsVocalsExtractor,
VocalRemoverVocalsExtractor,
)
from yohane.pipeline import Yohane


class VocalsExtractorChoice(str, Enum):
Expand Down
14 changes: 14 additions & 0 deletions yohane/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
try:
from yohane_cli import app # type: ignore
except ImportError:
app = None


def main():
if not app:
raise RuntimeError('To use the yohane command, please install "yohane[cli]"')
app()


if __name__ == "__main__":
main()

0 comments on commit 963e601

Please sign in to comment.