Skip to content

Commit

Permalink
added moshi-* scripts/entrypoints to pyproject.toml (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare authored Sep 20, 2024
1 parent 944286b commit ae34219
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions moshi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ license = {text = "MIT"}
dynamic = ["version"]
readme = "README.md"

[project.scripts]
moshi-server = "moshi.server:main"
moshi-client = "moshi.client:main"

[tool.setuptools.dynamic]
version = {attr = "moshi.__version__"}

Expand Down
15 changes: 8 additions & 7 deletions moshi_mlx/moshi_mlx/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ async def go():
pass


def main(printer: AnyPrinter):
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--tokenizer", type=str)
parser.add_argument("--moshi-weight", type=str)
Expand All @@ -276,6 +276,12 @@ def main(printer: AnyPrinter):
server_to_client = multiprocessing.Queue()
printer_q = multiprocessing.Queue()

printer: AnyPrinter
if sys.stdout.isatty():
printer = Printer()
else:
printer = RawPrinter()

# Create two processes
subprocess_args = printer_q, client_to_server, server_to_client, args
p1 = multiprocessing.Process(target=client, args=subprocess_args)
Expand Down Expand Up @@ -372,9 +378,4 @@ def main(printer: AnyPrinter):


if __name__ == "__main__":
printer: AnyPrinter
if sys.stdout.isatty():
printer = Printer()
else:
printer = RawPrinter()
main(printer)
main()
3 changes: 3 additions & 0 deletions moshi_mlx/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ license = {text = "MIT"}
dynamic = ["version"]
readme = "README.md"

[project.scripts]
moshi-local = "moshi_mlx.local:main"
moshi-local-web = "moshi_mlx.local_web:main"

[build-system]
requires = ["setuptools"]
Expand Down

0 comments on commit ae34219

Please sign in to comment.