deepctl-cmd-update 0.1.7__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.
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepctl-cmd-update
3
+ Version: 0.1.7
4
+ Summary: Update command for deepctl
5
+ Author-email: Deepgram <devrel@deepgram.com>
6
+ Maintainer-email: Deepgram <devrel@deepgram.com>
7
+ License-Expression: MIT
8
+ Keywords: deepgram,cli,update,self-update
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: deepctl-core>=0.1.7
19
+ Requires-Dist: click>=8.0.0
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: rich>=13.0.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
24
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
25
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
26
+ Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
27
+
28
+ # deepctl-cmd-update
29
+
30
+ Update command for deepctl CLI - provides self-update functionality.
31
+
32
+ ## Features
33
+
34
+ - Check for newer versions on PyPI
35
+ - Detect installation method (pip, pipx, uv, system, development)
36
+ - Remember installation method for future updates
37
+ - Provide appropriate update commands
38
+ - Support for various installation scenarios
39
+
40
+ ## Installation
41
+
42
+ This package is included with deepctl and doesn't need separate installation.
43
+
44
+ ## Usage
45
+
46
+ Check for updates:
47
+
48
+ ```bash
49
+ deepctl update --check-only
50
+ ```
51
+
52
+ Update deepctl:
53
+
54
+ ```bash
55
+ deepctl update
56
+ ```
57
+
58
+ Force update (even if already up to date):
59
+
60
+ ```bash
61
+ deepctl update --force
62
+ ```
63
+
64
+ Skip confirmation:
65
+
66
+ ```bash
67
+ deepctl update --yes
68
+ ```
69
+
70
+ ## Development
71
+
72
+ This package is part of the deepctl monorepo. See the main repository for development instructions.
@@ -0,0 +1,45 @@
1
+ # deepctl-cmd-update
2
+
3
+ Update command for deepctl CLI - provides self-update functionality.
4
+
5
+ ## Features
6
+
7
+ - Check for newer versions on PyPI
8
+ - Detect installation method (pip, pipx, uv, system, development)
9
+ - Remember installation method for future updates
10
+ - Provide appropriate update commands
11
+ - Support for various installation scenarios
12
+
13
+ ## Installation
14
+
15
+ This package is included with deepctl and doesn't need separate installation.
16
+
17
+ ## Usage
18
+
19
+ Check for updates:
20
+
21
+ ```bash
22
+ deepctl update --check-only
23
+ ```
24
+
25
+ Update deepctl:
26
+
27
+ ```bash
28
+ deepctl update
29
+ ```
30
+
31
+ Force update (even if already up to date):
32
+
33
+ ```bash
34
+ deepctl update --force
35
+ ```
36
+
37
+ Skip confirmation:
38
+
39
+ ```bash
40
+ deepctl update --yes
41
+ ```
42
+
43
+ ## Development
44
+
45
+ This package is part of the deepctl monorepo. See the main repository for development instructions.
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "deepctl-cmd-update"
7
+ version = "0.1.7"
8
+ description = "Update command for deepctl"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ authors = [{ name = "Deepgram", email = "devrel@deepgram.com" }]
12
+ maintainers = [{ name = "Deepgram", email = "devrel@deepgram.com" }]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Topic :: Software Development :: Libraries :: Python Modules",
21
+ ]
22
+ keywords = ["deepgram", "cli", "update", "self-update"]
23
+ requires-python = ">=3.10"
24
+ dependencies = [
25
+ "deepctl-core>=0.1.7",
26
+ "click>=8.0.0",
27
+ "pydantic>=2.0.0",
28
+ "rich>=13.0.0",
29
+ ]
30
+
31
+ [project.entry-points."deepctl.commands"]
32
+ update = "deepctl_cmd_update.command:UpdateCommand"
33
+
34
+ [project.optional-dependencies]
35
+ dev = [
36
+ "pytest>=7.0.0",
37
+ "pytest-asyncio>=0.21.0",
38
+ "pytest-cov>=4.0.0",
39
+ "pytest-mock>=3.10.0",
40
+ ]
41
+
42
+ [tool.setuptools]
43
+ package-dir = { "" = "src" }
44
+
45
+ [tool.setuptools.packages.find]
46
+ where = ["src"]
47
+ include = ["deepctl_cmd_update*"]
48
+
49
+ [tool.uv.sources]
50
+ deepctl-core = { workspace = true }
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """Update command for deepctl."""
2
+
3
+ from .command import UpdateCommand
4
+
5
+ __all__ = ["UpdateCommand"]
@@ -0,0 +1,226 @@
1
+ """Update command implementation."""
2
+
3
+ import asyncio
4
+ import subprocess
5
+ from typing import Any, Dict
6
+ from deepctl_core import (
7
+ BaseCommand,
8
+ Config,
9
+ InstallationDetector,
10
+ VersionChecker,
11
+ format_version_message,
12
+ get_console,
13
+ print_error,
14
+ print_info,
15
+ print_success,
16
+ print_warning,
17
+ )
18
+ from rich.panel import Panel
19
+ from rich.prompt import Confirm
20
+
21
+ from .models import UpdateResult
22
+
23
+
24
+ class UpdateCommand(BaseCommand):
25
+ """Check for and install updates."""
26
+
27
+ name = "update"
28
+ help = "Check for and install updates to deepctl"
29
+ requires_auth = False # Update command doesn't need authentication
30
+
31
+ def get_arguments(self) -> list[dict[str, Any]]:
32
+ """Get command arguments and options."""
33
+ return [
34
+ {
35
+ "names": ["--check-only"],
36
+ "help": "Only check for updates without installing",
37
+ "is_flag": True,
38
+ "is_option": True,
39
+ },
40
+ {
41
+ "names": ["--force"],
42
+ "help": "Force update even if already up to date",
43
+ "is_flag": True,
44
+ "is_option": True,
45
+ },
46
+ {
47
+ "names": ["--yes", "-y"],
48
+ "help": "Skip confirmation prompt",
49
+ "is_flag": True,
50
+ "is_option": True,
51
+ },
52
+ ]
53
+
54
+ def handle(
55
+ self,
56
+ config: Config,
57
+ auth_manager: Any, # Not used for update command
58
+ client: Any, # Not used for update command
59
+ **kwargs: Any,
60
+ ) -> Dict[str, Any]:
61
+ """Handle the update command execution."""
62
+ console = get_console()
63
+
64
+ # Extract arguments from kwargs
65
+ check_only = kwargs.get("check_only", False)
66
+ force = kwargs.get("force", False)
67
+ yes = kwargs.get("yes", False)
68
+
69
+ # Initialize version checker
70
+ # Get current version from package metadata if possible
71
+ try:
72
+ import deepctl
73
+ current_version = getattr(deepctl, "__version__", "0.1.5")
74
+ except ImportError:
75
+ current_version = "0.1.5"
76
+
77
+ version_checker = VersionChecker(config, current_version)
78
+
79
+ # Check for updates
80
+ with console.status("Checking for updates..."):
81
+ try:
82
+ version_info = asyncio.run(
83
+ version_checker.check_version(force=True))
84
+ except Exception as e:
85
+ print_error(f"Failed to check for updates: {e}")
86
+ return UpdateResult(
87
+ success=False,
88
+ message=f"Failed to check for updates: {e}",
89
+ ).model_dump()
90
+
91
+ # Display version info
92
+ message = format_version_message(version_info)
93
+
94
+ if version_info.update_available:
95
+ console.print(
96
+ Panel(message, title="Update Available", border_style="yellow"))
97
+ else:
98
+ print_success(message)
99
+ if not force:
100
+ return UpdateResult(
101
+ success=True,
102
+ message=message,
103
+ current_version=version_info.current_version,
104
+ latest_version=version_info.latest_version,
105
+ update_available=False,
106
+ ).model_dump()
107
+
108
+ # If check-only, stop here
109
+ if check_only:
110
+ return UpdateResult(
111
+ success=True,
112
+ message=message,
113
+ current_version=version_info.current_version,
114
+ latest_version=version_info.latest_version,
115
+ update_available=version_info.update_available,
116
+ ).model_dump()
117
+
118
+ # Detect installation method
119
+ print_info("Detecting installation method...")
120
+ detector = InstallationDetector()
121
+ install_info = detector.detect()
122
+
123
+ # Store installation info for future use
124
+ config._set_config_value(
125
+ "update.installation_method", install_info.method)
126
+ config._set_config_value("update.installation_path", install_info.path)
127
+ config.save()
128
+
129
+ # Display installation info
130
+ console.print(
131
+ f"Installation method: [cyan]{install_info.method}[/cyan]")
132
+ console.print(f"Installation path: [dim]{install_info.path}[/dim]")
133
+ if install_info.virtual_env:
134
+ console.print("[yellow]Virtual environment detected[/yellow]")
135
+
136
+ # Get update command
137
+ update_command = detector.get_update_command(install_info.method)
138
+
139
+ if not update_command:
140
+ # Special handling for system/development installations
141
+ instructions = detector.get_update_instructions(install_info)
142
+ print_warning(instructions)
143
+ return UpdateResult(
144
+ success=False,
145
+ message=instructions,
146
+ current_version=version_info.current_version,
147
+ latest_version=version_info.latest_version,
148
+ update_available=version_info.update_available,
149
+ installation_method=install_info.method,
150
+ ).model_dump()
151
+
152
+ # Show update command
153
+ console.print(f"\nUpdate command: [green]{update_command}[/green]")
154
+
155
+ # Confirm update
156
+ if not yes:
157
+ if not Confirm.ask("\nDo you want to proceed with the update?"):
158
+ print_info("Update cancelled")
159
+ return UpdateResult(
160
+ success=False,
161
+ message="Update cancelled by user",
162
+ current_version=version_info.current_version,
163
+ latest_version=version_info.latest_version,
164
+ update_available=version_info.update_available,
165
+ installation_method=install_info.method,
166
+ ).model_dump()
167
+
168
+ # Execute update
169
+ print_info("Updating deepctl...")
170
+ try:
171
+ # Run the update command synchronously
172
+ result = subprocess.run(
173
+ update_command,
174
+ shell=True,
175
+ capture_output=True,
176
+ text=True,
177
+ )
178
+
179
+ if result.returncode == 0:
180
+ print_success(
181
+ f"Successfully updated to version {version_info.latest_version}")
182
+
183
+ # Clear version cache
184
+ config._set_config_value("update.cached_version_info", None)
185
+ config.save()
186
+
187
+ return UpdateResult(
188
+ success=True,
189
+ message=f"Successfully updated to version {version_info.latest_version}",
190
+ current_version=version_info.current_version,
191
+ latest_version=version_info.latest_version,
192
+ update_available=False,
193
+ installation_method=install_info.method,
194
+ ).model_dump()
195
+ else:
196
+ error_msg = result.stderr if result.stderr else "Unknown error"
197
+ print_error(f"Update failed: {error_msg}")
198
+
199
+ # Provide fallback instructions
200
+ print_info("\nYou can try updating manually:")
201
+ console.print(f"[yellow]{update_command}[/yellow]")
202
+
203
+ return UpdateResult(
204
+ success=False,
205
+ message=f"Update failed: {error_msg}",
206
+ current_version=version_info.current_version,
207
+ latest_version=version_info.latest_version,
208
+ update_available=version_info.update_available,
209
+ installation_method=install_info.method,
210
+ ).model_dump()
211
+
212
+ except Exception as e:
213
+ print_error(f"Failed to execute update: {e}")
214
+
215
+ # Provide fallback instructions
216
+ print_info("\nYou can try updating manually:")
217
+ console.print(f"[yellow]{update_command}[/yellow]")
218
+
219
+ return UpdateResult(
220
+ success=False,
221
+ message=f"Failed to execute update: {e}",
222
+ current_version=version_info.current_version,
223
+ latest_version=version_info.latest_version,
224
+ update_available=version_info.update_available,
225
+ installation_method=install_info.method,
226
+ ).model_dump()
@@ -0,0 +1,14 @@
1
+ """Models for update command."""
2
+
3
+ from typing import Optional
4
+
5
+ from deepctl_core import BaseResult
6
+
7
+
8
+ class UpdateResult(BaseResult):
9
+ """Result from update command."""
10
+
11
+ current_version: Optional[str] = None
12
+ latest_version: Optional[str] = None
13
+ update_available: Optional[bool] = None
14
+ installation_method: Optional[str] = None
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepctl-cmd-update
3
+ Version: 0.1.7
4
+ Summary: Update command for deepctl
5
+ Author-email: Deepgram <devrel@deepgram.com>
6
+ Maintainer-email: Deepgram <devrel@deepgram.com>
7
+ License-Expression: MIT
8
+ Keywords: deepgram,cli,update,self-update
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: deepctl-core>=0.1.7
19
+ Requires-Dist: click>=8.0.0
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: rich>=13.0.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
24
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
25
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
26
+ Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
27
+
28
+ # deepctl-cmd-update
29
+
30
+ Update command for deepctl CLI - provides self-update functionality.
31
+
32
+ ## Features
33
+
34
+ - Check for newer versions on PyPI
35
+ - Detect installation method (pip, pipx, uv, system, development)
36
+ - Remember installation method for future updates
37
+ - Provide appropriate update commands
38
+ - Support for various installation scenarios
39
+
40
+ ## Installation
41
+
42
+ This package is included with deepctl and doesn't need separate installation.
43
+
44
+ ## Usage
45
+
46
+ Check for updates:
47
+
48
+ ```bash
49
+ deepctl update --check-only
50
+ ```
51
+
52
+ Update deepctl:
53
+
54
+ ```bash
55
+ deepctl update
56
+ ```
57
+
58
+ Force update (even if already up to date):
59
+
60
+ ```bash
61
+ deepctl update --force
62
+ ```
63
+
64
+ Skip confirmation:
65
+
66
+ ```bash
67
+ deepctl update --yes
68
+ ```
69
+
70
+ ## Development
71
+
72
+ This package is part of the deepctl monorepo. See the main repository for development instructions.
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/deepctl_cmd_update/__init__.py
4
+ src/deepctl_cmd_update/command.py
5
+ src/deepctl_cmd_update/models.py
6
+ src/deepctl_cmd_update.egg-info/PKG-INFO
7
+ src/deepctl_cmd_update.egg-info/SOURCES.txt
8
+ src/deepctl_cmd_update.egg-info/dependency_links.txt
9
+ src/deepctl_cmd_update.egg-info/entry_points.txt
10
+ src/deepctl_cmd_update.egg-info/requires.txt
11
+ src/deepctl_cmd_update.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [deepctl.commands]
2
+ update = deepctl_cmd_update.command:UpdateCommand
@@ -0,0 +1,10 @@
1
+ deepctl-core>=0.1.7
2
+ click>=8.0.0
3
+ pydantic>=2.0.0
4
+ rich>=13.0.0
5
+
6
+ [dev]
7
+ pytest>=7.0.0
8
+ pytest-asyncio>=0.21.0
9
+ pytest-cov>=4.0.0
10
+ pytest-mock>=3.10.0
@@ -0,0 +1 @@
1
+ deepctl_cmd_update