cleepcli 1.48.0__tar.gz → 1.48.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. {cleepcli-1.48.0/cleepcli.egg-info → cleepcli-1.48.1}/PKG-INFO +8 -8
  2. {cleepcli-1.48.0 → cleepcli-1.48.1}/README.md +2 -2
  3. {cleepcli-1.48.0 → cleepcli-1.48.1}/bin/ccli +8 -2
  4. {cleepcli-1.48.0 → cleepcli-1.48.1}/bin/cleep-cli +8 -2
  5. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/cleepapi.py +26 -0
  6. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/version.py +1 -1
  7. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/watch.py +6 -0
  8. {cleepcli-1.48.0 → cleepcli-1.48.1/cleepcli.egg-info}/PKG-INFO +8 -8
  9. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli.egg-info/requires.txt +5 -5
  10. cleepcli-1.48.1/requirements.txt +18 -0
  11. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_file_sync_all.py +12 -2
  12. cleepcli-1.48.0/requirements.txt +0 -15
  13. {cleepcli-1.48.0 → cleepcli-1.48.1}/LICENSE +0 -0
  14. {cleepcli-1.48.0 → cleepcli-1.48.1}/MANIFEST.in +0 -0
  15. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/__init__.py +0 -0
  16. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/check.py +0 -0
  17. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/ci.py +0 -0
  18. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/config.py +0 -0
  19. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/console.py +0 -0
  20. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/docs.py +0 -0
  21. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/file.py +0 -0
  22. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/git.py +0 -0
  23. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/module.py +0 -0
  24. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/package.py +0 -0
  25. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/systemd/cleep-watch.service +0 -0
  26. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/test.py +0 -0
  27. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/tools.py +0 -0
  28. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli/watchsvc.py +0 -0
  29. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli.egg-info/SOURCES.txt +0 -0
  30. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli.egg-info/dependency_links.txt +0 -0
  31. {cleepcli-1.48.0 → cleepcli-1.48.1}/cleepcli.egg-info/top_level.txt +0 -0
  32. {cleepcli-1.48.0 → cleepcli-1.48.1}/pyproject.toml +0 -0
  33. {cleepcli-1.48.0 → cleepcli-1.48.1}/setup.cfg +0 -0
  34. {cleepcli-1.48.0 → cleepcli-1.48.1}/setup.py +0 -0
  35. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_check.py +0 -0
  36. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_config.py +0 -0
  37. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_console.py +0 -0
  38. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_coverage.py +0 -0
  39. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_docs_breaking.py +0 -0
  40. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_module_scaffold.py +0 -0
  41. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_watch.py +0 -0
  42. {cleepcli-1.48.0 → cleepcli-1.48.1}/tests/test_watchsvc.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cleepcli
3
- Version: 1.48.0
3
+ Version: 1.48.1
4
4
  Summary: Cleep-cli helps developers to build great Cleep applications from command line.
5
5
  Home-page: https://github.com/CleepDevice/cleep-cli
6
6
  Author: Tanguy Bonneau
@@ -17,11 +17,11 @@ Requires-Dist: sphinx-rtd-theme>=1.0.0
17
17
  Requires-Dist: CProfileV>=1.0.7
18
18
  Requires-Dist: PyGithub==1.54.1
19
19
  Requires-Dist: pylint<3.0.0,>=2.11.1
20
- Requires-Dist: semver==3.0.0
21
- Requires-Dist: coverage==7.2.7
22
- Requires-Dist: passlib==1.7.4
23
- Requires-Dist: requests==2.31.0
24
- Requires-Dist: psutil==5.9.4
20
+ Requires-Dist: semver<4.0.0,>=3.0.0
21
+ Requires-Dist: coverage<8.0.0,>=7.2.7
22
+ Requires-Dist: passlib<2.0.0,>=1.7.4
23
+ Requires-Dist: requests<3.0.0,>=2.32.5
24
+ Requires-Dist: psutil<8.0.0,>=5.9.4
25
25
  Dynamic: author
26
26
  Dynamic: author-email
27
27
  Dynamic: description
@@ -63,7 +63,7 @@ This utility helps developers to build Cleep applications providing some useful
63
63
  - Watch commands:
64
64
  - `watch` to watch for repository filesystem changes and automatically update files on execution folders. It also restart backend or/and frontend according to changes (catch-up sync on start).
65
65
  - `watchsvc` to install/enable/disable/restart the durable `cleep-watch` systemd unit (runs `watch` outside `cleep.service`).
