tony-cli 0.3.2__tar.gz → 0.3.3__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.
Files changed (29) hide show
  1. {tony_cli-0.3.2/src/tony_cli.egg-info → tony_cli-0.3.3}/PKG-INFO +1 -1
  2. {tony_cli-0.3.2 → tony_cli-0.3.3}/pyproject.toml +1 -1
  3. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/install.py +29 -4
  4. {tony_cli-0.3.2 → tony_cli-0.3.3/src/tony_cli.egg-info}/PKG-INFO +1 -1
  5. {tony_cli-0.3.2 → tony_cli-0.3.3}/LICENSE +0 -0
  6. {tony_cli-0.3.2 → tony_cli-0.3.3}/README.md +0 -0
  7. {tony_cli-0.3.2 → tony_cli-0.3.3}/setup.cfg +0 -0
  8. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/__init__.py +0 -0
  9. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/agent.py +0 -0
  10. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/Favorit-Bold.woff2 +0 -0
  11. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/Favorit-Book.woff2 +0 -0
  12. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/Favorit-Regular.woff2 +0 -0
  13. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/FavoritMono-Medium.woff2 +0 -0
  14. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/FavoritMono-Regular.woff2 +0 -0
  15. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/viewer.css +0 -0
  16. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/viewer.js +0 -0
  17. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/fonts.py +0 -0
  18. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/hosted.py +0 -0
  19. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/layout.py +0 -0
  20. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/page.py +0 -0
  21. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/payload.py +0 -0
  22. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/source/__init__.py +0 -0
  23. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/source/local.py +0 -0
  24. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/uninstall.py +0 -0
  25. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/SOURCES.txt +0 -0
  26. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/dependency_links.txt +0 -0
  27. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/entry_points.txt +0 -0
  28. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/requires.txt +0 -0
  29. {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tony-cli
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Explains a git diff to whoever now owns it — annotated changes, blast radius, and steppable runtime walkthroughs.
5
5
  Author: Fawwaz Abayomi
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tony-cli"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "Explains a git diff to whoever now owns it — annotated changes, blast radius, and steppable runtime walkthroughs."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -7,6 +7,7 @@ the root of the environment tony is actually running from.
7
7
  """
8
8
 
9
9
  import os
10
+ import re
10
11
  import subprocess
11
12
  import sys
12
13
 
@@ -18,7 +19,13 @@ PKG = "tony-cli"
18
19
  # an ambient index setting, so on a machine pointed at an internal mirror an
19
20
  # update would pull whatever that mirror serves under the name `tony-cli`.
20
21
  INDEX = "https://pypi.org/simple"
21
- RELEASES = "https://pypi.org/pypi/tony-cli/json"
22
+
23
+ # The project's page on that same index, asked for as JSON (PEP 691). Not
24
+ # pypi.org/pypi/<name>/json — that one is CDN-cached and runs minutes behind a
25
+ # release, so it will call a version "latest" that an installer has already
26
+ # moved past, and report "already on the latest version" to someone who is not.
27
+ PROJECT = f"{INDEX}/{PKG}/"
28
+ SIMPLE_JSON = "application/vnd.pypi.simple.v1+json"
22
29
 
23
30
 
24
31
  def indexEnv():
@@ -101,21 +108,39 @@ def installedOnDisk():
101
108
  return name[len("tony_cli-"):-len(".dist-info")] or None
102
109
 
103
110
 
111
+ def _release(version):
112
+ """A sortable key for a plain release, or None for anything else.
113
+
114
+ Pre-releases and dev builds sort unpredictably as digit tuples — "1.0.0rc1"
115
+ would read as (1, 0, 0, 1) and outrank 1.0.0 — and `tony update` should not
116
+ move anyone onto one.
117
+ """
118
+ if not re.fullmatch(r"\d+(?:\.\d+)*", version or ""):
119
+ return None
120
+ return tuple(int(n) for n in version.split("."))
121
+
122
+
104
123
  def latestVersion(timeout=10):
105
- """The newest version PyPI serves, or None if it cannot be asked.
124
+ """The newest release the index offers, or None if it cannot be asked.
106
125
 
107
126
  Worth one request: without it there is nothing to check the upgrade
108
127
  against, and every installer exits 0 for "already at latest" — which is
109
128
  indistinguishable from "upgraded" unless you knew the target beforehand.
110
129
  """
111
130
  try:
112
- response = httpx.get(RELEASES, timeout=timeout)
131
+ response = httpx.get(
132
+ PROJECT, timeout=timeout, headers={"Accept": SIMPLE_JSON},
133
+ follow_redirects=True,
134
+ )
113
135
  if response.status_code != 200:
114
136
  return None
115
- return ((response.json() or {}).get("info") or {}).get("version")
137
+ versions = (response.json() or {}).get("versions") or []
116
138
  except Exception:
117
139
  return None
118
140
 
141
+ ranked = [(key, v) for v in versions if (key := _release(v))]
142
+ return max(ranked)[1] if ranked else None
143
+
119
144
 
120
145
  def update(argv=()):
121
146
  """`tony update`. Returns an exit code, prints its own messages."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tony-cli
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Explains a git diff to whoever now owns it — annotated changes, blast radius, and steppable runtime walkthroughs.
5
5
  Author: Fawwaz Abayomi
6
6
  License: MIT License
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes