evo-cli 0.36.3__tar.gz → 0.36.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 (157) hide show
  1. {evo_cli-0.36.3 → evo_cli-0.36.5}/PKG-INFO +1 -1
  2. evo_cli-0.36.5/evo_cli/VERSION +1 -0
  3. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/download.py +106 -5
  4. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli.egg-info/PKG-INFO +1 -1
  5. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_download.py +127 -0
  6. evo_cli-0.36.3/evo_cli/VERSION +0 -1
  7. {evo_cli-0.36.3 → evo_cli-0.36.5}/Containerfile +0 -0
  8. {evo_cli-0.36.3 → evo_cli-0.36.5}/HISTORY.md +0 -0
  9. {evo_cli-0.36.3 → evo_cli-0.36.5}/LICENSE +0 -0
  10. {evo_cli-0.36.3 → evo_cli-0.36.5}/MANIFEST.in +0 -0
  11. {evo_cli-0.36.3 → evo_cli-0.36.5}/README.md +0 -0
  12. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/__init__.py +0 -0
  13. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/__main__.py +0 -0
  14. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/base.py +0 -0
  15. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/cli.py +0 -0
  16. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/__init__.py +0 -0
  17. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/agent_toy.py +0 -0
  18. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/claude_code.py +0 -0
  19. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/cloudflare.py +0 -0
  20. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/cred.py +0 -0
  21. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/fix_claude.py +0 -0
  22. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/gdrive.py +0 -0
  23. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/gh.py +0 -0
  24. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/__init__.py +0 -0
  25. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_dag.py +0 -0
  26. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_git.py +0 -0
  27. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_hub.py +0 -0
  28. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_mirror.py +0 -0
  29. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_model.py +0 -0
  30. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_mutate.py +0 -0
  31. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_paths.py +0 -0
  32. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_render.py +0 -0
  33. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/_server.py +0 -0
  34. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/check.py +0 -0
  35. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/clone.py +0 -0
  36. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/edit.py +0 -0
  37. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/pull.py +0 -0
  38. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/serve.py +0 -0
  39. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/show.py +0 -0
  40. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/views.py +0 -0
  41. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/index-Cs7hXRPJ.css +0 -0
  42. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/index-CuNOlaH7.js +0 -0
  43. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  44. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  45. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  46. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  47. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  48. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  49. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  50. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  51. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  52. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  53. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  54. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  55. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/harness/web/index.html +0 -0
  56. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/hwid.py +0 -0
  57. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/hwid_reset.py +0 -0
  58. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/image.py +0 -0
  59. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/localproxy.py +0 -0
  60. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/mcp.py +0 -0
  61. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/miniconda.py +0 -0
  62. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/netcheck.py +0 -0
  63. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/ngrok.py +0 -0
  64. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/opencode.py +0 -0
  65. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/openvpn.py +0 -0
  66. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/plantuml.py +0 -0
  67. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/__init__.py +0 -0
  68. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_dns.py +0 -0
  69. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_dnswatch.py +0 -0
  70. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_dpi.py +0 -0
  71. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_hosts.py +0 -0
  72. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_page.py +0 -0
  73. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_probe.py +0 -0
  74. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/_spoofdpi.py +0 -0
  75. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/check.py +0 -0
  76. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/fix.py +0 -0
  77. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/probe.py +0 -0
  78. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/route/status.py +0 -0
  79. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/serp.py +0 -0
  80. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/site2s.py +0 -0
  81. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/ssh.py +0 -0
  82. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/storage.py +0 -0
  83. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/sysmon.py +0 -0
  84. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/tts.py +0 -0
  85. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/update.py +0 -0
  86. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/commands/wifi.py +0 -0
  87. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/console.py +0 -0
  88. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/__init__.py +0 -0
  89. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/doctor.py +0 -0
  90. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/google_oauth.py +0 -0
  91. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/migrate.py +0 -0
  92. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/oauth_flow.py +0 -0
  93. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/registry.py +0 -0
  94. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/store.py +0 -0
  95. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/credentials/sync.py +0 -0
  96. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/__init__.py +0 -0
  97. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/align.py +0 -0
  98. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/core.py +0 -0
  99. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/creds.py +0 -0
  100. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/errors.py +0 -0
  101. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/gemini.py +0 -0
  102. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/imaging/ncnn.py +0 -0
  103. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/mcp_registry.py +0 -0
  104. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/openvpn.py +0 -0
  105. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/serp/__init__.py +0 -0
  106. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/serp/client.py +0 -0
  107. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/serp/creds.py +0 -0
  108. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/serp/errors.py +0 -0
  109. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/serp/install.py +0 -0
  110. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/serp/render.py +0 -0
  111. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/__init__.py +0 -0
  112. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/chunking.py +0 -0
  113. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/core.py +0 -0
  114. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/creds.py +0 -0
  115. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/errors.py +0 -0
  116. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/gemini.py +0 -0
  117. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/http.py +0 -0
  118. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/openai.py +0 -0
  119. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/player.py +0 -0
  120. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli/tts/vbee.py +0 -0
  121. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli.egg-info/SOURCES.txt +0 -0
  122. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli.egg-info/dependency_links.txt +0 -0
  123. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli.egg-info/entry_points.txt +0 -0
  124. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli.egg-info/requires.txt +0 -0
  125. {evo_cli-0.36.3 → evo_cli-0.36.5}/evo_cli.egg-info/top_level.txt +0 -0
  126. {evo_cli-0.36.3 → evo_cli-0.36.5}/pyproject.toml +0 -0
  127. {evo_cli-0.36.3 → evo_cli-0.36.5}/setup.cfg +0 -0
  128. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/__init__.py +0 -0
  129. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/fake_evo_agents.py +0 -0
  130. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/fixtures/hub/contract-0.2.0.json +0 -0
  131. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/fixtures/hub/mirror-demo.yaml +0 -0
  132. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_agent_toy.py +0 -0
  133. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_claude_code.py +0 -0
  134. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_cli.py +0 -0
  135. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_console.py +0 -0
  136. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_cred.py +0 -0
  137. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_fix_claude.py +0 -0
  138. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_gdrive.py +0 -0
  139. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_gh.py +0 -0
  140. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_harness.py +0 -0
  141. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_harness_clone.py +0 -0
  142. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_harness_dag.py +0 -0
  143. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_harness_hub.py +0 -0
  144. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_harness_show.py +0 -0
  145. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_image.py +0 -0
  146. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_mcp.py +0 -0
  147. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_ngrok.py +0 -0
  148. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_opencode.py +0 -0
  149. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_openvpn.py +0 -0
  150. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_plantuml.py +0 -0
  151. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_route.py +0 -0
  152. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_serp.py +0 -0
  153. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_storage.py +0 -0
  154. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_sysmon.py +0 -0
  155. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_tts.py +0 -0
  156. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_update.py +0 -0
  157. {evo_cli-0.36.3 → evo_cli-0.36.5}/tests/test_wifi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evo_cli
