multicloud-cli 0.9.0__tar.gz → 0.9.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.
Files changed (42) hide show
  1. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/PKG-INFO +2 -2
  2. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/README.md +1 -1
  3. multicloud_cli-0.9.1/multicloud_cli/__init__.py +1 -0
  4. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/main.py +12 -2
  5. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_version_check.py +29 -2
  6. multicloud_cli-0.9.0/multicloud_cli/__init__.py +0 -1
  7. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/.gitignore +0 -0
  8. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/LICENSE +0 -0
  9. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/account.py +0 -0
  10. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/api.py +0 -0
  11. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/auth.py +0 -0
  12. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/catalog.py +0 -0
  13. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/cloud_account.py +0 -0
  14. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/config.py +0 -0
  15. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/duration.py +0 -0
  16. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/exitcodes.py +0 -0
  17. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/extend.py +0 -0
  18. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/net.py +0 -0
  19. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/node.py +0 -0
  20. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/orgopt.py +0 -0
  21. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/output.py +0 -0
  22. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/pool.py +0 -0
  23. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/ssh.py +0 -0
  24. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/ssh_cert.py +0 -0
  25. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/sso.py +0 -0
  26. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/multicloud_cli/version_check.py +0 -0
  27. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/pyproject.toml +0 -0
  28. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/__init__.py +0 -0
  29. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/conftest.py +0 -0
  30. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/helpers.py +0 -0
  31. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_account_extend.py +0 -0
  32. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_apply.py +0 -0
  33. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_auth.py +0 -0
  34. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_catalog.py +0 -0
  35. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_cloud_account.py +0 -0
  36. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_conventions.py +0 -0
  37. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_net.py +0 -0
  38. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_pool.py +0 -0
  39. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_ssh.py +0 -0
  40. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_ssh_cert.py +0 -0
  41. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_sso.py +0 -0
  42. {multicloud_cli-0.9.0 → multicloud_cli-0.9.1}/tests/test_sso_session.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: multicloud-cli
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: mctl: the Multicloud command line: sign in, connect your cloud account, run pools
5
5
  Project-URL: Homepage, https://multicloud.io
6
6
  Author-email: Multicloud Team <info@multicloud.io>
@@ -43,7 +43,7 @@ pipx install multicloud-cli # or: uv tool install multicloud-cli
43
43
  ```
44
44
 
45
45
  If `mctl` is not found after the install, run `uv tool update-shell` (or `pipx ensurepath`) and open a new shell.
46
- Upgrade with `uv tool upgrade multicloud-cli` (or `pipx upgrade multicloud-cli`). Check the version with `mctl --version`.
46
+ Upgrade with `uv tool upgrade multicloud-cli` (or `pipx upgrade multicloud-cli`). Check the version with `mctl version` (or `mctl --version`).
47
47
  Once a day, `mctl` asks PyPI for the latest version and prints one line when a newer version exists. It never
48
48
  upgrades itself. Turn the check off with `MCTL_NO_UPDATE_CHECK=1`.
49
49
 
@@ -12,7 +12,7 @@ pipx install multicloud-cli # or: uv tool install multicloud-cli
12
12
  ```
13
13
 
14
14
  If `mctl` is not found after the install, run `uv tool update-shell` (or `pipx ensurepath`) and open a new shell.
15
- Upgrade with `uv tool upgrade multicloud-cli` (or `pipx upgrade multicloud-cli`). Check the version with `mctl --version`.
15
+ Upgrade with `uv tool upgrade multicloud-cli` (or `pipx upgrade multicloud-cli`). Check the version with `mctl version` (or `mctl --version`).
16
16
  Once a day, `mctl` asks PyPI for the latest version and prints one line when a newer version exists. It never
17
17
  upgrades itself. Turn the check off with `MCTL_NO_UPDATE_CHECK=1`.
18
18
 
@@ -0,0 +1 @@
1
+ __version__ = "0.9.1"
@@ -26,6 +26,9 @@ def _broken_pipe() -> int:
26
26
  return exitcodes.BROKEN_PIPE
27
27
 
28
28
 
29
+ VERSION_LINE = f"mctl, version {__version__}" # one line for `mctl version` and `mctl --version`
30
+
31
+
29
32
  class Root(click.Group):
30
33
  def invoke(self, ctx):
31
34
  # click itself turns EPIPE into exit 1, so this catches it first.
@@ -36,7 +39,7 @@ class Root(click.Group):
36
39
 
37
40
 
38
41
  @click.group(cls=Root, context_settings={"help_option_names": ["-h", "--help"]})
