slab-cli 0.27.1__tar.gz → 0.28.0__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.
- {slab_cli-0.27.1 → slab_cli-0.28.0}/PKG-INFO +2 -2
- {slab_cli-0.27.1 → slab_cli-0.28.0}/pyproject.toml +2 -2
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/client.py +2 -9
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/pricing.py +13 -20
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/registry.py +2 -2
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/display.py +25 -29
- {slab_cli-0.27.1 → slab_cli-0.28.0}/README.md +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/__init__.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/banner.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/browse.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/__init__.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/breaks.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/catalog.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/collection.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/custom_sets.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/export.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/lots.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/setup.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/commands/update.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/config.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/context.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/flags.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/help.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/main.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/nav.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/paging.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/picker.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/platforms/__init__.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/platforms/base.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/platforms/posix.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/platforms/windows.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/prompts.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/sources.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/theme.py +0 -0
- {slab_cli-0.27.1 → slab_cli-0.28.0}/src/slab_cli/updates.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: slab-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.28.0
|
|
4
4
|
Summary: CLI for the slab trading-card API — catalog, collect, and track your cards from the terminal.
|
|
5
5
|
Author: dev_jeb
|
|
6
|
-
Requires-Dist: slab-schemas>=0.
|
|
6
|
+
Requires-Dist: slab-schemas>=0.57.0
|
|
7
7
|
Requires-Dist: httpx>=0.27
|
|
8
8
|
Requires-Dist: rich>=13.0
|
|
9
9
|
Requires-Dist: inquirerpy>=0.3
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "slab-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.28.0"
|
|
4
4
|
description = "CLI for the slab trading-card API — catalog, collect, and track your cards from the terminal."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{name = "dev_jeb"}]
|
|
@@ -12,7 +12,7 @@ dependencies = [
|
|
|
12
12
|
# 0.34 reframes the grading desk from verdicts to break-even readings (BreakEvenRegion,
|
|
13
13
|
# GradingDesk.break_even) — the desk shows data, never tells the user to grade.
|
|
14
14
|
# 0.35 adds Liquidity/LiquidityLabel, which the market view's Sells column renders.
|
|
15
|
-
"slab-schemas>=0.
|
|
15
|
+
"slab-schemas>=0.57.0", # grading desk without a fee
|
|
16
16
|
"httpx>=0.27",
|
|
17
17
|
"rich>=13.0",
|
|
18
18
|
"InquirerPy>=0.3",
|
|
@@ -132,24 +132,17 @@ class SlabClient:
|
|
|
132
132
|
resp = self._request("GET", f"/cards/{card_uuid}/comps", params=params)
|
|
133
133
|
return CardComps.model_validate(resp.json())
|
|
134
134
|
|
|
135
|
-
def get_grading_desk(
|
|
136
|
-
self, card_uuid: str, fee: float | None = None, company: str | None = None
|
|
137
|
-
) -> GradingDesk:
|
|
135
|
+
def get_grading_desk(self, card_uuid: str, company: str | None = None) -> GradingDesk:
|
|
138
136
|
params: dict[str, str] = {}
|
|
139
|
-
if fee is not None:
|
|
140
|
-
params["fee"] = str(fee)
|
|
141
137
|
if company:
|
|
142
138
|
params["company"] = company
|
|
143
139
|
resp = self._request("GET", f"/cards/{card_uuid}/grading-desk", params=params)
|
|
144
140
|
return GradingDesk.model_validate(resp.json())
|
|
145
141
|
|
|
146
142
|
def get_collection_grading_desk(
|
|
147
|
-
self, collector_uuid: str,
|
|
148
|
-
company: str | None = None, limit: int = 50,
|
|
143
|
+
self, collector_uuid: str, company: str | None = None, limit: int = 50,
|
|
149
144
|
) -> CollectionGradingDesk:
|
|
150
145
|
params: dict[str, str] = {"limit": str(limit)}
|
|
151
|
-
if fee is not None:
|
|
152
|
-
params["fee"] = str(fee)
|
|
153
146
|
if company:
|
|
154
147
|
params["company"] = company
|
|
155
148
|
resp = self._request(
|
|
@@ -86,48 +86,41 @@ def cmd_serials(args: list[str]) -> None:
|
|
|
86
86
|
render_serials(ctx.client.get_card_serials(card.uuid))
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
def _split_desk_flags(args: list[str]) -> tuple[list[str],
|
|
90
|
-
"""Pull `--
|
|
91
|
-
|
|
92
|
-
silently pricing off the default."""
|
|
89
|
+
def _split_desk_flags(args: list[str]) -> tuple[list[str], str | None]:
|
|
90
|
+
"""Pull `--company <name>` out of a grading query. Hand-rolled (the shared flag grammar is
|
|
91
|
+
search-specific)."""
|
|
93
92
|
rest: list[str] = []
|
|
94
|
-
fee: float | None = None
|
|
95
93
|
company: str | None = None
|
|
96
94
|
i = 0
|
|
97
95
|
while i < len(args):
|
|
98
96
|
a = args[i]
|
|
99
|
-
if a == "--
|
|
100
|
-
try:
|
|
101
|
-
fee = float(args[i + 1].lstrip("$"))
|
|
102
|
-
except ValueError:
|
|
103
|
-
raise SystemExit(f"--fee expects a number, got {args[i + 1]!r}")
|
|
104
|
-
i += 2
|
|
105
|
-
elif a == "--company" and i + 1 < len(args):
|
|
97
|
+
if a == "--company" and i + 1 < len(args):
|
|
106
98
|
company = args[i + 1]
|
|
107
99
|
i += 2
|
|
108
100
|
else:
|
|
109
101
|
rest.append(a)
|
|
110
102
|
i += 1
|
|
111
|
-
return rest,
|
|
103
|
+
return rest, company
|
|
112
104
|
|
|
113
105
|
|
|
114
106
|
def cmd_grade(args: list[str]) -> None:
|
|
115
107
|
"""The grading math for a card. Same player → set → card flow as `price`, then the grading
|
|
116
|
-
desk: what each grade
|
|
117
|
-
the
|
|
118
|
-
|
|
108
|
+
desk: what each grade is worth over the raw card and where break-even sits — sale prices
|
|
109
|
+
alone, before fees; the data to decide with, the decision is yours. `--company SGC` switches
|
|
110
|
+
grader."""
|
|
111
|
+
args, company = _split_desk_flags(args)
|
|
119
112
|
card = _pick_card(args)
|
|
120
113
|
if card is None:
|
|
121
114
|
return
|
|
122
|
-
render_grading_desk(ctx.client.get_grading_desk(card.uuid,
|
|
115
|
+
render_grading_desk(ctx.client.get_grading_desk(card.uuid, company=company))
|
|
123
116
|
|
|
124
117
|
|
|
125
118
|
def cmd_grade_sweep(args: list[str]) -> None:
|
|
126
119
|
"""The grading math across your raw cards, biggest upside first — where the per-card
|
|
127
|
-
break-even bars become batch odds.
|
|
128
|
-
args,
|
|
120
|
+
break-even bars become batch odds. Sale prices alone, before fees."""
|
|
121
|
+
args, company = _split_desk_flags(args)
|
|
129
122
|
render_collection_grading_desk(
|
|
130
|
-
ctx.client.get_collection_grading_desk(ctx.collector,
|
|
123
|
+
ctx.client.get_collection_grading_desk(ctx.collector, company=company)
|
|
131
124
|
)
|
|
132
125
|
|
|
133
126
|
|
|
@@ -59,7 +59,7 @@ GROUPS: list[Group] = [
|
|
|
59
59
|
Command("search", "Search the catalog (player, set, team…)", catalog.cmd_search, "[query] [flags]"),
|
|
60
60
|
Command("parallels", "Every parallel (the rainbow) of a card", catalog.cmd_rainbow, "<query>"),
|
|
61
61
|
Command("price", "Market price + 7d/30d trend", pricing.cmd_price, "<query>"),
|
|
62
|
-
Command("grade", "The grading math: payoffs per grade + break-even", pricing.cmd_grade, "<query> [--
|
|
62
|
+
Command("grade", "The grading math: payoffs per grade + break-even", pricing.cmd_grade, "<query> [--company NAME]"),
|
|
63
63
|
Command("comps", "Recent raw sales behind the price", pricing.cmd_comps, "<query>"),
|
|
64
64
|
Command("serials", "Which numbered copies have surfaced (sales + collections)", pricing.cmd_serials, "<query>"),
|
|
65
65
|
Command("history", "Price history over time", pricing.cmd_history, "<query>"),
|
|
@@ -81,7 +81,7 @@ GROUPS: list[Group] = [
|
|
|
81
81
|
Command("export", "Export a set to a printable checklist", export.cmd_export),
|
|
82
82
|
Command("dashboard", "Overview: counts, value, composition", collection.cmd_dashboard),
|
|
83
83
|
Command("portfolio", "Portfolio: cost basis vs FMV, by set, top movers", pricing.cmd_portfolio),
|
|
84
|
-
Command("grade", "Grading math for every raw copy, best upside first", pricing.cmd_grade_sweep, "[--
|
|
84
|
+
Command("grade", "Grading math for every raw copy, best upside first", pricing.cmd_grade_sweep, "[--company NAME]"),
|
|
85
85
|
]),
|
|
86
86
|
Group("break", "case / box breaks", [
|
|
87
87
|
Command("list", "Your breaks — pick one to see value vs cost + top pulls", breaks.cmd_break_list),
|
|
@@ -1396,13 +1396,11 @@ def estimate_caption(estimates) -> str:
|
|
|
1396
1396
|
return f"No {names} of this card has sold yet, so {those} estimated from similar cards."
|
|
1397
1397
|
|
|
1398
1398
|
|
|
1399
|
-
def
|
|
1400
|
-
"""
|
|
1401
|
-
Same
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
else f"{pct}% {'below' if e.typical_jump < 0 else 'above'} raw")
|
|
1405
|
-
return f"{e.grade_key.replace('-', ' ')}: {jump}, based on {e.basis_label}."
|
|
1399
|
+
def estimate_lines(e) -> list[str]:
|
|
1400
|
+
"""How an estimate was made, as the API's own plain lines with this card's numbers (an older
|
|
1401
|
+
response without them falls back to the cards it rests on). Same as the site's
|
|
1402
|
+
`estimateLines`."""
|
|
1403
|
+
return list(e.explanation) or [f"Cards like this: {e.basis_label}."]
|
|
1406
1404
|
|
|
1407
1405
|
|
|
1408
1406
|
def _desk_reading_line(d: GradingDesk) -> str:
|
|
@@ -1412,7 +1410,7 @@ def _desk_reading_line(d: GradingDesk) -> str:
|
|
|
1412
1410
|
return (grade_key or "").replace("-", " ")
|
|
1413
1411
|
|
|
1414
1412
|
def outcome(grade_key: str | None) -> str | None:
|
|
1415
|
-
"""`a PSA 10
|
|
1413
|
+
"""`a PSA 10 is $358 over raw` / `a PSA 9 is $122 under` — whole dollars when estimated."""
|
|
1416
1414
|
lane = next((l for l in d.lanes if l.grade_key == grade_key), None)
|
|
1417
1415
|
if lane is None or lane.payoff is None:
|
|
1418
1416
|
return None
|
|
@@ -1422,18 +1420,18 @@ def _desk_reading_line(d: GradingDesk) -> str:
|
|
|
1422
1420
|
else:
|
|
1423
1421
|
n = float(lane.payoff)
|
|
1424
1422
|
amount = money(abs(n))
|
|
1425
|
-
return (f"a {name(grade_key)} [slab.loss]
|
|
1426
|
-
else f"a {name(grade_key)} [slab.gain]
|
|
1423
|
+
return (f"a {name(grade_key)} [slab.loss]is {amount} under raw[/]" if n < 0
|
|
1424
|
+
else f"a {name(grade_key)} [slab.gain]is {amount} over raw[/]")
|
|
1427
1425
|
|
|
1428
1426
|
gem = next((l for l in d.lanes if l.grade_key.startswith(f"{d.grading_company}-")), None)
|
|
1429
1427
|
if d.break_even == BreakEvenRegion.not_enough_data:
|
|
1430
1428
|
return "[slab.dim]No graded sales to compare yet — nobody has sold a graded copy of this card recently.[/]"
|
|
1431
1429
|
if d.break_even == BreakEvenRegion.pays_at_no_grade:
|
|
1432
1430
|
top = outcome(gem.grade_key) if gem else None
|
|
1433
|
-
return "[slab.loss]No grade
|
|
1431
|
+
return "[slab.loss]No grade sells above raw[/]" + (f" — even {top}." if top else ".")
|
|
1434
1432
|
if d.break_even == BreakEvenRegion.pays_at_any_grade:
|
|
1435
1433
|
miss = None if d.miss_grade == "raw value" else outcome(d.miss_grade)
|
|
1436
|
-
return "[slab.gain]Every grade
|
|
1434
|
+
return "[slab.gain]Every grade sells above raw[/]" + (f" — even {miss}." if miss else ".")
|
|
1437
1435
|
head = (f"Grading breaks even at a {d.ten_confidence_needed:.0%} chance of a {name(gem.grade_key)}"
|
|
1438
1436
|
if gem and d.ten_confidence_needed is not None else "Depends on the grade")
|
|
1439
1437
|
parts = [outcome(gem.grade_key) if gem else None,
|
|
@@ -1458,17 +1456,15 @@ def render_grading_desk(d: GradingDesk) -> None:
|
|
|
1458
1456
|
|
|
1459
1457
|
console.print(
|
|
1460
1458
|
f"\n Raw value: [slab.value]{money(d.raw.fair_market_value)}[/] "
|
|
1461
|
-
f"[slab.dim](from {d.raw.sample_size} sales) ·
|
|
1462
|
-
f"
|
|
1463
|
-
+ (" — pass --fee to use your rate" if d.fee_source == "default" else " (your rate)")
|
|
1464
|
-
+ "[/]"
|
|
1459
|
+
f"[slab.dim](from {d.raw.sample_size} sales) · every number below is sale prices "
|
|
1460
|
+
f"alone — subtract what you pay to grade[/]"
|
|
1465
1461
|
)
|
|
1466
1462
|
|
|
1467
1463
|
if d.lanes:
|
|
1468
1464
|
table = slab_table([
|
|
1469
1465
|
("If it grades", {}),
|
|
1470
1466
|
("Sells for", {"justify": "right", "style": "slab.foil"}),
|
|
1471
|
-
("
|
|
1467
|
+
("Over raw", {"justify": "right"}),
|
|
1472
1468
|
("Sales", {"justify": "right", "style": "slab.dim"}),
|
|
1473
1469
|
("Sells", {"style": "slab.dim"}),
|
|
1474
1470
|
])
|
|
@@ -1485,7 +1481,7 @@ def render_grading_desk(d: GradingDesk) -> None:
|
|
|
1485
1481
|
n = f"{l.sample_size}!" if l.low_confidence else str(l.sample_size)
|
|
1486
1482
|
table.add_row(l.grade_key, money(l.fair_market_value), signed_money(l.payoff), n,
|
|
1487
1483
|
_liquidity_text(l.liquidity))
|
|
1488
|
-
console.print(heading("Payoff per Grade", "
|
|
1484
|
+
console.print(heading("Payoff per Grade", "vs staying raw, before fees"))
|
|
1489
1485
|
console.print(table)
|
|
1490
1486
|
if any(l.low_confidence for l in d.lanes):
|
|
1491
1487
|
console.print(" [slab.dim]! = priced off very few sales — an anecdote, "
|
|
@@ -1494,10 +1490,10 @@ def render_grading_desk(d: GradingDesk) -> None:
|
|
|
1494
1490
|
if estimates:
|
|
1495
1491
|
console.print(f" [slab.warn]est.[/] {estimate_caption(estimates)}")
|
|
1496
1492
|
for e in estimates:
|
|
1497
|
-
console.print(f" [slab.
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1493
|
+
console.print(f" [slab.value]{e.grade_key.replace('-', ' ')} ≈ "
|
|
1494
|
+
f"{_whole_dollars(e.fair_market_value)}[/]")
|
|
1495
|
+
for line in estimate_lines(e):
|
|
1496
|
+
console.print(f" [slab.dim]{line}[/]")
|
|
1501
1497
|
if any(l.liquidity for l in d.lanes):
|
|
1502
1498
|
console.print(" [slab.dim]Sells = how often that grade actually trades — a payoff "
|
|
1503
1499
|
"at a grade that sells twice a year is a longer wait than one that "
|
|
@@ -1536,8 +1532,8 @@ def render_collection_grading_desk(sweep: CollectionGradingDesk) -> None:
|
|
|
1536
1532
|
table = slab_table([
|
|
1537
1533
|
("Card", {"no_wrap": False}),
|
|
1538
1534
|
("Raw", {"justify": "right", "style": "slab.dim"}),
|
|
1539
|
-
("Gem
|
|
1540
|
-
("Miss
|
|
1535
|
+
("Gem vs raw", {"justify": "right"}),
|
|
1536
|
+
("Miss vs raw", {"justify": "right"}),
|
|
1541
1537
|
("Break-even", {"justify": "right", "style": "slab.foil"}),
|
|
1542
1538
|
("Qty", {"justify": "right", "style": "slab.dim"}),
|
|
1543
1539
|
])
|
|
@@ -1566,11 +1562,11 @@ def render_collection_grading_desk(sweep: CollectionGradingDesk) -> None:
|
|
|
1566
1562
|
be + thin, str(e.quantity),
|
|
1567
1563
|
)
|
|
1568
1564
|
console.print(table)
|
|
1569
|
-
console.print(
|
|
1570
|
-
|
|
1571
|
-
"
|
|
1572
|
-
"even a miss
|
|
1573
|
-
"corners; slab can't — the call is yours. ! = rests on very few sales.[/]")
|
|
1565
|
+
console.print(" [slab.dim]Sale prices alone — no grading fee is included; subtract what you "
|
|
1566
|
+
"pay. Break-even = the chance of a gem at which grading and staying raw are "
|
|
1567
|
+
"worth the same — below it grading is worth less, above it more; 'any grade' = "
|
|
1568
|
+
"even a miss sells above raw, 'no grade' = even a gem doesn't. You can see each "
|
|
1569
|
+
"card's corners; slab can't — the call is yours. ! = rests on very few sales.[/]")
|
|
1574
1570
|
console.print()
|
|
1575
1571
|
|
|
1576
1572
|
|
|
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
|
|
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
|