3
- Version: 0.36.3
3
+ Version: 0.36.5
4
4
  Summary: Evolution CLI - a developer toolbox for setting up dev machines
5
5
  Author: maycuatroi
6
6
  Project-URL: Homepage, https://github.com/maycuatroi/evo-cli
@@ -0,0 +1 @@
1
+ 0.36.5
@@ -2,10 +2,12 @@ import datetime
2
2
  import importlib.util
3
3
  import json
4
4
  import os
5
+ import re
5
6
  import shutil
6
7
  import subprocess
7
8
  import sys
8
9
  import tempfile
10
+ import zipfile
9
11
  from pathlib import Path
10
12
  from urllib.parse import unquote, urlparse
11
13
 
@@ -30,6 +32,13 @@ CONTAINERS = ["mp4", "mkv", "webm", "auto"]
30
32
  BROWSERS = ["chrome", "edge", "firefox", "brave", "chromium", "opera", "vivaldi", "safari"]
31
33
  JS_RUNTIMES = ["deno", "bun", "node"]
32
34
  YTDLP_STALE_DAYS = 60
35
+ # The `default` extra pulls in yt-dlp-ejs, the script yt-dlp runs to solve
36
+ # YouTube's JS challenges. Without it YouTube hands back images only, even with
37
+ # node or deno on PATH.
38
+ YTDLP_PACKAGE = "yt-dlp[default]"
39
+ # pip writes this two-line shebang instead of `#!<python>` when the interpreter
40
+ # path has spaces or is too long for the kernel.
41
+ PIP_SH_SHEBANG = re.compile(r"^'''exec' (?:\"([^\"]+)\"|(\S+))")
33
42
  # Codecs an MP4 is actually expected to carry. Facebook reels and YouTube serve
