elan-cli 0.1.0__tar.gz → 0.1.1__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.
- {elan_cli-0.1.0 → elan_cli-0.1.1}/PKG-INFO +1 -1
- {elan_cli-0.1.0 → elan_cli-0.1.1}/pyproject.toml +1 -1
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/main.py +42 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/.gitignore +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/LICENSE +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/README.md +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/__init__.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/adk.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/auth.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/client.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/config.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/deploy.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/destroy.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/doctor.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/env.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/files.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/invoke.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/logs.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/manifests.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/project.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/projects.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/rollback.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/scaffold.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/secret.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/stream.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/tenant.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/validate.py +0 -0
- {elan_cli-0.1.0 → elan_cli-0.1.1}/src/elan_cli/wallet.py +0 -0
|
@@ -16,6 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
import argparse
|
|
18
18
|
import sys
|
|
19
|
+
from importlib import metadata
|
|
19
20
|
from pathlib import Path
|
|
20
21
|
|
|
21
22
|
from elan_cli import adk as adk_cmd
|
|
@@ -45,9 +46,50 @@ from elan_cli.secret import SecretError
|
|
|
45
46
|
from elan_cli.wallet import WalletError
|
|
46
47
|
|
|
47
48
|
|
|
49
|
+
def version_line() -> str:
|
|
50
|
+
"""What `--version` prints, read back out of the INSTALLED distributions.
|
|
51
|
+
|
|
52
|
+
NO `__version__` CONSTANT HERE. `pyproject.toml` already declares the
|
|
53
|
+
number and `importlib.metadata` reads that same declaration out of the
|
|
54
|
+
installed package, so there is nowhere for a second copy to drift from the
|
|
55
|
+
first. The SDK carries its number twice only because npm has to read one
|
|
56
|
+
of them; this has no such reason.
|
|
57
|
+
|
|
58
|
+
THE SDK'S NUMBER IS ON THE LINE TOO, because the whole reason this flag
|
|
59
|
+
matters is a stale install, and the two are versioned independently —
|
|
60
|
+
`elan-cli` and `elan-sdk` are separate distributions with separate tag
|
|
61
|
+
namespaces, so a CLI whose own number looks current can be sitting on an
|
|
62
|
+
SDK that is not. One line is what somebody pastes into a support thread.
|
|
63
|
+
|
|
64
|
+
"unknown" RATHER THAN A RAISE, per distribution. Running from a source
|
|
65
|
+
tree with nothing installed still gets the rest of the line: `--version`
|
|
66
|
+
is the one command that must never itself be the thing that fails.
|
|
67
|
+
|
|
68
|
+
EAGER, NOT LAZY. `build_parser` runs on every invocation and argparse's
|
|
69
|
+
`version` action wants a string, so both lookups happen every time —
|
|
70
|
+
measured at 0.235 ms for the pair, against a CLI whose quickest command
|
|
71
|
+
opens a socket. A custom action to defer that would be more code than the
|
|
72
|
+
cost it saves.
|
|
73
|
+
"""
|
|
74
|
+
def declared(distribution: str) -> str:
|
|
75
|
+
try:
|
|
76
|
+
return metadata.version(distribution)
|
|
77
|
+
except metadata.PackageNotFoundError:
|
|
78
|
+
return "unknown"
|
|
79
|
+
|
|
80
|
+
return f"elan {declared('elan-cli')} (elan-sdk {declared('elan-sdk')})"
|
|
81
|
+
|
|
82
|
+
|
|
48
83
|
def build_parser() -> argparse.ArgumentParser:
|
|
49
84
|
parser = argparse.ArgumentParser(
|
|
50
85
|
prog="elan", description="Deploy an ADK agent to the platform.")
|
|
86
|
+
# THERE IS STILL NO VERSION NEGOTIATION, and this flag is not it. Nothing
|
|
87
|
+
# sends a client version to the platform — no `User-Agent`, no header, and
|
|
88
|
+
# nothing in `/v1/auth`'s handshake — so the platform cannot tell a caller
|
|
89
|
+
# it is too old. This only lets a developer answer "which one have I got",
|
|
90
|
+
# which is what an index install took away from them: before publication
|
|
91
|
+
# the answer was whatever the checkout was at.
|
|
92
|
+
parser.add_argument("--version", action="version", version=version_line())
|
|
51
93
|
sub = parser.add_subparsers(dest="command", metavar="<command>")
|
|
52
94
|
|
|
53
95
|
login = sub.add_parser("login", help="sign in with a browser, on any machine")
|
|
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
|