66
- - `syncall` to force a one-shot sync of core + all modules (same catch-up as watch start).
66
+ - `syncall` to force a one-shot sync of core + all modules, disable static cache, and reload the UI.
67
67
  - Misc commands:
68
68
  - `version` to get cleep-cli version
69
69
 
@@ -96,7 +96,7 @@ cleep-cli watchsvc enable
96
96
 
97
97
  The unit runs `cleep-cli watch`, survives `systemctl restart cleep`, and on each start performs a catch-up `syncall` so files written while the watcher was down are applied.
98
98
 
99
- Manual one-shot resync (when the UI looks stale):
99
+ Manual one-shot resync (when the UI looks stale) — `syncall` also mints a fresh asset bust and reloads the device UI:
100
100
 
101
101
  ```
102
102
  cleep-cli syncall
@@ -27,7 +27,7 @@ This utility helps developers to build Cleep applications providing some useful
27
27
  - Watch commands:
28
28
  - `watch` to watch for repository filesystem changes and automatically update files on execution folders. It also restart backend or/and frontend according to changes (catch-up sync on start).
29
29
  - `watchsvc` to install/enable/disable/restart the durable `cleep-watch` systemd unit (runs `watch` outside `cleep.service`).
30
- - `syncall` to force a one-shot sync of core + all modules (same catch-up as watch start).
30
+ - `syncall` to force a one-shot sync of core + all modules, disable static cache, and reload the UI.
31
31
  - Misc commands:
32
32
  - `version` to get cleep-cli version
33
33
 
@@ -60,7 +60,7 @@ cleep-cli watchsvc enable
60
60
 
61
61
  The unit runs `cleep-cli watch`, survives `systemctl restart cleep`, and on each start performs a catch-up `syncall` so files written while the watcher was down are applied.
62
62
 
63
- Manual one-shot resync (when the UI looks stale):
63
+ Manual one-shot resync (when the UI looks stale) — `syncall` also mints a fresh asset bust and reloads the device UI:
64
64
 
65
65
  ```
66
66
  cleep-cli syncall
@@ -114,12 +114,18 @@ def syncall():
114
114
  """
115
115
  Synchronize core and all modules from /root/cleep-dev to execution folders.
116
116
 
117
- Same catch-up used when cleep-watch.service starts. Safe one-shot resync when
118
- the UI looks stale: run this, then reload the device page.
117
+ Same catch-up used when cleep-watch.service starts. Also disables frontend
118
+ static cache, mints a new asset bust, and reloads the UI so the device page
119
+ cannot keep stale JS.
119
120
  """
121
+ from cleepcli.cleepapi import CleepApi
122
+
120
123
  f = File()
121
124
  if not f.sync_all():
122
125
  sys.exit(1)
126
+ api = CleepApi(None)
127
+ api.ensure_frontend_nocache()
128
+ api.restart_frontend()
123
129
 
124
130
  @core.command()
125
131
  @click.option('--coverage', is_flag=True, help='Display coverage report.')
@@ -114,12 +114,18 @@ def syncall():
114
114
  """
115
115
  Synchronize core and all modules from /root/cleep-dev to execution folders.
116
116
 
117
- Same catch-up used when cleep-watch.service starts. Safe one-shot resync when
118
- the UI looks stale: run this, then reload the device page.
117
+ Same catch-up used when cleep-watch.service starts. Also disables frontend
118
+ static cache, mints a new asset bust, and reloads the UI so the device page
119
+ cannot keep stale JS.
119
120
  """
121
+ from cleepcli.cleepapi import CleepApi
122
+
120
123
  f = File()
121
124
  if not f.sync_all():
122
125
  sys.exit(1)
126
+ api = CleepApi(None)
127
+ api.ensure_frontend_nocache()
128
+ api.restart_frontend()
123
129
 
124
130
  @core.command()
125
131
  @click.option('--coverage', is_flag=True, help='Display coverage report.')
@@ -243,6 +243,32 @@ class CleepApi():
243
243
  return False
244
244
  return True
245
245
 
246
+ def ensure_frontend_nocache(self):
247
+ """
248
+ Disable RPC static cache and mint a fresh asset bust token.
249
+
250
+ Safe to call repeatedly; used after syncall / frontend watch batches so
251
+ the browser cannot keep stale core or module JS.
252
+ """
253
+ data = {
254
+ 'to': 'inventory',
255
+ 'command': 'bump_rpc_asset_cache',
256
+ 'params': {},
257
+ }
258
+ result = self.__post(self.command_url, data)
259
+ if not result or result[0] != 200:
260
+ # Older cores only expose set_rpc_cache_control
261
+ data = {
262
+ 'to': 'inventory',
263
+ 'command': 'set_rpc_cache_control',
264
+ 'params': {'cache_enabled': False},
265
+ }
266
+ result = self.__post(self.command_url, data)
267
+ if not result or result[0] != 200:
268
+ self.logger.debug('Unable to disable frontend static cache')
269
+ return False
270
+ return True
271
+
246
272
  def notify_sync_started(self):
