steamsift 0.3.2__tar.gz → 0.3.4__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.
- {steamsift-0.3.2/steamsift.egg-info → steamsift-0.3.4}/PKG-INFO +26 -11
- {steamsift-0.3.2 → steamsift-0.3.4}/README.md +25 -10
- {steamsift-0.3.2 → steamsift-0.3.4}/pyproject.toml +1 -1
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/__init__.py +1 -1
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/cli.py +49 -2
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/i18n.py +37 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/recommender.py +35 -2
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/tui/app.py +15 -0
- steamsift-0.3.4/steamsift/updater.py +141 -0
- {steamsift-0.3.2 → steamsift-0.3.4/steamsift.egg-info}/PKG-INFO +26 -11
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift.egg-info/SOURCES.txt +2 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_history.py +19 -0
- steamsift-0.3.4/tests/test_update.py +70 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/LICENSE +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/setup.cfg +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/__main__.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/autodetect.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/calendar.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/config.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/data/regions.json +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/db.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/discover.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/doctor.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/engine.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/itad.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/localsteam.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/net.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/notify/__init__.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/notify/cards.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/notify/channels.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/notify/events.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/notify/runner.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/notify/telegram.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/prefs.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/presentation.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/query.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/region.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/schedule.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/settings_registry.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/steam.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/steamid.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/tui/__init__.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/tui/cover.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/tui/state.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/tui/theme.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/tui/wizard.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift/ui.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift.egg-info/dependency_links.txt +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift.egg-info/entry_points.txt +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift.egg-info/requires.txt +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/steamsift.egg-info/top_level.txt +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_channels.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_config_i18n.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_discover.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_events.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_filters.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_items.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_learning.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_packaging.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_query.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_recommender.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_refresh.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_region.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_schedule.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_smarter.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_steamid_localsteam.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_tui.py +0 -0
- {steamsift-0.3.2 → steamsift-0.3.4}/tests/test_wizard.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: steamsift
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Steam deals, sifted: every discount checked against two years of prices. HOT, GREAT, OK, MEH or NOPE.
|
|
5
5
|
Author: sa1ntsinner
|
|
6
6
|
License-Expression: MIT
|
|
@@ -64,7 +64,7 @@ Dynamic: license-file
|
|
|
64
64
|
</p>
|
|
65
65
|
|
|
66
66
|
sift is a free terminal app for Steam deals. It reads two years of Steam prices for every discount, checks how often
|
|
67
|
-
the game goes on sale,
|
|
67
|
+
the game goes on sale, what it usually costs on sale, whether the base price was just raised and what your Steam
|
|
68
68
|
Family already owns, and gives each deal one word.
|
|
69
69
|
|
|
70
70
|
Most "record lows" on Steam come back every five or six weeks. sift tells those apart from the prices that rarely
|
|
@@ -74,9 +74,9 @@ show up, so you buy the right game at the right moment and skip the rest.
|
|
|
74
74
|
|
|
75
75
|
| | |
|
|
76
76
|
|---|---|
|
|
77
|
-
| **HOT** |
|
|
78
|
-
| **GREAT** | The lowest price in two years, but it comes back
|
|
79
|
-
| **OK** | An ordinary sale price.
|
|
77
|
+
| **HOT** | A rare price on a game players rate: the lowest in two years, new or not seen for four months, well under the usual sale price, at least −40%. The game needs 80%+ positive reviews from 1,000+ players (or 95%+ from 300+). Or a cheaper bundle. Buy now if you want it. |
|
|
78
|
+
| **GREAT** | The lowest price in two years, but it comes back, or the cut is small, or few people have played the game. No hurry. |
|
|
79
|
+
| **OK** | An ordinary sale price. Also any game with mixed reviews (under 70% positive), however cheap. |
|
|
80
80
|
| **MEH** | Its sales are usually 12–30% cheaper. Wait for the next one. |
|
|
81
81
|
| **NOPE** | Its sales are usually 30%+ cheaper, or the base price went up just before the sale. Wait. |
|
|
82
82
|
|
|
@@ -87,6 +87,9 @@ yardstick for waiting is the game's usual sale price over the last year, not its
|
|
|
87
87
|
from a year ago rarely comes back. A big Steam sale a few weeks away is no reason to wait for a game that is on sale
|
|
88
88
|
now: those games cost more during the seasonal sale than before it.
|
|
89
89
|
|
|
90
|
+
The review rules do not apply to your wishlist: you put those games there. They exist because a rare price on an
|
|
91
|
+
unknown or disliked game is not a reason to hurry, and a list of HOT deals should be one you would actually buy.
|
|
92
|
+
|
|
90
93
|
Prices are compared in what you pay, not in percent: $15 at −60% is not a low if the game sold for $5 last spring.
|
|
91
94
|
Wishlist games that are not on sale show **WAIT** with how deep and how often they usually go on sale, and when the
|
|
92
95
|
next sale is due. A game needs a year of price history to be judged by price; sift fetches it a few dozen games per
|
|
@@ -94,16 +97,28 @@ run, so the first runs show more "record · little data".
|
|
|
94
97
|
|
|
95
98
|
## Install
|
|
96
99
|
|
|
97
|
-
**
|
|
98
|
-
`sift-windows-x64.exe`, `sift-macos-arm64` or `sift-linux-x64`. Nothing else to install.
|
|
99
|
-
|
|
100
|
-
**Or with Python 3.11+**
|
|
100
|
+
**Linux and macOS**
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
curl -fsSL https://sa1ntsinner.github.io/sift/install.sh | sh
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Windows** (PowerShell)
|
|
107
|
+
|
|
108
|
+
```powershell
|
|
109
|
+
irm https://sa1ntsinner.github.io/sift/install.ps1 | iex
|
|
105
110
|
```
|
|
106
111
|
|
|
112
|
+
Both put the latest release binary on your PATH (`~/.local/bin`, or `%LOCALAPPDATA%\Programs\sift` on Windows), and
|
|
113
|
+
then you run `sift`. You can also download the file yourself from the
|
|
114
|
+
[latest release](https://github.com/sa1ntsinner/sift/releases/latest).
|
|
115
|
+
|
|
116
|
+
With Python 3.11+: `uv tool install steamsift` (or `pipx install steamsift`). The package is called `steamsift`
|
|
117
|
+
because `sift` was taken on PyPI; the command is still `sift`.
|
|
118
|
+
|
|
119
|
+
**Update** with `sift update` (or `sift --update`): it installs the latest release the same way sift was installed.
|
|
120
|
+
`sift update --check` only tells you whether there is one.
|
|
121
|
+
|
|
107
122
|
## First run
|
|
108
123
|
|
|
109
124
|
`sift` opens a three-minute setup. It can look on your computer for your Steam account and Steam Family (only Steam's
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
23
|
sift is a free terminal app for Steam deals. It reads two years of Steam prices for every discount, checks how often
|
|
24
|
-
the game goes on sale,
|
|
24
|
+
the game goes on sale, what it usually costs on sale, whether the base price was just raised and what your Steam
|
|
25
25
|
Family already owns, and gives each deal one word.
|
|
26
26
|
|
|
27
27
|
Most "record lows" on Steam come back every five or six weeks. sift tells those apart from the prices that rarely
|
|
@@ -31,9 +31,9 @@ show up, so you buy the right game at the right moment and skip the rest.
|
|
|
31
31
|
|
|
32
32
|
| | |
|
|
33
33
|
|---|---|
|
|
34
|
-
| **HOT** |
|
|
35
|
-
| **GREAT** | The lowest price in two years, but it comes back
|
|
36
|
-
| **OK** | An ordinary sale price.
|
|
34
|
+
| **HOT** | A rare price on a game players rate: the lowest in two years, new or not seen for four months, well under the usual sale price, at least −40%. The game needs 80%+ positive reviews from 1,000+ players (or 95%+ from 300+). Or a cheaper bundle. Buy now if you want it. |
|
|
35
|
+
| **GREAT** | The lowest price in two years, but it comes back, or the cut is small, or few people have played the game. No hurry. |
|
|
36
|
+
| **OK** | An ordinary sale price. Also any game with mixed reviews (under 70% positive), however cheap. |
|
|
37
37
|
| **MEH** | Its sales are usually 12–30% cheaper. Wait for the next one. |
|
|
38
38
|
| **NOPE** | Its sales are usually 30%+ cheaper, or the base price went up just before the sale. Wait. |
|
|
39
39
|
|
|
@@ -44,6 +44,9 @@ yardstick for waiting is the game's usual sale price over the last year, not its
|
|
|
44
44
|
from a year ago rarely comes back. A big Steam sale a few weeks away is no reason to wait for a game that is on sale
|
|
45
45
|
now: those games cost more during the seasonal sale than before it.
|
|
46
46
|
|
|
47
|
+
The review rules do not apply to your wishlist: you put those games there. They exist because a rare price on an
|
|
48
|
+
unknown or disliked game is not a reason to hurry, and a list of HOT deals should be one you would actually buy.
|
|
49
|
+
|
|
47
50
|
Prices are compared in what you pay, not in percent: $15 at −60% is not a low if the game sold for $5 last spring.
|
|
48
51
|
Wishlist games that are not on sale show **WAIT** with how deep and how often they usually go on sale, and when the
|
|
49
52
|
next sale is due. A game needs a year of price history to be judged by price; sift fetches it a few dozen games per
|
|
@@ -51,16 +54,28 @@ run, so the first runs show more "record · little data".
|
|
|
51
54
|
|
|
52
55
|
## Install
|
|
53
56
|
|
|
54
|
-
**
|
|
55
|
-
`sift-windows-x64.exe`, `sift-macos-arm64` or `sift-linux-x64`. Nothing else to install.
|
|
56
|
-
|
|
57
|
-
**Or with Python 3.11+**
|
|
57
|
+
**Linux and macOS**
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
curl -fsSL https://sa1ntsinner.github.io/sift/install.sh | sh
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Windows** (PowerShell)
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
irm https://sa1ntsinner.github.io/sift/install.ps1 | iex
|
|
62
67
|
```
|
|
63
68
|
|
|
69
|
+
Both put the latest release binary on your PATH (`~/.local/bin`, or `%LOCALAPPDATA%\Programs\sift` on Windows), and
|
|
70
|
+
then you run `sift`. You can also download the file yourself from the
|
|
71
|
+
[latest release](https://github.com/sa1ntsinner/sift/releases/latest).
|
|
72
|
+
|
|
73
|
+
With Python 3.11+: `uv tool install steamsift` (or `pipx install steamsift`). The package is called `steamsift`
|
|
74
|
+
because `sift` was taken on PyPI; the command is still `sift`.
|
|
75
|
+
|
|
76
|
+
**Update** with `sift update` (or `sift --update`): it installs the latest release the same way sift was installed.
|
|
77
|
+
`sift update --check` only tells you whether there is one.
|
|
78
|
+
|
|
64
79
|
## First run
|
|
65
80
|
|
|
66
81
|
`sift` opens a three-minute setup. It can look on your computer for your Steam account and Steam Family (only Steam's
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "steamsift"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.4"
|
|
8
8
|
description = "Steam deals, sifted: every discount checked against two years of prices. HOT, GREAT, OK, MEH or NOPE."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -383,6 +383,48 @@ def cmd_family(args) -> None:
|
|
|
383
383
|
ui.family(lib, unshared)
|
|
384
384
|
|
|
385
385
|
|
|
386
|
+
def cmd_update(args) -> int:
|
|
387
|
+
"""sift update [--check]: the newest release, installed the way this copy was installed."""
|
|
388
|
+
import subprocess
|
|
389
|
+
|
|
390
|
+
from . import updater
|
|
391
|
+
with _status("sp_update"):
|
|
392
|
+
latest = updater.latest(cached=False)
|
|
393
|
+
if not latest:
|
|
394
|
+
ui.error(t("up_offline"))
|
|
395
|
+
return 1
|
|
396
|
+
how = updater.method()
|
|
397
|
+
if how == "source":
|
|
398
|
+
ui.plain(f" {t('up_source', v=__version__, latest=latest)}", "bold")
|
|
399
|
+
if updater.parse(latest) <= updater.parse(__version__) and how != "source":
|
|
400
|
+
ui.plain(f" ✓ {t('up_latest', v=__version__)}", "green")
|
|
401
|
+
return 0
|
|
402
|
+
if how != "source":
|
|
403
|
+
ui.plain(f" {t('up_found', new=latest, old=__version__)}", "bold")
|
|
404
|
+
if getattr(args, "check", False):
|
|
405
|
+
ui.plain(f" {t('up_hint')}", "grey62")
|
|
406
|
+
return 0
|
|
407
|
+
if how == "binary":
|
|
408
|
+
try:
|
|
409
|
+
with _status("sp_update_download"):
|
|
410
|
+
path = updater.replace_binary(latest)
|
|
411
|
+
except Exception as e: # noqa: BLE001 - network, disk or a broken download: say so, keep the old binary
|
|
412
|
+
ui.error(t("up_failed", err=e))
|
|
413
|
+
return 1
|
|
414
|
+
ui.plain(f" ✓ {t('up_done', v=latest, path=path)}", "green")
|
|
415
|
+
return 0
|
|
416
|
+
cmd = updater.command(how)
|
|
417
|
+
ui.plain(f" {t('up_via', cmd=' '.join(cmd))}", "grey62")
|
|
418
|
+
try:
|
|
419
|
+
code = subprocess.call(cmd)
|
|
420
|
+
except OSError as e:
|
|
421
|
+
ui.error(t("up_failed", err=e))
|
|
422
|
+
return 1
|
|
423
|
+
if code == 0:
|
|
424
|
+
ui.plain(f" ✓ {t('up_done_cmd')}", "green")
|
|
425
|
+
return code
|
|
426
|
+
|
|
427
|
+
|
|
386
428
|
def cmd_doctor(args) -> int:
|
|
387
429
|
from . import doctor
|
|
388
430
|
with _status("sp_doctor"):
|
|
@@ -795,6 +837,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
795
837
|
"rest", nargs=argparse.REMAINDER)
|
|
796
838
|
add("setup", "guided first-time setup")
|
|
797
839
|
add("doctor", "check keys, privacy, region, family, notifications")
|
|
840
|
+
add("update", "update sift to the latest release (--check: only tell)").add_argument(
|
|
841
|
+
"--check", action="store_true", help="only check for a newer version")
|
|
798
842
|
add("dlc", "discounted DLC for games you or your family own")
|
|
799
843
|
add("info", "price, history & match for one game").add_argument("query", nargs="+", help="title or appid")
|
|
800
844
|
add("open", "open result #N from the last list").add_argument("numbers", nargs="+", type=int)
|
|
@@ -831,6 +875,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
831
875
|
|
|
832
876
|
def main(argv: list[str] | None = None) -> int:
|
|
833
877
|
argv = sys.argv[1:] if argv is None else argv
|
|
878
|
+
from .updater import cleanup
|
|
879
|
+
cleanup() # the old binary a Windows update renamed
|
|
880
|
+
argv = ["update" if a == "--update" else a for a in argv] # sift --update = sift update
|
|
834
881
|
if argv[:1] == ["help"]:
|
|
835
882
|
argv = ["--help", *argv[1:]] if len(argv) == 1 else [*argv[1:], "--help"] # sift help [command]
|
|
836
883
|
parser = build_parser()
|
|
@@ -864,7 +911,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
864
911
|
args.min_discount = c.min_discount
|
|
865
912
|
|
|
866
913
|
first_run = not CONFIG_FILE.exists() and args.cmd is None and sys.stdin.isatty() and sys.stdout.isatty()
|
|
867
|
-
no_setup = {"config", "profile", "open", "unhide", "hidden", "setup", "doctor", "targets", "calendar"}
|
|
914
|
+
no_setup = {"config", "profile", "open", "unhide", "hidden", "setup", "doctor", "targets", "calendar", "update"}
|
|
868
915
|
try:
|
|
869
916
|
if first_run and not ready(quiet=True):
|
|
870
917
|
return cmd_setup(args) or 0
|
|
@@ -873,7 +920,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
873
920
|
handler = {"config": cmd_config, "profile": cmd_profile, "open": cmd_open, "unhide": cmd_unhide,
|
|
874
921
|
"hidden": lambda a: ui.hidden_list(prefs.load_hidden()), "setup": cmd_setup,
|
|
875
922
|
"doctor": cmd_doctor, "targets": cmd_targets, "calendar": cmd_calendar,
|
|
876
|
-
"notify": cmd_notify}[args.cmd]
|
|
923
|
+
"notify": cmd_notify, "update": cmd_update}[args.cmd]
|
|
877
924
|
return handler(args) or 0
|
|
878
925
|
interactive = sys.stdin.isatty() and sys.stdout.isatty()
|
|
879
926
|
if args.cmd is None and not (args.dna or args.print or getattr(args, "json", False)) and interactive:
|
|
@@ -725,6 +725,10 @@ EN.update({
|
|
|
725
725
|
"vr_rare_first": "its first discount in two years",
|
|
726
726
|
"vr_returns": "lowest price in 2 years, but a similar one comes back every ~{n} days",
|
|
727
727
|
"vr_near_low": "{n}% above its 2-year low", "vs_near_low": "+{n}% to 2-y low",
|
|
728
|
+
"vr_small_cut": "lowest in 2 years, but only −{n}%: no rush", "vs_small_cut": "low, but only −{n}%",
|
|
729
|
+
"vr_niche": "a rare price, but a little-known game ({n} reviews)", "vs_niche": "rare price · {n} reviews",
|
|
730
|
+
"vr_liked_less": "a rare price, but only {n}% of reviews are positive", "vs_liked_less": "rare price · {n}% liked",
|
|
731
|
+
"vr_mixed": "cheap, but players are mixed about it ({n}% positive)", "vs_mixed": "mixed reviews {n}%",
|
|
728
732
|
# what to do, one line per verdict (backtest 2026-11: after HOT the next sale was 20% dearer on average,
|
|
729
733
|
# after GREAT about the same, after MEH/NOPE 16-17% cheaper)
|
|
730
734
|
"tu_do_hot": "Buy now if you want it: the next sale is usually dearer.",
|
|
@@ -760,6 +764,10 @@ RU.update({
|
|
|
760
764
|
"vr_rare_first": "первая скидка за два года",
|
|
761
765
|
"vr_returns": "минимум за 2 года, но похожая цена бывает каждые ~{n} дн.",
|
|
762
766
|
"vr_near_low": "на {n}% дороже минимума за 2 года", "vs_near_low": "+{n}% к минимуму",
|
|
767
|
+
"vr_small_cut": "минимум за 2 года, но всего −{n}%: спешить некуда", "vs_small_cut": "минимум, но −{n}%",
|
|
768
|
+
"vr_niche": "редкая цена, но игра малоизвестная ({n} отзывов)", "vs_niche": "редкая цена · {n} отз.",
|
|
769
|
+
"vr_liked_less": "редкая цена, но положительных отзывов всего {n}%", "vs_liked_less": "редкая цена · {n}% хвалят",
|
|
770
|
+
"vr_mixed": "дёшево, но отзывы смешанные ({n}% положительных)", "vs_mixed": "смешанные отзывы {n}%",
|
|
763
771
|
"tu_do_hot": "Хочешь её — бери сейчас: на следующей распродаже обычно дороже.",
|
|
764
772
|
"tu_do_great": "Хорошая цена, и она возвращается. Бери, когда будешь играть.",
|
|
765
773
|
"tu_do_ok": "Обычная цена: спешить незачем, ждать тоже.",
|
|
@@ -1000,3 +1008,32 @@ RU.update({
|
|
|
1000
1008
|
"dr_itad_optional": "не задан: необязательно, даёт историю цен для вердиктов ОГОНЬ / КЛАСС / МИМО",
|
|
1001
1009
|
"ev_wish_lowest": "Вишлист: цена ОГОНЬ",
|
|
1002
1010
|
})
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
# --------------------------------------------------------------------------- sift update
|
|
1014
|
+
EN.update({
|
|
1015
|
+
"sp_update": "checking for a new version…", "sp_update_download": "downloading the new version…",
|
|
1016
|
+
"up_offline": "Couldn't reach GitHub to check for a new version.",
|
|
1017
|
+
"up_latest": "sift {v} is the latest version.",
|
|
1018
|
+
"up_found": "sift {new} is out (you have {old}).",
|
|
1019
|
+
"up_hint": "Update with: sift update",
|
|
1020
|
+
"up_source": "This is a source checkout ({v}); the latest release is {latest}. sift update runs git pull.",
|
|
1021
|
+
"up_via": "updating with: {cmd}",
|
|
1022
|
+
"up_done": "Updated to {v} ({path}). Run sift.",
|
|
1023
|
+
"up_done_cmd": "Updated. Run sift.",
|
|
1024
|
+
"up_failed": "Update failed: {err}",
|
|
1025
|
+
"tu_update": "↑ {v}: sift update",
|
|
1026
|
+
})
|
|
1027
|
+
RU.update({
|
|
1028
|
+
"sp_update": "проверяю новую версию…", "sp_update_download": "скачиваю новую версию…",
|
|
1029
|
+
"up_offline": "Не удалось связаться с GitHub, чтобы проверить новую версию.",
|
|
1030
|
+
"up_latest": "sift {v}: это последняя версия.",
|
|
1031
|
+
"up_found": "Вышел sift {new} (у тебя {old}).",
|
|
1032
|
+
"up_hint": "Обновить: sift update",
|
|
1033
|
+
"up_source": "Это копия исходников ({v}); последний релиз {latest}. sift update сделает git pull.",
|
|
1034
|
+
"up_via": "обновляю командой: {cmd}",
|
|
1035
|
+
"up_done": "Обновлено до {v} ({path}). Запусти sift.",
|
|
1036
|
+
"up_done_cmd": "Обновлено. Запусти sift.",
|
|
1037
|
+
"up_failed": "Не удалось обновить: {err}",
|
|
1038
|
+
"tu_update": "↑ {v}: sift update",
|
|
1039
|
+
})
|
|
@@ -265,7 +265,18 @@ def verdict(cut: int, hist: History | None, bundle=None,
|
|
|
265
265
|
if hist.fake_discount(cut):
|
|
266
266
|
return Verdict("nope", "fake", hist.raised_days)
|
|
267
267
|
if hist.by_price():
|
|
268
|
-
|
|
268
|
+
v = _by_price(cut, hist, bundle, price_cents, currency, today)
|
|
269
|
+
else:
|
|
270
|
+
v = _by_percent(cut, hist, bundle, price_cents, currency, today)
|
|
271
|
+
# A rare price with a small cut is no rush: after such a HOT the next sale cost about the same (+1%) and was
|
|
272
|
+
# cheaper in a quarter of cases (backtest 2026-11, against +25% dearer after a HOT at −70% or more).
|
|
273
|
+
if v.kind == "hot" and v.reason != "bundle" and cut < HOT_MIN_CUT:
|
|
274
|
+
return Verdict("great", "small_cut", cut)
|
|
275
|
+
return v
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def _by_percent(cut: int, hist: History, bundle, price_cents: int, currency: str, today: dt.date | None) -> Verdict:
|
|
279
|
+
"""Without a year of US prices: the older rules on discount percentages."""
|
|
269
280
|
if hist.is_atl(cut):
|
|
270
281
|
if hist.tier == "frequent": # a record price that comes back every few weeks is no reason to hurry
|
|
271
282
|
return Verdict("great", "returns", hist.gap_days or round(730 / max(1, hist.sales_2y)))
|
|
@@ -333,6 +344,27 @@ def _by_price(cut: int, hist: History, bundle, price_cents: int, currency: str,
|
|
|
333
344
|
|
|
334
345
|
|
|
335
346
|
RARE_DAYS = 120 # a 2-year-low price not seen for this long counts as rare (see _by_price)
|
|
347
|
+
HOT_MIN_CUT = 40 # HOT needs at least this discount (see verdict)
|
|
348
|
+
|
|
349
|
+
# HOT is for games people rate: a rare price on a game few have played, or one players are lukewarm about, is
|
|
350
|
+
# GREAT at most; a game with mixed reviews is OK however cheap. Wishlist games are exempt: you chose them.
|
|
351
|
+
GOOD_PCT, GOOD_REVIEWS = 80, 1000 # Steam "Very Positive" with a real audience
|
|
352
|
+
GEM_PCT, GEM_REVIEWS = 95, 300 # or "Overwhelmingly Positive" with a smaller one
|
|
353
|
+
MIXED_PCT = 70 # under this Steam calls the reviews Mixed
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def by_players(v: Verdict, item: Item, wish: bool = False) -> Verdict:
|
|
357
|
+
"""The price verdict, held back for games players do not rate (reviews unknown: unchanged)."""
|
|
358
|
+
pct, n = item.review_pct, item.review_count
|
|
359
|
+
if wish or v.kind not in ("hot", "great") or pct is None or n < 10:
|
|
360
|
+
return v
|
|
361
|
+
if pct < MIXED_PCT:
|
|
362
|
+
return Verdict("ok", "mixed", pct)
|
|
363
|
+
if v.kind == "hot" and pct < GOOD_PCT:
|
|
364
|
+
return Verdict("great", "liked_less", pct)
|
|
365
|
+
if v.kind == "hot" and not (n >= GOOD_REVIEWS or (pct >= GEM_PCT and n >= GEM_REVIEWS)):
|
|
366
|
+
return Verdict("great", "niche", n)
|
|
367
|
+
return v
|
|
336
368
|
STEP = 0.7 # a new low above this share of the usual sale price is a step down, not a rare price
|
|
337
369
|
|
|
338
370
|
|
|
@@ -403,7 +435,8 @@ class Rec:
|
|
|
403
435
|
currency = {"CN": "CNY", "JP": "JPY"}.get(country.upper(), currency)
|
|
404
436
|
d = _depth(self.item.cut, self.hist)
|
|
405
437
|
rarity = self.hist.rarity(self.item.cut) if self.hist else 0.4
|
|
406
|
-
self.verdict = verdict(self.item.cut, self.hist, self.extras.get("bundle3p"), self.item.final_cents,
|
|
438
|
+
self.verdict = by_players(verdict(self.item.cut, self.hist, self.extras.get("bundle3p"), self.item.final_cents,
|
|
439
|
+
currency), self.item, self.is_wish)
|
|
407
440
|
bundle = self.extras.get("bundle3p")
|
|
408
441
|
bundle_value = float(bool(self.item.bundle_discount > 0 or self.item.complete_the_set
|
|
409
442
|
or self.item.included_games > 1 or
|
|
@@ -1005,6 +1005,19 @@ class SiftApp(App):
|
|
|
1005
1005
|
self.load(refresh=refresh_requested())
|
|
1006
1006
|
self.set_interval(60, self._refresh_if_due)
|
|
1007
1007
|
self.set_interval(5, self.checkpoint)
|
|
1008
|
+
self.check_update()
|
|
1009
|
+
|
|
1010
|
+
@work(thread=True, group="update", exclusive=True)
|
|
1011
|
+
def check_update(self) -> None:
|
|
1012
|
+
"""Once a day: is there a newer release? Shown quietly in the header, never in the way."""
|
|
1013
|
+
from ..updater import newer
|
|
1014
|
+
try:
|
|
1015
|
+
version = newer()
|
|
1016
|
+
except Exception: # noqa: BLE001 - offline or GitHub down: no hint, nothing else changes
|
|
1017
|
+
return
|
|
1018
|
+
if version:
|
|
1019
|
+
self.update_to = version
|
|
1020
|
+
self.call_from_thread(self._header)
|
|
1008
1021
|
|
|
1009
1022
|
# ---------------------------------------------------------------- loading
|
|
1010
1023
|
|
|
@@ -1173,6 +1186,8 @@ class SiftApp(App):
|
|
|
1173
1186
|
line.stylize(Style(meta={"@click": f"app.go_tab('{tab}')"}), start, len(line))
|
|
1174
1187
|
line.append(" " if self.screen.has_class("narrow") else " ")
|
|
1175
1188
|
right = Text()
|
|
1189
|
+
if getattr(self, "update_to", ""):
|
|
1190
|
+
right.append(t("tu_update", v=self.update_to) + " ", style=f"bold {ACCENT}")
|
|
1176
1191
|
if self.tab in WORTH_TABS and self.data is not None:
|
|
1177
1192
|
mode = t("tu_everything") if self.everything else t("tu_worth", n=num(self._all.get(self.tab, 0)))
|
|
1178
1193
|
if self.screen.has_class("narrow"):
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"""`sift update`: find out how sift was installed and update it the same way.
|
|
2
|
+
|
|
3
|
+
binary the file from install.sh / install.ps1 or a GitHub release → download the new one and swap it in
|
|
4
|
+
uv `uv tool install steamsift` → uv tool upgrade steamsift
|
|
5
|
+
pipx `pipx install steamsift` → pipx upgrade steamsift
|
|
6
|
+
pip `pip install steamsift` → python -m pip install --upgrade steamsift
|
|
7
|
+
source a git checkout (pip install -e .) → git pull --ff-only
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import platform
|
|
13
|
+
import shutil
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
from . import __version__
|
|
19
|
+
from .db import DAY, Cache
|
|
20
|
+
|
|
21
|
+
REPO = "sa1ntsinner/sift"
|
|
22
|
+
PACKAGE = "steamsift"
|
|
23
|
+
_latest_cache = Cache("latest_version", volatile=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def parse(v: str) -> tuple[int, ...]:
|
|
27
|
+
"""'v0.3.10' → (0, 3, 10); anything odd sorts as oldest."""
|
|
28
|
+
try:
|
|
29
|
+
return tuple(int(x) for x in v.strip().lstrip("v").split("."))
|
|
30
|
+
except ValueError:
|
|
31
|
+
return (0,)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def latest(cached: bool = True) -> str:
|
|
35
|
+
"""The newest released version ('' when GitHub can't be reached). Cached for a day."""
|
|
36
|
+
if cached:
|
|
37
|
+
hit = _latest_cache.get("v", DAY)
|
|
38
|
+
if hit:
|
|
39
|
+
return hit
|
|
40
|
+
from .net import request_json
|
|
41
|
+
data = request_json(f"https://api.github.com/repos/{REPO}/releases/latest", timeout=8, retries=1)
|
|
42
|
+
tag = (data or {}).get("tag_name", "") if isinstance(data, dict) else ""
|
|
43
|
+
version = tag.lstrip("v")
|
|
44
|
+
if version:
|
|
45
|
+
_latest_cache.set("v", version)
|
|
46
|
+
return version
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def newer(cached: bool = True) -> str:
|
|
50
|
+
"""The latest version if it is newer than this one, else ''."""
|
|
51
|
+
v = latest(cached)
|
|
52
|
+
return v if v and parse(v) > parse(__version__) else ""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def method() -> str:
|
|
56
|
+
"""binary | uv | pipx | source | pip."""
|
|
57
|
+
if getattr(sys, "frozen", False):
|
|
58
|
+
return "binary"
|
|
59
|
+
root = Path(__file__).resolve().parent.parent
|
|
60
|
+
if (root / ".git").exists() and (root / "pyproject.toml").exists():
|
|
61
|
+
return "source"
|
|
62
|
+
prefix = Path(sys.prefix).as_posix().lower()
|
|
63
|
+
if "/uv/tools/" in prefix or "/uv/tool/" in prefix:
|
|
64
|
+
return "uv"
|
|
65
|
+
if "/pipx/venvs/" in prefix:
|
|
66
|
+
return "pipx"
|
|
67
|
+
return "pip"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def asset_name() -> str:
|
|
71
|
+
machine = platform.machine().lower()
|
|
72
|
+
if sys.platform == "win32":
|
|
73
|
+
return "sift-windows-x64.exe"
|
|
74
|
+
if sys.platform == "darwin" and machine in ("arm64", "aarch64"):
|
|
75
|
+
return "sift-macos-arm64"
|
|
76
|
+
if sys.platform.startswith("linux") and machine in ("x86_64", "amd64"):
|
|
77
|
+
return "sift-linux-x64"
|
|
78
|
+
return ""
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def command(how: str) -> list[str]:
|
|
82
|
+
"""The command that updates a non-binary install."""
|
|
83
|
+
if how == "uv":
|
|
84
|
+
return ["uv", "tool", "upgrade", PACKAGE] if shutil.which("uv") else \
|
|
85
|
+
[sys.executable, "-m", "pip", "install", "--upgrade", PACKAGE]
|
|
86
|
+
if how == "pipx":
|
|
87
|
+
return ["pipx", "upgrade", PACKAGE]
|
|
88
|
+
if how == "source":
|
|
89
|
+
return ["git", "-C", str(Path(__file__).resolve().parent.parent), "pull", "--ff-only"]
|
|
90
|
+
return [sys.executable, "-m", "pip", "install", "--upgrade", PACKAGE]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def replace_binary(version: str, exe: Path | None = None, download=None, verify=None) -> Path:
|
|
94
|
+
"""Download the release file for this platform next to the running binary and swap it in.
|
|
95
|
+
|
|
96
|
+
Windows can't overwrite a running .exe but can rename it, so the old one becomes sift.old.exe and is
|
|
97
|
+
removed on the next start (cleanup()). Returns the path of the new binary."""
|
|
98
|
+
exe = Path(exe or sys.executable)
|
|
99
|
+
name = asset_name()
|
|
100
|
+
if not name:
|
|
101
|
+
raise RuntimeError("no release file for this platform")
|
|
102
|
+
url = f"https://github.com/{REPO}/releases/download/v{version}/{name}"
|
|
103
|
+
part = exe.with_name(exe.name + ".part")
|
|
104
|
+
(download or _download)(url, part)
|
|
105
|
+
if os.name != "nt":
|
|
106
|
+
part.chmod(0o755)
|
|
107
|
+
problem = (verify or _starts)(part, version)
|
|
108
|
+
if problem:
|
|
109
|
+
part.unlink(missing_ok=True)
|
|
110
|
+
raise RuntimeError(f"the downloaded file did not start: {problem}")
|
|
111
|
+
if os.name == "nt":
|
|
112
|
+
old = exe.with_name(exe.stem + ".old" + exe.suffix)
|
|
113
|
+
old.unlink(missing_ok=True)
|
|
114
|
+
exe.replace(old)
|
|
115
|
+
part.replace(exe)
|
|
116
|
+
return exe
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _starts(path: Path, version: str) -> str:
|
|
120
|
+
"""'' when `path --version` prints the expected version, else what went wrong."""
|
|
121
|
+
check = subprocess.run([str(path), "--version"], capture_output=True, text=True, timeout=60)
|
|
122
|
+
return "" if check.returncode == 0 and version in check.stdout else (check.stdout or check.stderr).strip() or "?"
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _download(url: str, dest: Path) -> None:
|
|
126
|
+
from .net import SESSION
|
|
127
|
+
with SESSION.get(url, stream=True, timeout=60) as r:
|
|
128
|
+
r.raise_for_status()
|
|
129
|
+
with open(dest, "wb") as f:
|
|
130
|
+
for chunk in r.iter_content(1 << 16):
|
|
131
|
+
f.write(chunk)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def cleanup() -> None:
|
|
135
|
+
"""Remove the previous binary a Windows update left behind."""
|
|
136
|
+
if getattr(sys, "frozen", False) and os.name == "nt":
|
|
137
|
+
exe = Path(sys.executable)
|
|
138
|
+
try:
|
|
139
|
+
exe.with_name(exe.stem + ".old" + exe.suffix).unlink(missing_ok=True)
|
|
140
|
+
except OSError:
|
|
141
|
+
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: steamsift
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Steam deals, sifted: every discount checked against two years of prices. HOT, GREAT, OK, MEH or NOPE.
|
|
5
5
|
Author: sa1ntsinner
|
|
6
6
|
License-Expression: MIT
|
|
@@ -64,7 +64,7 @@ Dynamic: license-file
|
|
|
64
64
|
</p>
|
|
65
65
|
|
|
66
66
|
sift is a free terminal app for Steam deals. It reads two years of Steam prices for every discount, checks how often
|
|
67
|
-
the game goes on sale,
|
|
67
|
+
the game goes on sale, what it usually costs on sale, whether the base price was just raised and what your Steam
|
|
68
68
|
Family already owns, and gives each deal one word.
|
|
69
69
|
|
|
70
70
|
Most "record lows" on Steam come back every five or six weeks. sift tells those apart from the prices that rarely
|
|
@@ -74,9 +74,9 @@ show up, so you buy the right game at the right moment and skip the rest.
|
|
|
74
74
|
|
|
75
75
|
| | |
|
|
76
76
|
|---|---|
|
|
77
|
-
| **HOT** |
|
|
78
|
-
| **GREAT** | The lowest price in two years, but it comes back
|
|
79
|
-
| **OK** | An ordinary sale price.
|
|
77
|
+
| **HOT** | A rare price on a game players rate: the lowest in two years, new or not seen for four months, well under the usual sale price, at least −40%. The game needs 80%+ positive reviews from 1,000+ players (or 95%+ from 300+). Or a cheaper bundle. Buy now if you want it. |
|
|
78
|
+
| **GREAT** | The lowest price in two years, but it comes back, or the cut is small, or few people have played the game. No hurry. |
|
|
79
|
+
| **OK** | An ordinary sale price. Also any game with mixed reviews (under 70% positive), however cheap. |
|
|
80
80
|
| **MEH** | Its sales are usually 12–30% cheaper. Wait for the next one. |
|
|
81
81
|
| **NOPE** | Its sales are usually 30%+ cheaper, or the base price went up just before the sale. Wait. |
|
|
82
82
|
|
|
@@ -87,6 +87,9 @@ yardstick for waiting is the game's usual sale price over the last year, not its
|
|
|
87
87
|
from a year ago rarely comes back. A big Steam sale a few weeks away is no reason to wait for a game that is on sale
|
|
88
88
|
now: those games cost more during the seasonal sale than before it.
|
|
89
89
|
|
|
90
|
+
The review rules do not apply to your wishlist: you put those games there. They exist because a rare price on an
|
|
91
|
+
unknown or disliked game is not a reason to hurry, and a list of HOT deals should be one you would actually buy.
|
|
92
|
+
|
|
90
93
|
Prices are compared in what you pay, not in percent: $15 at −60% is not a low if the game sold for $5 last spring.
|
|
91
94
|
Wishlist games that are not on sale show **WAIT** with how deep and how often they usually go on sale, and when the
|
|
92
95
|
next sale is due. A game needs a year of price history to be judged by price; sift fetches it a few dozen games per
|
|
@@ -94,16 +97,28 @@ run, so the first runs show more "record · little data".
|
|
|
94
97
|
|
|
95
98
|
## Install
|
|
96
99
|
|
|
97
|
-
**
|
|
98
|
-
`sift-windows-x64.exe`, `sift-macos-arm64` or `sift-linux-x64`. Nothing else to install.
|
|
99
|
-
|
|
100
|
-
**Or with Python 3.11+**
|
|
100
|
+
**Linux and macOS**
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
curl -fsSL https://sa1ntsinner.github.io/sift/install.sh | sh
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Windows** (PowerShell)
|
|
107
|
+
|
|
108
|
+
```powershell
|
|
109
|
+
irm https://sa1ntsinner.github.io/sift/install.ps1 | iex
|
|
105
110
|
```
|
|
106
111
|
|
|
112
|
+
Both put the latest release binary on your PATH (`~/.local/bin`, or `%LOCALAPPDATA%\Programs\sift` on Windows), and
|
|
113
|
+
then you run `sift`. You can also download the file yourself from the
|
|
114
|
+
[latest release](https://github.com/sa1ntsinner/sift/releases/latest).
|
|
115
|
+
|
|
116
|
+
With Python 3.11+: `uv tool install steamsift` (or `pipx install steamsift`). The package is called `steamsift`
|
|
117
|
+
because `sift` was taken on PyPI; the command is still `sift`.
|
|
118
|
+
|
|
119
|
+
**Update** with `sift update` (or `sift --update`): it installs the latest release the same way sift was installed.
|
|
120
|
+
`sift update --check` only tells you whether there is one.
|
|
121
|
+
|
|
107
122
|
## First run
|
|
108
123
|
|
|
109
124
|
`sift` opens a three-minute setup. It can look on your computer for your Steam account and Steam Family (only Steam's
|
|
@@ -25,6 +25,7 @@ steamsift/settings_registry.py
|
|
|
25
25
|
steamsift/steam.py
|
|
26
26
|
steamsift/steamid.py
|
|
27
27
|
steamsift/ui.py
|
|
28
|
+
steamsift/updater.py
|
|
28
29
|
steamsift.egg-info/PKG-INFO
|
|
29
30
|
steamsift.egg-info/SOURCES.txt
|
|
30
31
|
steamsift.egg-info/dependency_links.txt
|
|
@@ -61,4 +62,5 @@ tests/test_schedule.py
|
|
|
61
62
|
tests/test_smarter.py
|
|
62
63
|
tests/test_steamid_localsteam.py
|
|
63
64
|
tests/test_tui.py
|
|
65
|
+
tests/test_update.py
|
|
64
66
|
tests/test_wizard.py
|
|
@@ -455,3 +455,22 @@ def test_a_price_that_creeps_down_every_month_is_no_rush():
|
|
|
455
455
|
h = parse_history(log, TODAY)
|
|
456
456
|
assert verdict(73, h, today=TODAY) == Verdict("great", "returns", 30)
|
|
457
457
|
assert verdict(85, h, today=TODAY).kind == "hot" # $1.50 vs $2.80: a different price
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def test_hot_needs_a_real_cut_and_a_game_players_rate():
|
|
461
|
+
from steamsift.recommender import by_players
|
|
462
|
+
from steamsift.steam import Item
|
|
463
|
+
h = parse_history(sale_runs((300, 10, 50), (100, 10, 50)), TODAY)
|
|
464
|
+
assert verdict(30, History(30, sales_2y=3, gap_days=200, covered_days=730), today=TODAY) \
|
|
465
|
+
== Verdict("great", "small_cut", 30) # a record at −30%: no rush
|
|
466
|
+
hot = verdict(80, h, today=TODAY)
|
|
467
|
+
assert hot.kind == "hot"
|
|
468
|
+
game = lambda pct, n: Item(1, "Game", review_pct=pct, review_count=n)
|
|
469
|
+
assert by_players(hot, game(91, 5000)) == hot # rated and played
|
|
470
|
+
assert by_players(hot, game(97, 400)) == hot # a small gem
|
|
471
|
+
assert by_players(hot, game(91, 150)) == Verdict("great", "niche", 150) # few have played it
|
|
472
|
+
assert by_players(hot, game(75, 9000)) == Verdict("great", "liked_less", 75)
|
|
473
|
+
assert by_players(hot, game(60, 9000)) == Verdict("ok", "mixed", 60) # mixed: OK however cheap
|
|
474
|
+
assert by_players(Verdict("great", "returns", 30), game(55, 900)) == Verdict("ok", "mixed", 55)
|
|
475
|
+
assert by_players(hot, game(60, 9000), wish=True) == hot # your wishlist: your call
|
|
476
|
+
assert by_players(hot, game(None, 0)) == hot # reviews unknown: unchanged
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""sift update: version compare, how sift was installed, the command for each, the binary swap."""
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from steamsift import updater
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_versions_compare_as_numbers():
|
|
10
|
+
assert updater.parse("v0.3.10") > updater.parse("0.3.9") > updater.parse("0.3")
|
|
11
|
+
assert updater.parse("garbage") == (0,)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_newer_uses_the_cached_latest(monkeypatch):
|
|
15
|
+
monkeypatch.setattr(updater, "__version__", "0.3.3")
|
|
16
|
+
monkeypatch.setattr(updater, "latest", lambda cached=True: "0.3.4")
|
|
17
|
+
assert updater.newer() == "0.3.4"
|
|
18
|
+
monkeypatch.setattr(updater, "latest", lambda cached=True: "0.3.3")
|
|
19
|
+
assert updater.newer() == ""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.parametrize("prefix,expected", [
|
|
23
|
+
("C:/Users/x/AppData/Roaming/uv/tools/steamsift", "uv"),
|
|
24
|
+
("/home/x/.local/share/uv/tools/steamsift", "uv"),
|
|
25
|
+
("/home/x/.local/share/pipx/venvs/steamsift", "pipx"),
|
|
26
|
+
("/usr/lib/python3.12", "pip"),
|
|
27
|
+
])
|
|
28
|
+
def test_install_method_from_prefix(monkeypatch, tmp_path, prefix, expected):
|
|
29
|
+
monkeypatch.setattr(updater, "__file__", str(tmp_path / "steamsift" / "updater.py")) # no .git next to it
|
|
30
|
+
monkeypatch.setattr(sys, "prefix", prefix)
|
|
31
|
+
assert updater.method() == expected
|
|
32
|
+
cmd = updater.command(expected)
|
|
33
|
+
assert "steamsift" in cmd
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_frozen_binary_and_source_checkout(monkeypatch, tmp_path):
|
|
37
|
+
monkeypatch.setattr(sys, "frozen", True, raising=False)
|
|
38
|
+
assert updater.method() == "binary"
|
|
39
|
+
monkeypatch.delattr(sys, "frozen")
|
|
40
|
+
(tmp_path / ".git").mkdir()
|
|
41
|
+
(tmp_path / "pyproject.toml").write_text("")
|
|
42
|
+
monkeypatch.setattr(updater, "__file__", str(tmp_path / "steamsift" / "updater.py"))
|
|
43
|
+
assert updater.method() == "source"
|
|
44
|
+
assert updater.command("source")[-2:] == ["pull", "--ff-only"]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_binary_swap_keeps_the_old_file_when_the_download_is_broken(tmp_path):
|
|
48
|
+
exe = tmp_path / ("sift.exe" if sys.platform == "win32" else "sift")
|
|
49
|
+
exe.write_text("old")
|
|
50
|
+
urls = []
|
|
51
|
+
|
|
52
|
+
def download(url, dest):
|
|
53
|
+
urls.append(url)
|
|
54
|
+
dest.write_text("new")
|
|
55
|
+
|
|
56
|
+
with pytest.raises(RuntimeError):
|
|
57
|
+
updater.replace_binary("9.9.9", exe, download, verify=lambda p, v: "crashed")
|
|
58
|
+
assert exe.read_text() == "old" and not list(tmp_path.glob("*.part"))
|
|
59
|
+
updater.replace_binary("9.9.9", exe, download, verify=lambda p, v: "")
|
|
60
|
+
assert exe.read_text() == "new" and urls[-1].endswith("/v9.9.9/" + updater.asset_name())
|
|
61
|
+
if sys.platform == "win32":
|
|
62
|
+
assert (tmp_path / "sift.old.exe").read_text() == "old" # removed on the next start
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_update_flag_is_the_update_command(monkeypatch):
|
|
66
|
+
from steamsift import cli
|
|
67
|
+
seen = []
|
|
68
|
+
monkeypatch.setattr(cli, "cmd_update", lambda args: seen.append(args.check) or 0)
|
|
69
|
+
assert cli.main(["--update"]) == 0 and cli.main(["update", "--check"]) == 0
|
|
70
|
+
assert seen == [False, True]
|
|
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
|
|
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
|