slab-cli 0.29.1__tar.gz → 0.30.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.
- {slab_cli-0.29.1 → slab_cli-0.30.1}/PKG-INFO +2 -2
- {slab_cli-0.29.1 → slab_cli-0.30.1}/pyproject.toml +2 -2
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/breaks.py +20 -6
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/display.py +31 -19
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/prompts.py +2 -1
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/theme.py +8 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/README.md +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/__init__.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/banner.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/browse.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/client.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/__init__.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/catalog.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/collection.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/custom_sets.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/export.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/lots.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/pricing.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/registry.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/setup.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/commands/update.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/config.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/context.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/flags.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/help.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/main.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/nav.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/paging.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/picker.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/platforms/__init__.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/platforms/base.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/platforms/posix.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/platforms/windows.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/src/slab_cli/sources.py +0 -0
- {slab_cli-0.29.1 → slab_cli-0.30.1}/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.30.1
|
|
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.61.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.30.1"
|
|
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.61.0", # sales carry no marketplace
|
|
16
16
|
"httpx>=0.27",
|
|
17
17
|
"rich>=13.0",
|
|
18
18
|
"InquirerPy>=0.3",
|
|
@@ -13,6 +13,7 @@ from ..display import browse_breaks, console, render_break_pulls
|
|
|
13
13
|
from ..prompts import (
|
|
14
14
|
ask_date,
|
|
15
15
|
ask_decimal,
|
|
16
|
+
ask_int_optional,
|
|
16
17
|
ask_text,
|
|
17
18
|
confirm,
|
|
18
19
|
select_break,
|
|
@@ -20,6 +21,7 @@ from ..prompts import (
|
|
|
20
21
|
select_search_set,
|
|
21
22
|
)
|
|
22
23
|
from ..sources import pick_source
|
|
24
|
+
from ..theme import break_format
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
def pick_or_create_break(client: SlabClient, collector: str) -> BreakOut | None:
|
|
@@ -65,8 +67,10 @@ def create_break_interactive(client: SlabClient, collector: str) -> BreakOut | N
|
|
|
65
67
|
except Exception:
|
|
66
68
|
formats = []
|
|
67
69
|
break_type = select_break_type(formats)
|
|
70
|
+
# Two blasters ripped into one pile are one break: say how many, and pay for all of them below.
|
|
71
|
+
quantity = _ask_quantity()
|
|
68
72
|
break_date = ask_date("When did you open it?")
|
|
69
|
-
total_cost = ask_decimal("Total cost:")
|
|
73
|
+
total_cost = ask_decimal("Total cost (all of them):" if quantity > 1 else "Total cost:")
|
|
70
74
|
# Offer the collector's previously-used sources for arrow-key reuse (falls back to a plain
|
|
71
75
|
# text prompt on the first break, when there's nothing to reuse yet).
|
|
72
76
|
source = pick_source(client, collector)
|
|
@@ -76,19 +80,29 @@ def create_break_interactive(client: SlabClient, collector: str) -> BreakOut | N
|
|
|
76
80
|
BreakCreate(
|
|
77
81
|
set_uuid=set_choice.uuid,
|
|
78
82
|
break_type=break_type,
|
|
83
|
+
quantity=quantity,
|
|
79
84
|
break_date=break_date,
|
|
80
85
|
total_cost=total_cost,
|
|
81
86
|
source=source,
|
|
82
87
|
),
|
|
83
88
|
)
|
|
84
|
-
|
|
85
|
-
console.print(
|
|
86
|
-
|
|
87
|
-
"across them — so every card carries what it actually cost you (real profit/loss later).[/dim]"
|
|
88
|
-
)
|
|
89
|
+
per_unit = f" (${brk.cost_per_unit:.2f} each)" if brk.quantity > 1 and brk.cost_per_unit else ""
|
|
90
|
+
console.print(f"[green]Break created:[/green] {brk.break_date} · {brk.set_name} · "
|
|
91
|
+
f"{break_format(brk)} — ${brk.total_cost:.2f}{per_unit}")
|
|
89
92
|
return brk
|
|
90
93
|
|
|
91
94
|
|
|
95
|
+
def _ask_quantity() -> int:
|
|
96
|
+
"""How many of the format were opened together; Enter = 1."""
|
|
97
|
+
while True:
|
|
98
|
+
n = ask_int_optional("How many? (enter for 1)")
|
|
99
|
+
if n is None:
|
|
100
|
+
return 1
|
|
101
|
+
if 1 <= n <= 999:
|
|
102
|
+
return n
|
|
103
|
+
console.print("[yellow] Enter a count from 1 to 999.[/yellow]")
|
|
104
|
+
|
|
105
|
+
|
|
92
106
|
def cmd_break_list(args: list[str]) -> None:
|
|
93
107
|
"""`slab break list` — your breaks as a scrollable list; Enter drills into what one
|
|
94
108
|
delivered (value vs cost, the top pulls, the rarest pulls), Esc climbs back, q leaves the
|
|
@@ -23,7 +23,7 @@ from slab_schemas.glossary import MetricInfo
|
|
|
23
23
|
from slab_schemas.grading_desk import CollectionGradingDesk, GradingDesk
|
|
24
24
|
from slab_schemas.enums import BreakEvenRegion, Grade, LiquidityLabel, SealedFormat
|
|
25
25
|
from slab_schemas.liquidity import Liquidity
|
|
26
|
-
from slab_schemas.metrics import momentum_label, trend_label
|
|
26
|
+
from slab_schemas.metrics import momentum_label, trend_label, velocity_ratio
|
|
27
27
|
from slab_schemas.pricing import CardComps, CardMarket, PortfolioSummary, SetTopCards
|
|
28
28
|
from slab_schemas.sealed import SealedPriceHistory, SealedProductOut
|
|
29
29
|
from slab_schemas.serials import CardSerials
|
|
@@ -32,6 +32,7 @@ from slab_schemas.timeseries import CardPriceHistory
|
|
|
32
32
|
from .browse import Page, browse
|
|
33
33
|
from .theme import (
|
|
34
34
|
bar,
|
|
35
|
+
break_format,
|
|
35
36
|
console,
|
|
36
37
|
heading,
|
|
37
38
|
kv_grid,
|
|
@@ -461,7 +462,7 @@ BREAK_COLUMNS = [
|
|
|
461
462
|
def break_cells(b) -> list[str]:
|
|
462
463
|
"""One break as its BREAK_COLUMNS cells."""
|
|
463
464
|
cpc = money(b.cost_per_card) if b.cost_per_card is not None else "—"
|
|
464
|
-
return [b.set_name or "",
|
|
465
|
+
return [b.set_name or "", break_format(b), money(b.total_cost), str(b.copy_count), cpc,
|
|
465
466
|
str(b.break_date or "—"), b.source or "—", b.uuid[:8]]
|
|
466
467
|
|
|
467
468
|
|
|
@@ -533,7 +534,7 @@ def render_break_pulls(brk, result: CollectionResult) -> None:
|
|
|
533
534
|
console.print()
|
|
534
535
|
t = Text()
|
|
535
536
|
t.append(brk.set_name or "Break", style="slab.value")
|
|
536
|
-
t.append(f" — {brk
|
|
537
|
+
t.append(f" — {break_format(brk)} · {brk.break_date or '—'}"
|
|
537
538
|
+ (f" · {brk.source}" if brk.source else ""), style="slab.dim")
|
|
538
539
|
console.print(t)
|
|
539
540
|
|
|
@@ -776,7 +777,7 @@ def render_dashboard(d: DashboardStats) -> None:
|
|
|
776
777
|
])
|
|
777
778
|
for b in d.break_stats:
|
|
778
779
|
table.add_row(str(b.break_date or "—"), b.set_name or "—",
|
|
779
|
-
|
|
780
|
+
break_format(b),
|
|
780
781
|
money(b.total_cost), str(b.cards), money(b.cost_per_card))
|
|
781
782
|
breaks = titled("Breaks", table)
|
|
782
783
|
|
|
@@ -883,7 +884,7 @@ def _collected_players_table(entries: list[CollectedPlayer]) -> Group | None:
|
|
|
883
884
|
return titled("Most Collected Players", table)
|
|
884
885
|
|
|
885
886
|
|
|
886
|
-
# The hottest-players badges render the label the SERVER computed (`HotPlayer.
|
|
887
|
+
# The hottest-players badges render the label the SERVER computed (`HotPlayer.velocity.label` /
|
|
887
888
|
# `HotPlayer.trend`). The thresholds that turn a ratio into "up" are the API's metric
|
|
888
889
|
# definitions (`slab_schemas.metrics`), not the CLI's to copy: three clients once each carried
|
|
889
890
|
# their own ±2% band and disagreed. When an older server omits the fields, the fallback is the
|
|
@@ -891,18 +892,29 @@ def _collected_players_table(entries: list[CollectedPlayer]) -> Group | None:
|
|
|
891
892
|
# `tests/test_hot_labels.py` asserts no threshold number lives in this module.
|
|
892
893
|
|
|
893
894
|
|
|
894
|
-
def
|
|
895
|
-
"""
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
895
|
+
def _ratio_text(ratio: float | None) -> str | None:
|
|
896
|
+
""""2×", "2.3×", "0.5×", "12×" — the same trimming as the collection app's velocity badge."""
|
|
897
|
+
if ratio is None:
|
|
898
|
+
return None
|
|
899
|
+
digits = 0 if ratio >= 10 else 1 if ratio >= 1 else 2
|
|
900
|
+
text = f"{ratio:.{digits}f}"
|
|
901
|
+
return (text.rstrip("0").rstrip(".") if "." in text else text) + "×"
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
def _hot_velocity(e: HotPlayer) -> str:
|
|
905
|
+
"""Sales velocity, written as everywhere: "2× (2 → 4)" — the served ratio in its served label's
|
|
906
|
+
tone, then the earlier window's count and the newer one's. From an older server with no
|
|
907
|
+
velocity block: the 30-day counts, with the registry's own label and ratio."""
|
|
908
|
+
v = e.velocity
|
|
909
|
+
if v is None:
|
|
910
|
+
sales, prior = e.observed.sales, e.observed_prior.sales
|
|
911
|
+
label, ratio = e.momentum or momentum_label(sales, prior), velocity_ratio(sales, prior)
|
|
912
|
+
else:
|
|
913
|
+
sales, prior, label, ratio = v.sales, v.sales_prior, v.label, v.ratio
|
|
914
|
+
lead = _ratio_text(ratio) or ("new" if label == "new" else None)
|
|
915
|
+
tone = "slab.accent" if label in ("up", "new") else "slab.dim"
|
|
916
|
+
counts = f"[slab.dim]({prior} → {sales})[/]"
|
|
917
|
+
return f"[{tone}]{lead}[/] {counts}" if lead else counts
|
|
906
918
|
|
|
907
919
|
|
|
908
920
|
def _hot_trend(e: HotPlayer) -> str:
|
|
@@ -928,7 +940,7 @@ def _hottest_players_table(entries: list[HotPlayer], seen: MetricInfo | None = N
|
|
|
928
940
|
table = slab_table([
|
|
929
941
|
("Player", {"style": "slab.value"}),
|
|
930
942
|
("Sales seen (30d)", {"justify": "right", "style": "slab.value"}),
|
|
931
|
-
("
|
|
943
|
+
("Velocity", {"justify": "right"}),
|
|
932
944
|
("$ seen", {"justify": "right"}),
|
|
933
945
|
("Cards", {"justify": "right", "style": "slab.dim"}),
|
|
934
946
|
("Prices", {"justify": "right"}),
|
|
@@ -937,7 +949,7 @@ def _hottest_players_table(entries: list[HotPlayer], seen: MetricInfo | None = N
|
|
|
937
949
|
table.add_row(
|
|
938
950
|
e.name,
|
|
939
951
|
str(e.observed.sales),
|
|
940
|
-
|
|
952
|
+
_hot_velocity(e),
|
|
941
953
|
money(e.observed.dollars),
|
|
942
954
|
str(e.observed.cards) if e.observed.cards is not None else "—",
|
|
943
955
|
_hot_trend(e),
|
|
@@ -26,6 +26,7 @@ from slab_schemas.collection import (
|
|
|
26
26
|
)
|
|
27
27
|
from slab_schemas.enums import GRADE_ORDINAL, AcquisitionType, BreakType, Grade
|
|
28
28
|
|
|
29
|
+
from .theme import break_format
|
|
29
30
|
from .theme import console as _console
|
|
30
31
|
|
|
31
32
|
|
|
@@ -64,7 +65,7 @@ def _break_label(b: BreakOut) -> str:
|
|
|
64
65
|
when = b.break_date.isoformat() if b.break_date else "—"
|
|
65
66
|
src = f" · {b.source}" if b.source else ""
|
|
66
67
|
cpc = f" @ ${b.cost_per_card:.2f}/card" if b.cost_per_card else ""
|
|
67
|
-
return (f"{when} · {b.set_name} · {b
|
|
68
|
+
return (f"{when} · {b.set_name} · {break_format(b)} · ${b.total_cost:.2f}{src} · "
|
|
68
69
|
f"{b.copy_count} cards{cpc} [{b.uuid[:8]}]")
|
|
69
70
|
|
|
70
71
|
|
|
@@ -137,6 +137,14 @@ def kv_grid(rows: list[tuple[str, RenderableType]], *, label_style: str = "slab.
|
|
|
137
137
|
|
|
138
138
|
# --- Value formatters ------------------------------------------------------------------------------
|
|
139
139
|
|
|
140
|
+
def break_format(b) -> str:
|
|
141
|
+
"""A break's format with its count — 'Blaster Box', or '2× Blaster Box' when it opened two.
|
|
142
|
+
Takes a BreakOut or a dashboard BreakStat (both carry break_type and quantity)."""
|
|
143
|
+
label = (b.break_type or "").replace("_", " ").title() or "—"
|
|
144
|
+
quantity = getattr(b, "quantity", 1) or 1
|
|
145
|
+
return f"{quantity}× {label}" if quantity > 1 else label
|
|
146
|
+
|
|
147
|
+
|
|
140
148
|
def money(v) -> str:
|
|
141
149
|
"""`$1,234.56`, or an em-dash when absent."""
|
|
142
150
|
return f"${v:,.2f}" if v is not None else "—"
|
|
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
|