247
273
  """
248
274
  Tell the developer UI a watch sync is starting.
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
- VERSION = "1.48.0"
4
+ VERSION = "1.48.1"
@@ -165,6 +165,9 @@ class ActionsExecutor(Thread):
165
165
  self.logger.error("Sync failed, Cleep was not restarted")
166
166
  self.cleep.notify_sync_failed()
167
167
  return
168
+ # Always mint a fresh asset bust before UI reload so Chrome/Electron
169
+ # cannot reuse ?cleepversion / max-age=3600 core scripts.
170
+ self.cleep.ensure_frontend_nocache()
168
171
  if batch.backend:
169
172
  # Backend restart drops the UI connection. The page reloads on its own
170
173
  # once Cleep answers again, with the frontend files already synced.
@@ -563,6 +566,9 @@ class CleepWatchdog:
563
566
  WATCH_SERVICE,
564
567
  )
565
568
  return False
569
+ # Files may have landed while Cleep/UI were up with an old bust token.
570
+ self.actions_executor.cleep.ensure_frontend_nocache()
571
+ self.actions_executor.cleep.restart_frontend()
566
572
 
567
573
  self.actions_executor.start()
568
574
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cleepcli
3
- Version: 1.48.0
3
+ Version: 1.48.1
4
4
  Summary: Cleep-cli helps developers to build great Cleep applications from command line.
5
5
  Home-page: https://github.com/CleepDevice/cleep-cli
6
6
  Author: Tanguy Bonneau
@@ -17,11 +17,11 @@ Requires-Dist: sphinx-rtd-theme>=1.0.0
17
17
  Requires-Dist: CProfileV>=1.0.7
18
18
  Requires-Dist: PyGithub==1.54.1
19
19
  Requires-Dist: pylint<3.0.0,>=2.11.1
20
- Requires-Dist: semver==3.0.0
21
- Requires-Dist: coverage==7.2.7
22
- Requires-Dist: passlib==1.7.4
23
- Requires-Dist: requests==2.31.0
24
- Requires-Dist: psutil==5.9.4
20
+ Requires-Dist: semver<4.0.0,>=3.0.0
21
+ Requires-Dist: coverage<8.0.0,>=7.2.7
22
+ Requires-Dist: passlib<2.0.0,>=1.7.4
23
+ Requires-Dist: requests<3.0.0,>=2.32.5
24
+ Requires-Dist: psutil<8.0.0,>=5.9.4
25
25
  Dynamic: author
26
26
  Dynamic: author-email
27
27
  Dynamic: description
@@ -63,7 +63,7 @@ This utility helps developers to build Cleep applications providing some useful
63
63
  - Watch commands:
64
64
  - `watch` to watch for repository filesystem changes and automatically update files on execution folders. It also restart backend or/and frontend according to changes (catch-up sync on start).
65
65
  - `watchsvc` to install/enable/disable/restart the durable `cleep-watch` systemd unit (runs `watch` outside `cleep.service`).
66
- - `syncall` to force a one-shot sync of core + all modules (same catch-up as watch start).
66
+ - `syncall` to force a one-shot sync of core + all modules, disable static cache, and reload the UI.
67
67
  - Misc commands:
68
68
  - `version` to get cleep-cli version
69
69
 
@@ -96,7 +96,7 @@ cleep-cli watchsvc enable
96
96
 
97
97
  The unit runs `cleep-cli watch`, survives `systemctl restart cleep`, and on each start performs a catch-up `syncall` so files written while the watcher was down are applied.
98
98
 
99
- Manual one-shot resync (when the UI looks stale):
99
+ Manual one-shot resync (when the UI looks stale) — `syncall` also mints a fresh asset bust and reloads the device UI:
100
100
 
101
101
  ```
102
102
  cleep-cli syncall
@@ -5,8 +5,8 @@ sphinx-rtd-theme>=1.0.0
5
5
  CProfileV>=1.0.7
6
6
  PyGithub==1.54.1
7
7
  pylint<3.0.0,>=2.11.1
8
- semver==3.0.0
9
- coverage==7.2.7
10
- passlib==1.7.4
11
- requests==2.31.0
12
- psutil==5.9.4
8
+ semver<4.0.0,>=3.0.0
9
+ coverage<8.0.0,>=7.2.7
10
+ passlib<2.0.0,>=1.7.4
11
+ requests<3.0.0,>=2.32.5
12
+ psutil<8.0.0,>=5.9.4
@@ -0,0 +1,18 @@
1
+ # CLI-only
2
+ Click>=8.0,<9.0
3
+ watchdog>=3.0.0,<4.0.0
4
+ Sphinx>=5.0.0,<6.0.0
5
+ sphinx-rtd-theme>=1.0.0
6
+ CProfileV>=1.0.7
7
+ # Force version due to pynacl package introduced in 1.55 that makes 15-20 mins to build on raspi
8
+ # This package seems useful only for github actions we are not using.
9
+ PyGithub==1.54.1
10
+ pylint>=2.11.1,<3.0.0
11
+ semver>=3.0.0,<4.0.0
12
+
13
+ # Shared with the Cleep device env — permissive ranges only.
14
+ # Exact pins are owned by Cleep (requests, passlib, coverage) or cleepapp-system (psutil).
15
+ coverage>=7.2.7,<8.0.0
16
+ passlib>=1.7.4,<2.0.0
17
+ requests>=2.32.5,<3.0.0
18
+ psutil>=5.9.4,<8.0.0
@@ -57,17 +57,22 @@ def test_watch_catch_up_calls_sync_all():
57
57
  "cleepcli.watch.CleepHandler"
58
58
  ) as handler_cls, patch(
59
59
  "cleepcli.watch.ActionsExecutor"
60
- ), patch(
60
+ ) as executor_cls, patch(
61
61
  "cleepcli.watch.time.sleep", side_effect=KeyboardInterrupt
62
62
  ):
63
63
  file_cls.return_value.sync_all.return_value = True
64
64
  handler = handler_cls.return_value
65
65
  handler._watched = {"/tmp"}
66
66
  handler.schedule_all = Mock()
67
+ executor = executor_cls.return_value
68
+ executor.cleep.ensure_frontend_nocache = Mock(return_value=True)
69
+ executor.cleep.restart_frontend = Mock(return_value=True)
67
70
 
68
71
  watchdog = CleepWatchdog("https://127.0.0.1:443", catch_up=True)
69
72
  assert watchdog.watch() is True
70
73
  file_cls.return_value.sync_all.assert_called_once_with()
74
+ executor.cleep.ensure_frontend_nocache.assert_called_once_with()
75
+ executor.cleep.restart_frontend.assert_called_once_with()
71
76
 
72
77
 
73
78
  def test_watch_skip_catch_up():
@@ -79,13 +84,18 @@ def test_watch_skip_catch_up():
79
84
  "cleepcli.watch.CleepHandler"
80
85
  ) as handler_cls, patch(
81
86
  "cleepcli.watch.ActionsExecutor"
82
- ), patch(
87
+ ) as executor_cls, patch(
83
88
  "cleepcli.watch.time.sleep", side_effect=KeyboardInterrupt
84
89
  ):
85
90
  handler = handler_cls.return_value
86
91
  handler._watched = {"/tmp"}
87
92
  handler.schedule_all = Mock()
93
+ executor = executor_cls.return_value
94
+ executor.cleep.ensure_frontend_nocache = Mock()
95
+ executor.cleep.restart_frontend = Mock()
88
96
 
89
97
  watchdog = CleepWatchdog("https://127.0.0.1:443", catch_up=False)
90
98
  assert watchdog.watch() is True
91
99
  file_cls.return_value.sync_all.assert_not_called()
100
+ executor.cleep.ensure_frontend_nocache.assert_not_called()
101
+ executor.cleep.restart_frontend.assert_not_called()
@@ -1,15 +0,0 @@
1
- Click>=8.0,<9.0
2
- watchdog>=3.0.0,<4.0.0
3
- Sphinx>=5.0.0,<6.0.0
4
- sphinx-rtd-theme>=1.0.0
5
- CProfileV>=1.0.7
6
- # Force version due to pynacl package introduced in 1.55 that makes 15-20 mins to build on raspi
7
- # This package seems useful only for github actions we are not using.
8
- PyGithub==1.54.1
9
- pylint>=2.11.1,<3.0.0
10
- semver==3.0.0
11
- # Make sure deps below match with cleep ones
12
- coverage==7.2.7
13
- passlib==1.7.4
14
- requests==2.31.0
15
- psutil==5.9.4
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