From 5be71fc7da8707274e9c243876508c3972434099 Mon Sep 17 00:00:00 2001 From: Marty Oehme <marty.oehme@gmail.com> Date: Sat, 18 Jan 2025 10:39:56 +0100 Subject: [PATCH] Use hatch build system to add cli entrypoint --- pyproject.toml | 12 ++++++++++++ summarize.py | 4 ++-- uv.lock | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bc886ae..75daa03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,3 +9,15 @@ dependencies = [ "python-tgpt>=0.8.1", "yt-dlp>=2025.1.15", ] + +[project.scripts] +summarize = "summarize:cli" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = [ + "summarize.py", +] diff --git a/summarize.py b/summarize.py index 8ce7869..11e7748 100755 --- a/summarize.py +++ b/summarize.py @@ -92,7 +92,7 @@ def rm_dir(dir: Path | str) -> None: type=str, help="Use custom prompt.", ) -def process_file( +def cli( file_path: Path | str, json_transcript: bool, youtube: bool, prompt: str ): """Provide summary for a file at the specified path or a youtube video at the specified url.""" @@ -118,4 +118,4 @@ def process_file( print(summarize_text_file(content, prompt)) if __name__ == "__main__": - process_file() + cli() diff --git a/uv.lock b/uv.lock index cfef1c2..2d7073d 100644 --- a/uv.lock +++ b/uv.lock @@ -485,7 +485,7 @@ wheels = [ [[package]] name = "pytgpt-summarize" version = "0.1.0" -source = { virtual = "." } +source = { editable = "." } dependencies = [ { name = "click" }, { name = "python-tgpt" },