34
43
  # their best streams as VP9 / AV1, and muxing those into MP4 gives a file that
35
44
  # QuickTime, Photos and iMovie open with sound but a black picture - the picture
@@ -346,8 +355,95 @@ def find_js_runtime():
346
355
  return None, None
347
356
 
348
357
 
358
+ def script_interpreter(exe):
359
+ """The Python a pip-installed `yt-dlp` script runs on, or None for a standalone build.
360
+
361
+ `evo download` runs whichever yt-dlp is first on PATH, which is rarely the
362
+ Python evo itself lives in (a uv tool venv with no pip), so updates have to
363
+ go to the interpreter that owns this script.
364
+ """
365
+ path = Path(os.path.realpath(exe))
366
+ if os.name == "nt":
367
+ for folder in (path.parent, path.parent.parent):
368
+ candidate = folder / "python.exe"
369
+ if candidate.is_file():
370
+ return str(candidate)
371
+ return None
372
+ # The official Unix release is a zipapp with `#!/usr/bin/env python3`: the
373
+ # shebang names a Python, but that Python does not own it.
374
+ if not path.is_file() or zipfile.is_zipfile(path):
375
+ return None
376
+ try:
377
+ with open(path, "rb") as handle:
378
+ head = [handle.readline(1024).decode("utf-8", "replace").strip() for _ in range(2)]
379
+ except OSError:
380
+ return None
381
+ if not head[0].startswith("#!"):
382
+ return None
383
+ parts = head[0][2:].split()
384
+ if not parts:
385
+ return None
386
+ if parts[0] == "/bin/sh":
387
+ match = PIP_SH_SHEBANG.match(head[1])
388
+ return (match.group(1) or match.group(2)) if match else None
389
+ if Path(parts[0]).name == "env":
390
+ return shutil.which(parts[1]) if len(parts) > 1 else None
391
+ return parts[0]
392
+
393
+
394
+ def has_pip(python):
395
+ try:
396
+ result = subprocess.run([python, "-m", "pip", "--version"], capture_output=True, check=False)
397
+ except OSError:
398
+ return False
399
+ return result.returncode == 0
400
+
401
+
402
+ def pip_install_command(python):
403
+ """How to install YTDLP_PACKAGE into `python`, or None when nothing can."""
404
+ uv = shutil.which("uv")
405
+ venv = Path(python).parent.parent
406
+ if uv and venv.name == "yt-dlp" and (venv / "uv-receipt.toml").is_file():
407
+ # A `uv tool install yt-dlp` venv: go through uv tool so the receipt
408
+ # keeps the extra and a later `uv tool upgrade` does not drop it.
409
+ return [uv, "tool", "install", "--upgrade", YTDLP_PACKAGE]
410
+ if has_pip(python):
411
+ return [python, "-m", "pip", "install", "-U", YTDLP_PACKAGE]
412
+ if uv:
413
+ return [uv, "pip", "install", "--python", python, "-U", YTDLP_PACKAGE]
414
+ return None
415
+
416
+
417
+ def ytdlp_install_command():
418
+ """The command that installs or updates the yt-dlp `evo download` runs."""
419
+ cmd = ytdlp_command()
420
+ if cmd is None:
421
+ uv = shutil.which("uv")
422
+ if uv:
423
+ return [uv, "tool", "install", "--upgrade", YTDLP_PACKAGE]
424
+ if has_pip(sys.executable):
425
+ return [sys.executable, "-m", "pip", "install", "-U", YTDLP_PACKAGE]
426
+ return None
427
+ if cmd[0] == sys.executable and cmd[1:] == ["-m", "yt_dlp"]:
428
+ return pip_install_command(sys.executable)
429
+ exe = cmd[0]
430
+ brew = shutil.which("brew")
431
+ if brew and "/Cellar/yt-dlp/" in os.path.realpath(exe).replace(os.sep, "/"):
432
+ return [brew, "upgrade", "yt-dlp"]
433
+ python = script_interpreter(exe)
434
+ if python is None:
435
+ return [exe, "-U"]
436
+ return pip_install_command(python)
437
+
438
+
349
439
  def install_ytdlp():
