@zils/cli 0.4.4 → 0.4.5

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.
package/bootstrap.py CHANGED
@@ -45,6 +45,44 @@ def installation_lock(path):
45
45
  fcntl.flock(lock, fcntl.LOCK_UN)
46
46
 
47
47
 
48
+ def pip_install(python, target, **options):
49
+ return subprocess.run(
50
+ [
51
+ str(python),
52
+ "-I",
53
+ "-m",
54
+ "pip",
55
+ "--isolated",
56
+ "--disable-pip-version-check",
57
+ "install",
58
+ "--no-input",
59
+ "--only-binary=:all:",
60
+ "--index-url",
61
+ "https://pypi.org/simple",
62
+ target,
63
+ ],
64
+ **options,
65
+ )
66
+
67
+
68
+ def install(python, wheel):
69
+ """The CLI must install; `zils merge`'s numpy + huggingface_hub are best effort, since a new
70
+ Python can lack binary builds of them (pyyaml had none for 3.15) and must not block other commands."""
71
+ pip_install(python, str(wheel), stdout=sys.stderr, check=True)
72
+ if pip_install(python, f"{wheel}[merge]", capture_output=True, text=True).returncode:
73
+ version = "%d.%d" % sys.version_info[:2]
74
+ print(
75
+ f"zils merge is unavailable on Python {version}: its dependencies have no build for it yet."
76
+ " Every other command works.",
77
+ file=sys.stderr,
78
+ )
79
+ subprocess.run(
80
+ [str(python), "-I", "-c", "import zils_sdk; from zils_sdk.cli import main"],
81
+ stdout=sys.stderr,
82
+ check=True,
83
+ )
84
+
85
+
48
86
  def runtime():
49
87
  package = Path(__file__).resolve().parent
50
88
  version = json.loads((package / "package.json").read_text())["version"]
@@ -77,29 +115,7 @@ def runtime():
77
115
  stdout=sys.stderr,
78
116
  check=True,
79
117
  )
80
- subprocess.run(
81
- [
82
- str(python),
83
- "-I",
84
- "-m",
85
- "pip",
86
- "--isolated",
87
- "--disable-pip-version-check",
88
- "install",
89
- "--no-input",
90
- "--only-binary=:all:",
91
- "--index-url",
92
- "https://pypi.org/simple",
93
- f"{wheel}[merge]", # numpy + huggingface_hub for zils merge
94
- ],
95
- stdout=sys.stderr,
96
- check=True,
97
- )
98
- subprocess.run(
99
- [str(python), "-I", "-c", "import zils_sdk; from zils_sdk.cli import main"],
100
- stdout=sys.stderr,
101
- check=True,
102
- )
118
+ install(python, wheel)
103
119
  ready.write_text(digest + "\n")
104
120
  return python
105
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zils/cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Sign in, train, and call Zils decision models from your terminal",
5
5
  "license": "MIT",
6
6
  "homepage": "https://zils.ai",
index 55f5256..f685c30 100644
Binary file