primecli 0.5.4__tar.gz → 0.5.5__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 (23) hide show
  1. {primecli-0.5.4 → primecli-0.5.5}/PKG-INFO +1 -1
  2. primecli-0.5.5/primecli/__init__.py +59 -0
  3. {primecli-0.5.4 → primecli-0.5.5}/primecli/arbprime.py +7 -0
  4. {primecli-0.5.4 → primecli-0.5.5}/primecli/degenprime.py +7 -0
  5. {primecli-0.5.4 → primecli-0.5.5}/primecli/deltaprime.py +7 -0
  6. {primecli-0.5.4 → primecli-0.5.5}/primecli.egg-info/PKG-INFO +1 -1
  7. {primecli-0.5.4 → primecli-0.5.5}/pyproject.toml +1 -1
  8. primecli-0.5.4/primecli/__init__.py +0 -8
  9. {primecli-0.5.4 → primecli-0.5.5}/LICENSE +0 -0
  10. {primecli-0.5.4 → primecli-0.5.5}/README.md +0 -0
  11. {primecli-0.5.4 → primecli-0.5.5}/primecli/health_monitor.py +0 -0
  12. {primecli-0.5.4 → primecli-0.5.5}/primecli.egg-info/SOURCES.txt +0 -0
  13. {primecli-0.5.4 → primecli-0.5.5}/primecli.egg-info/dependency_links.txt +0 -0
  14. {primecli-0.5.4 → primecli-0.5.5}/primecli.egg-info/entry_points.txt +0 -0
  15. {primecli-0.5.4 → primecli-0.5.5}/primecli.egg-info/requires.txt +0 -0
  16. {primecli-0.5.4 → primecli-0.5.5}/primecli.egg-info/top_level.txt +0 -0
  17. {primecli-0.5.4 → primecli-0.5.5}/setup.cfg +0 -0
  18. {primecli-0.5.4 → primecli-0.5.5}/tests/test_cross_file_identity.py +0 -0
  19. {primecli-0.5.4 → primecli-0.5.5}/tests/test_gas_pricing.py +0 -0
  20. {primecli-0.5.4 → primecli-0.5.5}/tests/test_health_monitor.py +0 -0
  21. {primecli-0.5.4 → primecli-0.5.5}/tests/test_paraswap_validator.py +0 -0
  22. {primecli-0.5.4 → primecli-0.5.5}/tests/test_redstone_encoding.py +0 -0
  23. {primecli-0.5.4 → primecli-0.5.5}/tests/test_to_wei_units.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: primecli
3
- Version: 0.5.4
3
+ Version: 0.5.5
4
4
  Summary: Agent-friendly CLI tools for the DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base) lending and leverage protocols. Preview-by-default; no Etherscan key required.
5
5
  Author: Mnemosyne-quest contributors
6
6
  License: MIT