350
- run_command([sys.executable, "-m", "pip", "install", "-U", "yt-dlp"], status="Installing yt-dlp")
440
+ cmd = ytdlp_install_command()
441
+ if cmd is None:
442
+ raise click.ClickException(
443
+ "No pip or uv to install yt-dlp with. Install uv (https://docs.astral.sh/uv/), "
444
+ f'then run: uv tool install "{YTDLP_PACKAGE}"'
445
+ )
446
+ run_command(cmd, status="Installing yt-dlp")
351
447
 
352
448
 
353
449
  def detect_package_manager():
@@ -385,12 +481,14 @@ def ensure_ytdlp(assume_yes=False):
385
481
  warn_if_stale()
386
482
  return cmd
387
483
  warning("yt-dlp is not installed.")
388
- if not assume_yes and not click.confirm("Install yt-dlp now with pip?", default=True):
389
- raise click.ClickException("yt-dlp is required. Install it with: pip install -U yt-dlp")
484
+ if not assume_yes and not click.confirm("Install yt-dlp now?", default=True):
485
+ raise click.ClickException(f'yt-dlp is required. Install it with: uv tool install "{YTDLP_PACKAGE}"')
390
486
  install_ytdlp()
391
487
  cmd = ytdlp_command()
392
488
  if not cmd:
393
- raise click.ClickException("yt-dlp was installed but could not be found. Check your PATH.")
489
+ raise click.ClickException(
490
+ "yt-dlp was installed but is not on PATH. Run `uv tool update-shell`, open a new terminal, try again."
491
+ )
394
492
  return cmd
395
493
 
396
494
 
@@ -878,7 +976,10 @@ def formats_cmd(url, cookies, assume_yes):
878
976
  "install",
879
977
  context_settings={"help_option_names": ["-h", "--help"]},
880
978
  help=(
881
- "Install or update **yt-dlp** (via pip).\n\n"
979
+ "Install or update **yt-dlp**, with yt-dlp-ejs for YouTube's JS challenges.\n\n"
980
+ "It updates the copy `evo download` runs, where it was installed from: pip, "
981
+ "uv tool, Homebrew or a standalone build. With none on PATH it installs one "
982
+ "with `uv tool install`.\n\n"
882
983
  "With `--with-deps` it also installs **ffmpeg** using whichever package manager "
883
984
  "it detects (apt, dnf, pacman, brew, winget, choco)."
884
985
  ),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evo_cli
3
- Version: 0.36.3
3
+ Version: 0.36.5
4
4
  Summary: Evolution CLI - a developer toolbox for setting up dev machines
5
5
  Author: maycuatroi
6
6
  Project-URL: Homepage, https://github.com/maycuatroi/evo-cli
@@ -1,5 +1,8 @@
1
1
  import datetime
2
+ import os
2
3
  import subprocess
4
+ import sys
5
+ import zipfile
3
6
  from pathlib import Path
4
7
 
