operx-cli 0.3.1__tar.gz → 0.3.2__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 (63) hide show
  1. {operx_cli-0.3.1 → operx_cli-0.3.2}/PKG-INFO +2 -2
  2. {operx_cli-0.3.1 → operx_cli-0.3.2}/README.md +1 -1
  3. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/__init__.py +1 -1
  4. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/update.py +1 -1
  5. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/self_update.py +8 -5
  6. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli.egg-info/PKG-INFO +2 -2
  7. {operx_cli-0.3.1 → operx_cli-0.3.2}/pyproject.toml +1 -1
  8. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_self_update.py +27 -5
  9. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/AGENTES.md +0 -0
  10. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/agent_guide.py +0 -0
  11. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/app.py +0 -0
  12. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/browser_login.py +0 -0
  13. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/client.py +0 -0
  14. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/__init__.py +0 -0
  15. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/account.py +0 -0
  16. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/ambiental.py +0 -0
  17. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/common.py +0 -0
  18. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/empresas.py +0 -0
  19. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/inventario.py +0 -0
  20. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/lecturas.py +0 -0
  21. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/ordenes.py +0 -0
  22. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/personas.py +0 -0
  23. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/preventivos.py +0 -0
  24. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/raw.py +0 -0
  25. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/registros.py +0 -0
  26. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/search.py +0 -0
  27. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/commands/sst.py +0 -0
  28. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/lookup.py +0 -0
  29. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/output.py +0 -0
  30. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/record_completion.py +0 -0
  31. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/settings.py +0 -0
  32. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/shell.py +0 -0
  33. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/spreadsheet.py +0 -0
  34. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/updates.py +0 -0
  35. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/values.py +0 -0
  36. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli/welcome.py +0 -0
  37. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli.egg-info/SOURCES.txt +0 -0
  38. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli.egg-info/dependency_links.txt +0 -0
  39. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli.egg-info/entry_points.txt +0 -0
  40. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli.egg-info/requires.txt +0 -0
  41. {operx_cli-0.3.1 → operx_cli-0.3.2}/operx_cli.egg-info/top_level.txt +0 -0
  42. {operx_cli-0.3.1 → operx_cli-0.3.2}/setup.cfg +0 -0
  43. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_agentes.py +0 -0
  44. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_app.py +0 -0
  45. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_cards.py +0 -0
  46. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_client.py +0 -0
  47. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_inventario_lecturas.py +0 -0
  48. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_login.py +0 -0
  49. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_logout_and_routes.py +0 -0
  50. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_lookup.py +0 -0
  51. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_ordenes.py +0 -0
  52. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_output.py +0 -0
  53. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_personas.py +0 -0
  54. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_preventivos.py +0 -0
  55. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_record_completion.py +0 -0
  56. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_registros.py +0 -0
  57. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_settings.py +0 -0
  58. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_shell.py +0 -0
  59. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_spreadsheet.py +0 -0
  60. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_sst_ambiental.py +0 -0
  61. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_updates.py +0 -0
  62. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_values.py +0 -0
  63. {operx_cli-0.3.1 → operx_cli-0.3.2}/tests/test_welcome.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: operx-cli
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: La línea de comandos de OperX: tu empresa desde la terminal, con tu token de API.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -39,7 +39,7 @@ terminal nueva y comprueba con `operx --version`.
39
39
  Para actualizar: `operx update`. La pantalla de bienvenida avisa cuando hay una
40
40
  versión nueva. En Windows la instala otra ventana, que espera a que se cierre
41
41
  `operx` (Windows no deja reemplazar un programa abierto); si quedó a medias,
42
- `uv tool install operx-cli --force` lo deja bien.
42
+ `uv tool install operx-cli --force --refresh` lo deja bien.
43
43
 
44
44
  ## Entrar
45
45
 
@@ -25,7 +25,7 @@ terminal nueva y comprueba con `operx --version`.
25
25
  Para actualizar: `operx update`. La pantalla de bienvenida avisa cuando hay una
26
26
  versión nueva. En Windows la instala otra ventana, que espera a que se cierre
27
27
  `operx` (Windows no deja reemplazar un programa abierto); si quedó a medias,
28
- `uv tool install operx-cli --force` lo deja bien.
28
+ `uv tool install operx-cli --force --refresh` lo deja bien.
29
29
 
30
30
  ## Entrar
31
31
 
@@ -2,4 +2,4 @@
2
2
  API (backend/users/api_allowlist.py) from a terminal, with a personal API
3
3
  token."""
4
4
 
5
- __version__ = "0.3.1"
5
+ __version__ = "0.3.2"
@@ -20,7 +20,7 @@ def update(ctx: typer.Context):
20
20
  if latest and not updates.is_newer(latest, __version__):
21
21
  typer.echo(f"Ya tienes la versión más nueva: {__version__}.")
22
22
  return
23
- command = self_update.installer_command()
23
+ command = self_update.installer_command(latest)
24
24
  if command is None:
25
25
  raise CliError(NO_INSTALLER)
26
26
  target = f"la {latest}" if latest else "la versión más nueva"
@@ -20,16 +20,19 @@ def on_windows():
20
20
  return os.name == "nt"
21
21
 
22
22
 
23
- def installer_command():
23
+ def installer_command(latest=None):
24
24
  """The command that installs the newest operx, or None when neither uv