39
- @click.version_option(__version__, prog_name="mctl")
42
+ @click.version_option(__version__, message=VERSION_LINE)
40
43
  @org_option()
41
44
  @click.option("--api-url", default=None, help="API URL (default: MULTICLOUD_API_URL)")
42
45
  @click.pass_context
@@ -50,6 +53,12 @@ def mctl(ctx, org, api_url):
50
53
  ctx.obj["root_api_url"] = api_url
51
54
 
52
55
 
56
+ @mctl.command("version")
57
+ def version_cmd():
58
+ """Print the mctl version (the same line as mctl --version)."""
59
+ click.echo(VERSION_LINE)
60
+
61
+
53
62
  mctl.add_command(auth)
54
63
  mctl.add_command(cloud_account)
55
64
  mctl.add_command(pool)
@@ -98,7 +107,8 @@ def _version_notice() -> None:
98
107
 
99
108
  def main():
100
109
  code = _run()
101
- if code not in (exitcodes.INTERRUPTED, exitcodes.BROKEN_PIPE): # the user or the pipe wants mctl gone
110
+ local_only = sys.argv[1:2] == ["version"] or "--version" in sys.argv[1:] # no network, no notice
111
+ if code not in (exitcodes.INTERRUPTED, exitcodes.BROKEN_PIPE) and not local_only: # the user or the pipe wants mctl gone
102
112
  _version_notice()
103
113
  try:
104
114
  sys.stdout.flush() # a closed pipe shows here, when the output was small and buffered
@@ -134,7 +134,7 @@ def test_env_switch_skips_the_check(cache, pypi, monkeypatch):
134
134
  def test_main_prints_the_notice_and_keeps_the_exit_code(cache, pypi, monkeypatch, capsys):
135
135
  pypi["latest"] = "99.0.0"
136
136
  monkeypatch.setattr(version_check.sys, "stderr", TtyErr())
137
- monkeypatch.setattr(main.sys, "argv", ["mctl", "--version"])
137
+ monkeypatch.setattr(main.sys, "argv", ["mctl", "--help"])
138
138
  with pytest.raises(SystemExit) as ex:
139
139
  main.main()
140
140
  assert ex.value.code == 0
@@ -146,7 +146,7 @@ def test_main_survives_a_broken_check(monkeypatch):
146
146
  raise RuntimeError("bug in the check")
147
147
 
148
148
  monkeypatch.setattr(version_check, "notify", boom)
149
- monkeypatch.setattr(main.sys, "argv", ["mctl", "--version"])
149
+ monkeypatch.setattr(main.sys, "argv", ["mctl", "--help"])
150
150
  with pytest.raises(SystemExit) as ex:
151
151
  main.main()
152
152
  assert ex.value.code == 0
@@ -230,3 +230,30 @@ def test_ctrl_c_during_the_lookup_only_drops_the_notice(monkeypatch):
230
230
  with pytest.raises(SystemExit) as ex:
231
231
  main.main()
232
232
  assert ex.value.code == 0
233
+
234
+
235
+ # --- `mctl version` ------------------------------------------------------------------------------------------
236
+
237
+ def test_version_command_prints_the_same_line_as_the_flag():
238
+ from click.testing import CliRunner
239
+ from multicloud_cli import __version__
240
+ runner = CliRunner()
241
+ cmd = runner.invoke(main.mctl, ["version"])
242
+ flag = runner.invoke(main.mctl, ["--version"])
243
+ assert cmd.exit_code == 0
244
+ assert cmd.output == flag.output == f"mctl, version {__version__}\n"
245
+
246
+
247
+ @pytest.mark.parametrize("argv", [["mctl", "version"], ["mctl", "--version"]])
248
+ def test_version_forms_make_no_network_call_even_on_a_terminal(cache, monkeypatch, argv, capsys):
249
+ """Through main(), where the notice runs: both forms stay local and print only the version."""
250
+ monkeypatch.delenv("MCTL_NO_UPDATE_CHECK", raising=False)
251
+ calls = []
252
+ monkeypatch.setattr(requests, "request", lambda *a, **kw: calls.append(a) or FakeResponse(200, {"info": {"version": "99.0.0"}}))
253
+ monkeypatch.setattr(version_check.sys, "stderr", TtyErr())
254
+ monkeypatch.setattr(main.sys, "argv", argv)
255
+ with pytest.raises(SystemExit) as ex:
256
+ main.main()
257
+ assert ex.value.code == 0
258
+ assert calls == []
259
+ assert version_check.sys.stderr.getvalue() == ""
@@ -1 +0,0 @@
1
- __version__ = "0.9.0"
File without changes