5
8
  import pytest
@@ -434,3 +437,127 @@ def test_failure_on_fresh_ytdlp_keeps_the_formats_hint(monkeypatch, tmp_path):
434
437
  result = CliRunner().invoke(cli, ["download", YOUTUBE, "-o", str(tmp_path)])
435
438
  assert result.exit_code != 0
436
439
  assert "evo download formats" in result.output.replace("\n", "")
440
+
441
+
442
+ posix_only = pytest.mark.skipif(os.name == "nt", reason="shebang scripts are a POSIX install layout")
443
+ PKG = dl.YTDLP_PACKAGE
444
+
445
+
446
+ def fake_which(monkeypatch, **tools):
447
+ # A plain dict lookup, so other callers of shutil.which cannot use it up.
448
+ monkeypatch.setattr(dl.shutil, "which", lambda name: tools.get(name))
449
+
450
+
451
+ def write_script(path, first_lines):
452
+ path.parent.mkdir(parents=True, exist_ok=True)
453
+ path.write_text(first_lines + "import sys\nfrom yt_dlp import main\n")
454
+ return path
455
+
456
+
457
+ def test_install_pulls_in_the_js_challenge_solver():
458
+ assert PKG == "yt-dlp[default]"
459
+
460
+
461
+ @posix_only
462
+ def test_install_targets_the_python_that_owns_the_path_ytdlp(monkeypatch, tmp_path):
463
+ script = write_script(tmp_path / "bin" / "yt-dlp", "#!/opt/anaconda3/bin/python\n")
464
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [str(script)])
465
+ monkeypatch.setattr(dl, "has_pip", lambda python: python == "/opt/anaconda3/bin/python")
466
+ fake_which(monkeypatch, uv="/u/uv")
467
+ assert dl.ytdlp_install_command() == ["/opt/anaconda3/bin/python", "-m", "pip", "install", "-U", PKG]
468
+
469
+
470
+ @posix_only
471
+ def test_install_reads_the_sh_shebang_pip_writes_for_long_paths(monkeypatch, tmp_path):
472
+ python = "/Users/me/My Envs/yt/bin/python"
473
+ quotes = "'" * 3
474
+ shebang = f'#!/bin/sh\n{quotes}exec\' "{python}" "$0" "$@"\n\' {quotes}\n'
475
+ script = write_script(tmp_path / "yt-dlp", shebang)
476
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [str(script)])
477
+ monkeypatch.setattr(dl, "has_pip", lambda p: p == python)
478
+ fake_which(monkeypatch)
479
+ assert dl.ytdlp_install_command() == [python, "-m", "pip", "install", "-U", PKG]
480
+
481
+
482
+ def test_install_into_a_venv_without_pip_goes_through_uv(monkeypatch):
483
+ # evo as a uv tool: its venv has yt_dlp importable but no pip.
484
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [sys.executable, "-m", "yt_dlp"])
485
+ monkeypatch.setattr(dl, "has_pip", lambda python: False)
486
+ fake_which(monkeypatch, uv="/u/uv")
487
+ assert dl.ytdlp_install_command() == ["/u/uv", "pip", "install", "--python", sys.executable, "-U", PKG]
488
+
489
+
490
+ @posix_only
491
+ def test_install_updates_a_uv_tool_ytdlp_through_uv_tool(monkeypatch, tmp_path):
492
+ venv = tmp_path / "tools" / "yt-dlp"
493
+ (venv / "bin").mkdir(parents=True)
494
+ (venv / "uv-receipt.toml").write_text('[tool]\nrequirements = [{ name = "yt-dlp" }]\n')
495
+ script = write_script(venv / "bin" / "yt-dlp", f"#!{venv / 'bin' / 'python'}\n")
496
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [str(script)])
497
+ monkeypatch.setattr(dl, "has_pip", lambda python: pytest.fail("uv tool venvs are updated by uv"))
498
+ fake_which(monkeypatch, uv="/u/uv")
499
+ assert dl.ytdlp_install_command() == ["/u/uv", "tool", "install", "--upgrade", PKG]
500
+
501
+
502
+ @posix_only
503
+ def test_install_upgrades_a_homebrew_ytdlp_with_brew(monkeypatch, tmp_path):
504
+ real = write_script(tmp_path / "Cellar" / "yt-dlp" / "2026.10.26" / "bin" / "yt-dlp", "#!/x/libexec/bin/python\n")
505
+ link = tmp_path / "bin" / "yt-dlp"
506
+ link.parent.mkdir()
507
+ link.symlink_to(real)
508
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [str(link)])
509
+ fake_which(monkeypatch, brew="/opt/homebrew/bin/brew", uv="/u/uv")
510
+ assert dl.ytdlp_install_command() == ["/opt/homebrew/bin/brew", "upgrade", "yt-dlp"]
511
+
512
+
513
+ def test_install_self_updates_a_standalone_binary(monkeypatch, tmp_path):
514
+ exe = tmp_path / "yt-dlp"
515
+ exe.write_bytes(b"\x7fELF\x02\x01\x01" + b"\x00" * 64)
516
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [str(exe)])
517
+ fake_which(monkeypatch, uv="/u/uv")
518
+ assert dl.ytdlp_install_command() == [str(exe), "-U"]
519
+
520
+
521
+ @posix_only
522
+ def test_install_self_updates_the_zipapp_release(monkeypatch, tmp_path):
523
+ exe = tmp_path / "yt-dlp"
524
+ with open(exe, "wb") as handle:
525
+ handle.write(b"#!/usr/bin/env python3\n")
526
+ with zipfile.ZipFile(handle, "w") as archive:
527
+ archive.writestr("__main__.py", "print('hi')\n")
528
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: [str(exe)])
529
+ fake_which(monkeypatch, python3="/usr/bin/python3", uv="/u/uv")
530
+ assert dl.ytdlp_install_command() == [str(exe), "-U"]
531
+
532
+
533
+ def test_missing_ytdlp_is_installed_as_a_uv_tool(monkeypatch):
534
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: None)
535
+ fake_which(monkeypatch, uv="/u/uv")
536
+ assert dl.ytdlp_install_command() == ["/u/uv", "tool", "install", "--upgrade", PKG]
537
+
538
+
539
+ def test_missing_ytdlp_without_uv_falls_back_to_pip(monkeypatch):
540
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: None)
541
+ monkeypatch.setattr(dl, "has_pip", lambda python: True)
542
+ fake_which(monkeypatch)
543
+ assert dl.ytdlp_install_command() == [sys.executable, "-m", "pip", "install", "-U", PKG]
544
+
545
+
546
+ def test_install_without_pip_or_uv_says_how(monkeypatch):
547
+ monkeypatch.setattr(dl, "ytdlp_command", lambda: None)
548
+ monkeypatch.setattr(dl, "has_pip", lambda python: False)
549
+ fake_which(monkeypatch)
550
+ result = CliRunner().invoke(cli, ["download", "install"])
551
+ assert result.exit_code != 0
552
+ assert "uv tool install" in result.output
553
+
554
+
555
+ def test_install_command_runs_what_it_resolved(monkeypatch):
556
+ ran = []
557
+ monkeypatch.setattr(dl, "ytdlp_install_command", lambda: ["/u/uv", "tool", "install", "--upgrade", PKG])
558
+ monkeypatch.setattr(dl, "run_command", lambda cmd, **kw: ran.append(cmd))
559
+ monkeypatch.setattr(dl, "report_environment", lambda: None)
560
+ monkeypatch.setattr(dl, "ytdlp_version", lambda: "2026.10.26")
561
+ result = CliRunner().invoke(cli, ["download", "install"])
562
+ assert result.exit_code == 0, result.output
563
+ assert ran == [["/u/uv", "tool", "install", "--upgrade", PKG]]
@@ -1 +0,0 @@
1
- 0.36.3
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