bhtool 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bhtool
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Assorted CLI utilities for Bosco’s workflows (dev, media, macOS, LLM helpers).
5
5
  Author-email: Bosco Ho <apposite@gmail.com>
6
6
  Requires-Python: >=3.13
@@ -48,7 +48,7 @@ Assorted CLI utilities that are handy in Bosco’s day-to-day work—version bum
48
48
 
49
49
  ### Movies + LLM
50
50
 
51
- `LLM_SERVICE` selects the backend (`openai`, `groq`, `ollama`, `bedrock`, …). Set it in the process environment or in **`bhtool/.env`** (loaded from the installed package directory). Model defaults come from [microeval](https://pypi.org/project/microeval/)’s config for that service.
51
+ `b movies --service <name>` selects the backend for one run (`openai`, `groq`, `ollama`, `bedrock` — see `b movies --help`). `LLM_SERVICE` sets the default. Set `LLM_SERVICE` in the process environment or in **`bhtool/.env`** (loaded from the installed package directory). Model defaults come from [microeval](https://pypi.org/project/microeval/)’s config for that service.
52
52
 
53
53
  ---
54
54
 
@@ -32,7 +32,7 @@ Assorted CLI utilities that are handy in Bosco’s day-to-day work—version bum
32
32
 
33
33
  ### Movies + LLM
34
34
 
35
- `LLM_SERVICE` selects the backend (`openai`, `groq`, `ollama`, `bedrock`, …). Set it in the process environment or in **`bhtool/.env`** (loaded from the installed package directory). Model defaults come from [microeval](https://pypi.org/project/microeval/)’s config for that service.
35
+ `b movies --service <name>` selects the backend for one run (`openai`, `groq`, `ollama`, `bedrock` — see `b movies --help`). `LLM_SERVICE` sets the default. Set `LLM_SERVICE` in the process environment or in **`bhtool/.env`** (loaded from the installed package directory). Model defaults come from [microeval](https://pypi.org/project/microeval/)’s config for that service.
36
36
 
37
37
  ---
38
38
 
@@ -7,6 +7,7 @@ from typing import Literal
7
7
  from cyclopts import App
8
8
 
9
9
  from bhtool.gdoc import app as gdoc_app
10
+ from bhtool.llm_services import LLMService
10
11
 
11
12
  app = App(name="bhtool", help="boscoh tools")
12
13
  app.command(gdoc_app)
@@ -106,17 +107,22 @@ def todict_cmd(json: str | None = None, yaml: str | None = None):
106
107
 
107
108
 
108
109
  @app.command(name="movies")
109
- def movies_cmd(root_dir: str | None = None, execute: bool = False):
110
+ def movies_cmd(
111
+ root_dir: str | None = None,
112
+ execute: bool = False,
113
+ service: LLMService | None = None,
114
+ ):
110
115
  """Normalize movie names with an LLM.
111
116
 
112
117
  :param root_dir: Root directory containing movies (positional); default is current working directory.
113
118
  :param execute: If true, perform renames; otherwise dry run (table output).
119
+ :param service: LLM service for normalization; default from LLM_SERVICE, else openai.
114
120
  """
115
121
  import bhtool.list_movies as list_movies_mod
116
122
 
117
123
  if root_dir == "rename":
118
124
  root_dir = None
119
- list_movies_mod.rename(root_dir=root_dir, execute=execute)
125
+ list_movies_mod.rename(root_dir=root_dir, execute=execute, service=service)
120
126
 
121
127
 
122
128
  def main() -> None:
@@ -351,7 +351,9 @@ def _root_dir(movies_dir: str | None = None) -> Path:
351
351
  return Path.cwd()
352
352
 
353
353
 
354
- def rename(root_dir: str | None = None, execute: bool = False):
354
+ def rename(
355
+ root_dir: str | None = None, execute: bool = False, service: str | None = None
356
+ ):
355
357
  console = Console()
356
358
  intro = Text.assemble(
357
359
  ("LLM-normalize names → ", ""),
@@ -362,7 +364,7 @@ def rename(root_dir: str | None = None, execute: bool = False):
362
364
  )
363
365
  console.print(_panel_lines(intro, title=_MOVIES_TITLE, border=_MOVIES_BORDER))
364
366
  root = _root_dir(root_dir)
365
- svc = os.environ.get("LLM_SERVICE", "openai")
367
+ svc = service or os.environ.get("LLM_SERVICE", "openai")
366
368
  mapping = run_normalize_with_llm(root, svc, console=console)
367
369
  mapping_path = Path.cwd() / "movie_mapping.json"
368
370
  mapping_path.write_text(json.dumps(mapping, indent=2))
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """LLM service names shared by the CLI and the movies command.
4
+
5
+ Keep ``LLMService`` in sync with ``microeval.llm.LLM_CLIENTS``. This module has
6
+ no heavy imports, so the CLI can show the choices without importing microeval
7
+ at startup.
8
+ """
9
+
10
+ from typing import Literal, get_args
11
+
12
+ LLMService = Literal["openai", "groq", "ollama", "bedrock"]
13
+
14
+ LLM_SERVICES = get_args(LLMService)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bhtool"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "Assorted CLI utilities for Bosco’s workflows (dev, media, macOS, LLM helpers)."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes