deepctl-plugin-example 0.1.0__py3-none-any.whl

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,6 @@
1
+ """Example plugin package for deepctl."""
2
+
3
+ from .command import ExampleCommand
4
+ from .models import ExampleResult
5
+
6
+ __all__ = ["ExampleCommand", "ExampleResult"]
@@ -0,0 +1,161 @@
1
+ """Example plugin command for deepctl."""
2
+
3
+ from typing import Any
4
+
5
+ from deepctl_core import AuthManager, BaseCommand, Config, DeepgramClient
6
+ from rich.console import Console
7
+ from rich.panel import Panel
8
+ from rich.table import Table
9
+
10
+ console = Console()
11
+
12
+
13
+ class ExampleCommand(BaseCommand):
14
+ """Example plugin command demonstrating the plugin system."""
15
+
16
+ name = "example"
17
+ help = "Example plugin command demonstrating the plugin system"
18
+ short_help = "Example plugin command"
19
+
20
+ # This example command doesn't require authentication
21
+ requires_auth = False
22
+ requires_project = False
23
+ ci_friendly = True
24
+
25
+ def get_arguments(self) -> list[dict[str, Any]]:
26
+ """Get command arguments and options."""
27
+ return [
28
+ {
29
+ "names": ["--greeting", "-g"],
30
+ "help": "Custom greeting message",
31
+ "type": str,
32
+ "default": "Hello",
33
+ "required": False,
34
+ "is_option": True,
35
+ },
36
+ {
37
+ "names": ["--name", "-n"],
38
+ "help": "Name to greet",
39
+ "type": str,
40
+ "default": "World",
41
+ "required": False,
42
+ "is_option": True,
43
+ },
44
+ {
45
+ "names": ["--show-info"],
46
+ "help": "Show plugin system information",
47
+ "is_flag": True,
48
+ "is_option": True,
49
+ },
50
+ ]
51
+
52
+ def handle(
53
+ self,
54
+ config: Config,
55
+ auth_manager: AuthManager,
56
+ client: DeepgramClient,
57
+ **kwargs: Any,
58
+ ) -> Any:
59
+ """Handle the example command."""
60
+ greeting = kwargs.get("greeting", "Hello")
61
+ name = kwargs.get("name", "World")
62
+ show_info = kwargs.get("show_info", False)
63
+
64
+ # Show plugin information if requested
65
+ if show_info:
66
+ # Display greeting
67
+ console.print(f"\n[bold blue]{greeting}, {name}![/bold blue]\n")
68
+ self._show_plugin_info()
69
+ # Return None to avoid additional output
70
+ return None
71
+
72
+ # For normal operation, return structured data for output formatting
73
+ # Don't print directly unless in help mode
74
+ if kwargs.get("help_mode", False):
75
+ self._show_help()
76
+ return None
77
+
78
+ # Return result for output formatting
79
+ from .models import ExampleResult
80
+
81
+ return ExampleResult(
82
+ message=f"{greeting}, {name}!",
83
+ plugin="deepctl-plugin-example",
84
+ version="0.1.0",
85
+ greeting=greeting,
86
+ name=name,
87
+ )
88
+
89
+ def _show_help(self) -> None:
90
+ """Show help information about the plugin."""
91
+ # Create help panel
92
+ help_content = """
93
+ This is an example plugin for deepctl demonstrating how to create
94
+ custom commands that integrate seamlessly with the CLI.
95
+
96
+ [bold]Usage:[/bold]
97
+ deepctl example [OPTIONS]
98
+
99
+ [bold]Options:[/bold]
100
+ -g, --greeting TEXT Custom greeting message [default: Hello]
101
+ -n, --name TEXT Name to greet [default: World]
102
+ --show-info Show plugin system information
103
+
104
+ [bold]Examples:[/bold]
105
+ # Basic usage
106
+ deepctl example
107
+
108
+ # Custom greeting
109
+ deepctl example --greeting "Howdy" --name "Partner"
110
+
111
+ # Show plugin info
112
+ deepctl example --show-info
113
+ """
114
+
115
+ panel = Panel(
116
+ help_content.strip(),
117
+ title="[bold]Example Plugin Help[/bold]",
118
+ border_style="blue",
119
+ padding=(1, 2),
120
+ )
121
+ console.print(panel)
122
+
123
+ def _show_plugin_info(self) -> None:
124
+ """Show information about the plugin system."""
125
+ console.print("[bold]Plugin System Information[/bold]\n")
126
+
127
+ # Create info table
128
+ table = Table(show_header=True, header_style="bold blue")
129
+ table.add_column("Property", style="cyan")
130
+ table.add_column("Value")
131
+
132
+ table.add_row("Plugin Name", "deepctl-plugin-example")
133
+ table.add_row("Version", "0.1.0")
134
+ table.add_row("Command Name", self.name)
135
+ table.add_row("Entry Point", "deepctl.commands")
136
+ table.add_row("Base Class", "deepctl_core.BaseCommand")
137
+ table.add_row("Requires Auth", str(self.requires_auth))
138
+ table.add_row("Requires Project", str(self.requires_project))
139
+
140
+ console.print(table)
141
+ console.print()
142
+
143
+ # Show how plugin loading works
144
+ info_panel = Panel(
145
+ """[bold]How Plugin Loading Works:[/bold]
146
+
147
+ 1. Plugins register via entry points in pyproject.toml
148
+ 2. The CLI's PluginManager discovers them at runtime
149
+ 3. Plugins must inherit from BaseCommand
150
+ 4. When installed alongside the CLI, they become available
151
+
152
+ To create your own plugin:
153
+ - Copy this example package
154
+ - Modify the command class
155
+ - Update pyproject.toml metadata
156
+ - Install with: pip install -e ./your-plugin/""",
157
+ title="[bold]Plugin Development Guide[/bold]",
158
+ border_style="green",
159
+ padding=(1, 2),
160
+ )
161
+ console.print(info_panel)
@@ -0,0 +1,13 @@
1
+ """Data models for the example plugin."""
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class ExampleResult(BaseModel):
7
+ """Result model for the example command."""
8
+
9
+ message: str
10
+ plugin: str
11
+ version: str
12
+ greeting: str | None = None
13
+ name: str | None = None
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepctl-plugin-example
3
+ Version: 0.1.0
4
+ Summary: Example plugin for deepctl
5
+ Author-email: Deepgram <devrel@deepgram.com>
6
+ Maintainer-email: Deepgram <devrel@deepgram.com>
7
+ License-Expression: MIT
8
+ Keywords: deepgram,cli,plugin,example
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
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: deepctl-core
18
+ Requires-Dist: click>=8.0.0
19
+ Requires-Dist: rich>=13.0.0
20
+
21
+ # deepctl Plugin Example
22
+
23
+ An example plugin for deepctl demonstrating how to create and distribute custom commands as separate packages.
24
+
25
+ ## Overview
26
+
27
+ This plugin shows how to extend deepctl with custom commands that can be:
28
+
29
+ - Developed independently
30
+ - Distributed via PyPI
31
+ - Installed alongside the CLI
32
+ - Discovered automatically at runtime
33
+
34
+ **Note:** This plugin is NOT a dependency of deepctl. It must be installed separately to demonstrate how the plugin system works for third-party developers. This example plugin is published to PyPI with each deepctl release to ensure the documentation is always testable.
35
+
36
+ ## Installation
37
+
38
+ ### Development Installation
39
+
40
+ To install the plugin in development mode:
41
+
42
+ ```bash
43
+ # From the plugin directory
44
+ pip install -e .
45
+
46
+ # Or using uv
47
+ uv pip install -e .
48
+ ```
49
+
50
+ ### Production Installation
51
+
52
+ For users who have deepctl installed globally:
53
+
54
+ ```bash
55
+ # Recommended: Using pipx (if deepctl was installed with pipx)
56
+ pipx install deepctl # If not already installed
57
+ pipx inject deepctl deepctl-plugin-example
58
+
59
+ # Alternative: Using pip (only works in development environments)
60
+ pip install deepctl deepctl-plugin-example
61
+ ```
62
+
63
+ **Note:** If you installed deepctl with `uv tool install`, plugin installation requires manual workarounds. We recommend using pipx for the best plugin experience.
64
+
65
+ ## Usage
66
+
67
+ Once installed, the plugin command becomes available in the CLI:
68
+
69
+ ```bash
70
+ # Basic usage
71
+ deepctl example
72
+
73
+ # Custom greeting
74
+ deepctl example --greeting "Howdy" --name "Partner"
75
+
76
+ # Show plugin system information
77
+ deepctl example --show-info
78
+ ```
79
+
80
+ ## How It Works
81
+
82
+ 1. **Entry Point Registration**: The plugin registers itself via the `deepctl.plugins` entry point in `pyproject.toml`
83
+ 2. **Command Discovery**: The CLI's PluginManager discovers the plugin at runtime using `importlib.metadata`
84
+ 3. **Command Loading**: The plugin's command class is instantiated and added to the CLI
85
+ 4. **Execution**: When the user runs the command, the plugin's `handle()` method is called
86
+
87
+ ## Creating Your Own Plugin
88
+
89
+ To create your own deepctl plugin:
90
+
91
+ 1. **Copy this example package** as a starting point
92
+ 2. **Rename the package** and update metadata in `pyproject.toml`
93
+ 3. **Implement your command** by modifying the `command.py` file
94
+ 4. **Define arguments** in the `get_arguments()` method
95
+ 5. **Implement logic** in the `handle()` method
96
+ 6. **Test locally** with `pip install -e .`
97
+ 7. **Publish to PyPI** when ready
98
+ 8. **Users install it** with `pipx inject deepctl your-plugin-name`
99
+
100
+ ### Key Requirements
101
+
102
+ - Must inherit from `deepctl_core.BaseCommand`
103
+ - Must implement required properties: `name`, `help`
104
+ - Must implement `handle()` method
105
+ - Must be registered via entry point
106
+
107
+ ### Example Command Structure
108
+
109
+ ```python
110
+ from deepctl_core import BaseCommand
111
+
112
+ class MyCommand(BaseCommand):
113
+ name = "mycommand"
114
+ help = "Description of my command"
115
+
116
+ def handle(self, config, auth_manager, client, **kwargs):
117
+ # Your command logic here
118
+ pass
119
+ ```
120
+
121
+ ## Development
122
+
123
+ ### Running Tests
124
+
125
+ ```bash
126
+ uv run pytest
127
+ ```
128
+
129
+ ### Building the Package
130
+
131
+ ```bash
132
+ python -m build
133
+ ```
134
+
135
+ ## Plugin Capabilities
136
+
137
+ Plugins have access to:
138
+
139
+ - Configuration management via `Config`
140
+ - Authentication via `AuthManager`
141
+ - Deepgram API client via `DeepgramClient`
142
+ - Rich terminal output via `rich`
143
+ - Command-line argument parsing via `click`
144
+
145
+ ## License
146
+
147
+ MIT
@@ -0,0 +1,8 @@
1
+ deepctl_plugin_example/__init__.py,sha256=AnwY75aFeXi-NiIw37WN4eQdTQ9r4U-Y_OITWEMEBsA,160
2
+ deepctl_plugin_example/command.py,sha256=X3CMw_5IYWoDb3LP3JEYoGUY3WWn5CjG7f2OjFljkdk,5016
3
+ deepctl_plugin_example/models.py,sha256=C7a-bfBNPuzYuTQJ6or51ViqgWjD73xzCbWZn8px4gU,267
4
+ deepctl_plugin_example-0.1.0.dist-info/METADATA,sha256=mcQ2-73xMpVDtwJKIoJeXojhexP7p_UA0BzPGflReUc,4054
5
+ deepctl_plugin_example-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ deepctl_plugin_example-0.1.0.dist-info/entry_points.txt,sha256=t14ZnFsfjxlXf_f32q-vx9ZSqNNDwi1MxTtkBMVJJAk,74
7
+ deepctl_plugin_example-0.1.0.dist-info/top_level.txt,sha256=HFzBg8VDfBdYp4pBirFQzVG12LOxaOIFWd28A9UeIK4,23
8
+ deepctl_plugin_example-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [deepctl.plugins]
2
+ example = deepctl_plugin_example.command:ExampleCommand
@@ -0,0 +1 @@
1
+ deepctl_plugin_example