nexbench 0.1.0__py3-none-any.whl
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.
- nexbench/__init__.py +4 -0
- nexbench/cli.py +45 -0
- nexbench/core.py +52 -0
- nexbench-0.1.0.dist-info/METADATA +24 -0
- nexbench-0.1.0.dist-info/RECORD +8 -0
- nexbench-0.1.0.dist-info/WHEEL +5 -0
- nexbench-0.1.0.dist-info/entry_points.txt +2 -0
- nexbench-0.1.0.dist-info/top_level.txt +1 -0
nexbench/__init__.py
ADDED
nexbench/cli.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
from typing import Sequence
|
|
6
|
+
|
|
7
|
+
from . import __version__
|
|
8
|
+
from .core import evaluate
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
12
|
+
parser = argparse.ArgumentParser(prog="nexbench")
|
|
13
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
14
|
+
|
|
15
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
16
|
+
|
|
17
|
+
eval_parser = subparsers.add_parser("eval", help="Evaluate a target path")
|
|
18
|
+
eval_parser.add_argument("target", help="File or directory to evaluate")
|
|
19
|
+
eval_parser.add_argument("--json", action="store_true", help="Output JSON")
|
|
20
|
+
|
|
21
|
+
return parser
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
25
|
+
parser = build_parser()
|
|
26
|
+
args = parser.parse_args(argv)
|
|
27
|
+
|
|
28
|
+
if args.command == "eval":
|
|
29
|
+
result = evaluate(args.target)
|
|
30
|
+
if args.json:
|
|
31
|
+
print(json.dumps(result.as_dict(), indent=2))
|
|
32
|
+
else:
|
|
33
|
+
print(f"target: {result.target}")
|
|
34
|
+
print(f"exists: {result.exists}")
|
|
35
|
+
print(f"kind: {result.kind}")
|
|
36
|
+
print(f"score: {result.score}")
|
|
37
|
+
print(f"summary: {result.summary}")
|
|
38
|
+
return 0 if result.exists else 1
|
|
39
|
+
|
|
40
|
+
parser.error("Unknown command")
|
|
41
|
+
return 2
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
raise SystemExit(main())
|
nexbench/core.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(slots=True)
|
|
8
|
+
class EvalResult:
|
|
9
|
+
target: str
|
|
10
|
+
exists: bool
|
|
11
|
+
kind: str
|
|
12
|
+
score: float
|
|
13
|
+
summary: str
|
|
14
|
+
|
|
15
|
+
def as_dict(self) -> dict[str, str | bool | float]:
|
|
16
|
+
return {
|
|
17
|
+
"target": self.target,
|
|
18
|
+
"exists": self.exists,
|
|
19
|
+
"kind": self.kind,
|
|
20
|
+
"score": self.score,
|
|
21
|
+
"summary": self.summary,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def evaluate(target: str) -> EvalResult:
|
|
26
|
+
path = Path(target)
|
|
27
|
+
exists = path.exists()
|
|
28
|
+
if not exists:
|
|
29
|
+
return EvalResult(
|
|
30
|
+
target=target,
|
|
31
|
+
exists=False,
|
|
32
|
+
kind="missing",
|
|
33
|
+
score=0.0,
|
|
34
|
+
summary="Target does not exist.",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if path.is_dir():
|
|
38
|
+
kind = "directory"
|
|
39
|
+
score = 1.0
|
|
40
|
+
summary = "Target directory is available for evaluation."
|
|
41
|
+
else:
|
|
42
|
+
kind = "file"
|
|
43
|
+
score = 1.0
|
|
44
|
+
summary = "Target file is available for evaluation."
|
|
45
|
+
|
|
46
|
+
return EvalResult(
|
|
47
|
+
target=str(path),
|
|
48
|
+
exists=True,
|
|
49
|
+
kind=kind,
|
|
50
|
+
score=score,
|
|
51
|
+
summary=summary,
|
|
52
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nexbench
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Minimal NexBench Python library and CLI
|
|
5
|
+
Author: nexbench
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# nexbench
|
|
10
|
+
|
|
11
|
+
Minimal Python library and CLI.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install -e .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## CLI
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
nexbench eval .
|
|
23
|
+
nexbench eval --json .
|
|
24
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
nexbench/__init__.py,sha256=axe3kL9ng3rY3nBAOrsSzICfnUF-U5Brg9HADibrV0c,99
|
|
2
|
+
nexbench/cli.py,sha256=pGR4-CSckORpLzsng5I8ldYRWbD3DVkT7mGEo5vLRCI,1323
|
|
3
|
+
nexbench/core.py,sha256=0wBMawGNIRi7RG4IsGCtdN8BrB6K_edKlvOKU5KJh_c,1165
|
|
4
|
+
nexbench-0.1.0.dist-info/METADATA,sha256=mzEqukOSRcQROFColG_8lFmsHRKYUKKKxqT3V7zwTrI,329
|
|
5
|
+
nexbench-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
nexbench-0.1.0.dist-info/entry_points.txt,sha256=lRb1QUP65WO7U5P68PJbZaeSX_wMK_KGnekBGLCs2PQ,47
|
|
7
|
+
nexbench-0.1.0.dist-info/top_level.txt,sha256=RoMhtc8M1Q-dEvexm_gxpVROCEmDarCm6JSm-kHFo-k,9
|
|
8
|
+
nexbench-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nexbench
|