File tree Expand file tree Collapse file tree 7 files changed +67
-0
lines changed
Expand file tree Collapse file tree 7 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,9 @@ dev = [
104104[project .urls ]
105105Homepage = " https://github.com/castorini/rank_llm"
106106
107+ [project .scripts ]
108+ rank-llm = " rank_llm.cli.main:main"
109+
107110[tool .bumpver ]
108111current_version = " 0.25.7"
109112version_pattern = " MAJOR.MINOR.PATCH"
@@ -138,10 +141,13 @@ where = ["src"]
138141include = [
139142 " rank_llm" ,
140143 " rank_llm.analysis" ,
144+ " rank_llm.cli" ,
141145 " rank_llm.evaluation" ,
142146 " rank_llm.rerank" ,
143147 " rank_llm.rerank.*" ,
144148 " rank_llm.retrieve" ,
149+ " rank_llm.server" ,
150+ " rank_llm.server.*" ,
145151]
146152namespaces = false
147153
Original file line number Diff line number Diff line change 1+ """Packaged CLI surface for RankLLM."""
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ import argparse
4+ from collections .abc import Sequence
5+
6+
7+ def build_parser () -> argparse .ArgumentParser :
8+ parser = argparse .ArgumentParser (
9+ prog = "rank-llm" ,
10+ description = "Packaged CLI entrypoint for RankLLM." ,
11+ )
12+ return parser
13+
14+
15+ def main (argv : Sequence [str ] | None = None ) -> int :
16+ parser = build_parser ()
17+ parser .parse_args (argv )
18+ return 0
19+
20+
21+ if __name__ == "__main__" :
22+ raise SystemExit (main ())
Original file line number Diff line number Diff line change 1+ """Server entrypoints for RankLLM transports."""
Original file line number Diff line number Diff line change 1+ """Flask compatibility server for RankLLM."""
Original file line number Diff line number Diff line change 1+ """MCP server for RankLLM."""
Original file line number Diff line number Diff line change 1+ import importlib
2+ import subprocess
3+ import unittest
4+ from pathlib import Path
5+ from shutil import which
6+
7+ REPO_ROOT = Path (__file__ ).resolve ().parents [1 ]
8+
9+
10+ class TestCLIPackaging (unittest .TestCase ):
11+ def test_cli_module_imports (self ):
12+ module = importlib .import_module ("rank_llm.cli.main" )
13+ self .assertTrue (callable (module .main ))
14+
15+ def test_server_mcp_module_imports (self ):
16+ module = importlib .import_module ("rank_llm.server.mcp" )
17+ self .assertIsNotNone (module )
18+
19+ def test_console_entrypoint_help_resolves (self ):
20+ cli = which ("rank-llm" )
21+ self .assertIsNotNone (cli , msg = "rank-llm is not installed in PATH" )
22+
23+ help_result = subprocess .run (
24+ [cli , "--help" ],
25+ cwd = REPO_ROOT ,
26+ check = False ,
27+ capture_output = True ,
28+ text = True ,
29+ )
30+ self .assertEqual (help_result .returncode , 0 , msg = help_result .stderr )
31+ self .assertIn ("Packaged CLI entrypoint for RankLLM" , help_result .stdout )
32+
33+
34+ if __name__ == "__main__" :
35+ unittest .main ()
You can’t perform that action at this time.
0 commit comments