25
- nor pipx is here. --force reinstalls without a version pin (a pinned
26
- install never upgrades); --refresh-package skips uv's cached answer, which
27
- can still say there's nothing new right after a release."""
25
+ nor pipx is here. --force reinstalls without a pin (a pinned install
26
+ never upgrades); --refresh skips uv's cached answers, which can lag
27
+ behind a release (--refresh-package alone put 0.3.0 back the minute
28
+ 0.3.1 came out). With `latest`, PyPI's newest, uv must install at least
29
+ that one: it fails rather than put the old one back."""
28
30
  if "pipx" in sys.prefix.lower():
29
31
  pipx = shutil.which("pipx")
30
32
  return [pipx, "upgrade", PACKAGE] if pipx else None
31
33
  uv = shutil.which("uv")
32
- return [uv, "tool", "install", PACKAGE, "--force", "--refresh-package", PACKAGE] if uv else None
34
+ spec = f"{PACKAGE}>={latest}" if latest else PACKAGE
35
+ return [uv, "tool", "install", spec, "--force", "--refresh"] if uv else None
33
36
 
34
37
 
35
38
  def _quoted(part):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: operx-cli
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: La línea de comandos de OperX: tu empresa desde la terminal, con tu token de API.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -39,7 +39,7 @@ terminal nueva y comprueba con `operx --version`.
39
39
  Para actualizar: `operx update`. La pantalla de bienvenida avisa cuando hay una
40
40
  versión nueva. En Windows la instala otra ventana, que espera a que se cierre
41
41
  `operx` (Windows no deja reemplazar un programa abierto); si quedó a medias,
42
- `uv tool install operx-cli --force` lo deja bien.
42
+ `uv tool install operx-cli --force --refresh` lo deja bien.
43
43
 
44
44
  ## Entrar
45
45
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "operx-cli"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  description = "La línea de comandos de OperX: tu empresa desde la terminal, con tu token de API."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -23,7 +23,9 @@ def started(monkeypatch):
23
23
  calls = {"windows": [], "ran": []}
24
24
  monkeypatch.setattr(self_update, "start_window", lambda script: calls["windows"].append(script))
25
25
  monkeypatch.setattr(self_update, "run_here", lambda command: calls["ran"].append(command) or 0)
26
- monkeypatch.setattr(self_update, "installer_command", lambda: [UV, "tool", "install", "operx-cli", "--force"])
26
+ monkeypatch.setattr(
27
+ self_update, "installer_command", lambda latest=None: [UV, "tool", "install", "operx-cli", "--force"],
28
+ )
27
29
  return calls
28
30
 
29
31
 
@@ -99,7 +101,7 @@ def test_when_pypi_cannot_say_it_updates_anyway(monkeypatch, started):
99
101
 
100
102
  def test_without_uv_or_pipx_it_says_how(monkeypatch, started):
101
103
  newest_is(monkeypatch, "9.9.9")
102
- monkeypatch.setattr(self_update, "installer_command", lambda: None)
104
+ monkeypatch.setattr(self_update, "installer_command", lambda latest=None: None)
103
105
 
104
106
  result = run(FakeApi({}), "update")
105
107
 
@@ -110,14 +112,34 @@ def test_without_uv_or_pipx_it_says_how(monkeypatch, started):
110
112
  def test_the_installer_is_uv_unless_operx_came_with_pipx(monkeypatch):
111
113
  monkeypatch.setattr(self_update.shutil, "which", lambda name: f"/bin/{name}")
112
114
  monkeypatch.setattr(self_update.sys, "prefix", "/home/ana/.local/share/uv/tools/operx-cli")
113
- assert self_update.installer_command() == [
114
- "/bin/uv", "tool", "install", "operx-cli", "--force", "--refresh-package", "operx-cli",
115
- ]
115
+ assert self_update.installer_command() == ["/bin/uv", "tool", "install", "operx-cli", "--force", "--refresh"]
116
116
 
117
117
  monkeypatch.setattr(self_update.sys, "prefix", "/home/ana/.local/pipx/venvs/operx-cli")
118
118
  assert self_update.installer_command() == ["/bin/pipx", "upgrade", "operx-cli"]
119
119
 
120
120
 
121
+ def test_uv_is_asked_for_at_least_the_version_pypi_named(monkeypatch):
122
+ # Right after a release uv's answer can lag behind PyPI's: then it fails
123
+ # instead of putting the old version back and saying it worked.
124
+ monkeypatch.setattr(self_update.shutil, "which", lambda name: f"/bin/{name}")
125
+ monkeypatch.setattr(self_update.sys, "prefix", "/home/ana/.local/share/uv/tools/operx-cli")
126
+
127
+ assert self_update.installer_command("0.3.2") == [
128
+ "/bin/uv", "tool", "install", "operx-cli>=0.3.2", "--force", "--refresh",
129
+ ]
130
+
131
+
132
+ def test_update_passes_pypi_s_version_to_the_installer(monkeypatch, started):
133
+ newest_is(monkeypatch, "9.9.9")
134
+ monkeypatch.setattr(self_update, "on_windows", lambda: False)
135
+ asked = []
136
+ monkeypatch.setattr(self_update, "installer_command", lambda latest=None: asked.append(latest) or ["uv"])
137
+
138
+ run(FakeApi({}), "update")
139
+
140
+ assert asked == ["9.9.9"]
141
+
142
+
121
143
  def test_the_window_quotes_a_path_with_spaces_and_quotes():
122
144
  script = self_update.window_script([r"C:\Users\Ana O'Neil\uv.exe", "tool"], 4242)
123
145
 
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