@@ -0,0 +1,59 @@
1
+ """primecli - command-line tools for DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base)."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version as _pkg_version
4
+ import json
5
+ import os
6
+ import sys
7
+ import urllib.request
8
+
9
+ try:
10
+ __version__ = _pkg_version("primecli")
11
+ except PackageNotFoundError: # running from source without an install
12
+ __version__ = "0.0.0+unknown"
13
+
14
+ _VERSION_CHECK_URL = "https://pypi.org/pypi/primecli/json"
15
+ _VERSION_TIMEOUT = 3 # seconds
16
+
17
+
18
+ def _parse_version(v: str) -> tuple:
19
+ """Parse 'X.Y.Z' into a sortable tuple. Non-numeric suffixes become -inf."""
20
+ parts = v.split(".")
21
+ nums = []
22
+ for p in parts:
23
+ try:
24
+ nums.append(int(p))
25
+ except ValueError:
26
+ nums.append(-1)
27
+ # Pad to 3 elements
28
+ while len(nums) < 3:
29
+ nums.append(0)
30
+ return tuple(nums[:3])
31
+
32
+
33
+ def check_version(suppress_flag: bool = False) -> None:
34
+ """Print a one-line upgrade hint to stderr when the installed version is behind
35
+ the latest on PyPI. Suppress with the env var PRIMECLI_NO_VERSION_CHECK=1,
36
+ the CLI flag --no-version-check, or pass suppress_flag=True."""
37
+ if suppress_flag or os.environ.get("PRIMECLI_NO_VERSION_CHECK") == "1":
38
+ return
39
+ if "--no-version-check" in sys.argv:
40
+ return
41
+ if __version__ in ("0.0.0+unknown",):
42
+ return
43
+ try:
44
+ req = urllib.request.Request(_VERSION_CHECK_URL)
45
+ with urllib.request.urlopen(req, timeout=_VERSION_TIMEOUT) as resp:
46
+ data = json.loads(resp.read().decode())
47
+ latest = data.get("info", {}).get("version", "")
48
+ if not latest:
49
+ return
50
+ installed = _parse_version(__version__)
51
+ latest_v = _parse_version(latest)
52
+ if installed < latest_v:
53
+ print(
54
+ f"⚠️ primecli {__version__} is outdated. Latest is {latest}. "
55
+ f"Upgrade: pip install --upgrade primecli",
56
+ file=sys.stderr,
57
+ )
58
+ except Exception:
59
+ pass # network failure or parse error → silent
@@ -228,6 +228,12 @@ if _hm is None:
228
228
  _spec.loader.exec_module(_hm)
229
229
  health_monitor = _hm
230
230
 
231
+ # Version check (silent on network failure or old install)
232
+ try:
233
+ from primecli import check_version
234
+ except ImportError:
235
+ def check_version(*a, **kw): pass
236
+
231
237
  # Arbitrum One RPC. Override with ARBPRIME_RPC for a paid Alchemy/Infura endpoint.
232
238
  ARBITRUM_RPC = os.environ.get("ARBPRIME_RPC", "https://arb1.arbitrum.io/rpc")
233
239
  EXPLORER = "https://arbiscan.io" # display/links only — never used for ABI fetch
@@ -5360,6 +5366,7 @@ def cmd_prime_bridge(from_chain: str = "avax", amount: float = None, execute: bo
5360
5366
  print(f" Tx: {src_cfg['explorer']}/{tx_hash.hex()}")
5361
5367
 
5362
5368
  def main():
5369
+ check_version()
5363
5370
  args = sys.argv[1:] if len(sys.argv) > 1 else []
5364
5371
  # Global wallet selector: --as <agent>, stripped before command dispatch.
5365
5372
  global _SELECTED_AGENT, _CLI_KEY
@@ -104,6 +104,12 @@ if _hm is None:
104
104
  _spec.loader.exec_module(_hm)
105
105
  health_monitor = _hm
106
106
 
107
+ # Version check (silent on network failure or old install)
108
+ try:
109
+ from primecli import check_version
110
+ except ImportError:
111
+ def check_version(*a, **kw): pass
112
+
107
113
  # Default Base RPC. mainnet.base.org rate-limits hard (429 within a few calls); the
108
114
  # publicnode endpoint is fronted by a load balancer with much higher anonymous limits
109
115
  # and has been the most reliable free option for this tool's traffic pattern (lots of
@@ -2425,6 +2431,7 @@ def cmd_aerodrome_positions():
2425
2431
  print(" v1 lists tokenIds only. Composition + write paths deferred to v2.")
2426
2432
 
2427
2433
  def main():
2434
+ check_version()
2428
2435
  try:
2429
2436
  _dispatch()
2430
2437
  except RuntimeError as e:
@@ -237,6 +237,12 @@ if _hm is None:
237
237
  _spec.loader.exec_module(_hm)
238
238
  health_monitor = _hm
239
239
 
240
+ # Version check (silent on network failure or old install)
241
+ try:
242
+ from primecli import check_version
243
+ except ImportError:
244
+ def check_version(*a, **kw): pass
245
+
240
246
  AVALANCHE_RPC = os.environ.get("DELTAPRIME_RPC", "https://api.avax.network/ext/bc/C/rpc")
241
247
  EXPLORER = "https://snowtrace.io"
242
248
  CHAIN_ID = 43114
@@ -5145,6 +5151,7 @@ def cmd_defi(as_json: bool = True):
5145
5151
  print(json.dumps(_trim_defi_json(data), indent=2))
5146
5152
 
5147
5153
  def main():
5154
+ check_version()
5148
5155
  args = sys.argv[1:] if len(sys.argv) > 1 else []
5149
5156
  # Global wallet selector: --as <agent>, stripped before command dispatch.
5150
5157
  global _SELECTED_AGENT, _CLI_KEY
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: primecli
3
- Version: 0.5.4
3
+ Version: 0.5.5
4
4
  Summary: Agent-friendly CLI tools for the DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base) lending and leverage protocols. Preview-by-default; no Etherscan key required.
5
5
  Author: Mnemosyne-quest contributors
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "primecli"
7
- version = "0.5.4"
7
+ version = "0.5.5"
8
8
  description = "Agent-friendly CLI tools for the DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base) lending and leverage protocols. Preview-by-default; no Etherscan key required."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,8 +0,0 @@
1
- """primecli - command-line tools for DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base)."""
2
-
3
- from importlib.metadata import PackageNotFoundError, version as _pkg_version
4
-
5
- try:
6
- __version__ = _pkg_version("primecli")
7
- except PackageNotFoundError: # running from source without an install
8
- __version__ = "0.0.0+unknown"
File without changes
File without changes
File without changes