click-extended 0.0.3__tar.gz → 0.0.4__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.
- click_extended-0.0.4/PKG-INFO +253 -0
- click_extended-0.0.4/README.md +190 -0
- click_extended-0.0.4/click_extended.egg-info/PKG-INFO +253 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/pyproject.toml +1 -1
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_argument.py +52 -2
- click_extended-0.0.3/PKG-INFO +0 -101
- click_extended-0.0.3/README.md +0 -38
- click_extended-0.0.3/click_extended.egg-info/PKG-INFO +0 -101
- {click_extended-0.0.3 → click_extended-0.0.4}/AUTHORS.md +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/LICENSE +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended/__init__.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended/errors.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended/types.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended.egg-info/SOURCES.txt +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended.egg-info/dependency_links.txt +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended.egg-info/requires.txt +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/click_extended.egg-info/top_level.txt +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/setup.cfg +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_child_node.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_command.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_env.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_global_node.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_group.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_option.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_parent_node.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_root_node.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_tag.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_transform.py +0 -0
- {click_extended-0.0.3 → click_extended-0.0.4}/tests/test_tree.py +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: click_extended
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: An extension to Click with additional features like automatic async support, aliasing and a modular decorator system.
|
|
5
|
+
Author-email: Marcus Fredriksson <marcus@marcusfredriksson.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Marcus Fredriksson
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/marcusfrdk/click-extended
|
|
29
|
+
Project-URL: Repository, https://github.com/marcusfrdk/click-extended
|
|
30
|
+
Project-URL: Issues, https://github.com/marcusfrdk/click-extended/issues
|
|
31
|
+
Keywords: click,cli,command-line,alias,aliasing,command,group,decorator,terminal,console
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
+
Classifier: Topic :: System :: Shells
|
|
42
|
+
Classifier: Topic :: Utilities
|
|
43
|
+
Classifier: Typing :: Typed
|
|
44
|
+
Requires-Python: >=3.10
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
License-File: LICENSE
|
|
47
|
+
License-File: AUTHORS.md
|
|
48
|
+
Requires-Dist: click>=8.3.0
|
|
49
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
50
|
+
Provides-Extra: build
|
|
51
|
+
Requires-Dist: build; extra == "build"
|
|
52
|
+
Requires-Dist: twine; extra == "build"
|
|
53
|
+
Provides-Extra: dev
|
|
54
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
|
|
57
|
+
Requires-Dist: mypy>=1.18.2; extra == "dev"
|
|
58
|
+
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
60
|
+
Requires-Dist: black>=25.9.0; extra == "dev"
|
|
61
|
+
Requires-Dist: pre-commit>=4.3.0; extra == "dev"
|
|
62
|
+
Dynamic: license-file
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
# Click Extended
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+

|
|
70
|
+

|
|
71
|
+

|
|
72
|
+

|
|
73
|
+

|
|
74
|
+

|
|
75
|
+

|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
|
|
79
|
+
|
|
80
|
+
## Features
|
|
81
|
+
|
|
82
|
+
- **Aliasing**: Add multiple aliases to a group or command.
|
|
83
|
+
- **Async supprt**: Automatically run both synchronous and asynchronous functions.
|
|
84
|
+
- **Extensible decorator API**: Extend the Click decorator API with custom decorators like validators, transformers, and more.
|
|
85
|
+
- **Environment variables**: Automatically validate and inject environment variables into the function.
|
|
86
|
+
- **Fully type-hinted**: The library is fully type-hinted and provides good types for easy development.
|
|
87
|
+
- **Help alias**: The `-h` and `--help` automatically show the help menu unless overridden.
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install click-extended
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Requirements
|
|
96
|
+
|
|
97
|
+
- **Python**: 3.10 or higher
|
|
98
|
+
|
|
99
|
+
## Quick Start
|
|
100
|
+
|
|
101
|
+
### Basic Command
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from click_extended import command, option
|
|
105
|
+
|
|
106
|
+
@command()
|
|
107
|
+
@option("--name", default="World", help="Name to greet")
|
|
108
|
+
@option("--count", type=int, default=1, help="Number of greetings")
|
|
109
|
+
def greet(name: str, count: int):
|
|
110
|
+
"""Greet someone multiple times."""
|
|
111
|
+
for _ in range(count):
|
|
112
|
+
print(f"Hello, {name}!")
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
greet()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
$ python app.py --name Alice --count 3
|
|
120
|
+
Hello, Alice!
|
|
121
|
+
Hello, Alice!
|
|
122
|
+
Hello, Alice!
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Async Support
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import asyncio
|
|
129
|
+
|
|
130
|
+
from click_extended import command, option
|
|
131
|
+
|
|
132
|
+
@command()
|
|
133
|
+
@option("--url", required=True, help="URL to fetch")
|
|
134
|
+
async def fetch(url: str):
|
|
135
|
+
"""Fetch data from a URL asynchronously."""
|
|
136
|
+
await asyncio.sleep(1)
|
|
137
|
+
print(f"Fetched data from {url}")
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
fetch()
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Command Aliases
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from click_extended import command, option
|
|
147
|
+
|
|
148
|
+
@command(aliases=["hi", "hello"])
|
|
149
|
+
@option("--name", default="World")
|
|
150
|
+
def greet(name: str):
|
|
151
|
+
"""Greet someone."""
|
|
152
|
+
print(f"Hello, {name}!")
|
|
153
|
+
|
|
154
|
+
if __name__ == "__main__":
|
|
155
|
+
greet()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
$ python app.py greet --name Alice
|
|
160
|
+
Hello, Alice!
|
|
161
|
+
$ python app.py hi --name Bob
|
|
162
|
+
Hello, Bob!
|
|
163
|
+
$ python app.py hello --name Charlie
|
|
164
|
+
Hello, Charlie!
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Environment Variables
|
|
168
|
+
|
|
169
|
+
Environment variables are automatically loaded from the `.env` file, but as long as the variable is defined in your system environment, it will work.
|
|
170
|
+
|
|
171
|
+
```txt
|
|
172
|
+
API_TOKEN=secret123
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from click_extended import command, option, env
|
|
177
|
+
|
|
178
|
+
@command()
|
|
179
|
+
@option("--token", help="API token")
|
|
180
|
+
@env("API_TOKEN", name="token", required=True)
|
|
181
|
+
def api_call(token: str):
|
|
182
|
+
"""Make an API call with authentication."""
|
|
183
|
+
print(f"Using token: {token[:8]}...")
|
|
184
|
+
|
|
185
|
+
if __name__ == "__main__":
|
|
186
|
+
api_call()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
$ python app.py
|
|
191
|
+
Using token: secret12...
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Value Validation
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from click_extended import command, option, ChildNode
|
|
198
|
+
|
|
199
|
+
class IsPositive(ChildNode):
|
|
200
|
+
"""Validate that a number is positive."""
|
|
201
|
+
|
|
202
|
+
def process(self, value, *args, **kwargs):
|
|
203
|
+
if value <= 0:
|
|
204
|
+
raise ValueError(f"Value must be positive, got {value}")
|
|
205
|
+
|
|
206
|
+
def is_positive(*args, **kwargs):
|
|
207
|
+
"""Validate positive numbers."""
|
|
208
|
+
return IsPositive.as_decorator(*args, **kwargs)
|
|
209
|
+
|
|
210
|
+
@command()
|
|
211
|
+
@option("--count", type=int, required=True)
|
|
212
|
+
@is_positive()
|
|
213
|
+
def process(count: int):
|
|
214
|
+
"""Process a positive number of items."""
|
|
215
|
+
print(f"Processing {count} items")
|
|
216
|
+
|
|
217
|
+
if __name__ == "__main__":
|
|
218
|
+
process()
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
$ python app.py --count 5
|
|
223
|
+
Processing 5 items
|
|
224
|
+
$ python app.py --count -1
|
|
225
|
+
Error: Value must be positive, got -1
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Documentation
|
|
229
|
+
|
|
230
|
+
### Core Concepts
|
|
231
|
+
|
|
232
|
+
- [Commands and Groups](./docs/ROOT_NODE.md) - CLI entry points
|
|
233
|
+
- [Options, Arguments, and Environment Variables](./docs/PARENT_NODE.md) - Parameter sources
|
|
234
|
+
- [Validators and Transformers](./docs/CHILD_NODE.md) - Value processing
|
|
235
|
+
- [Global Nodes](./docs/GLOBAL_NODE.md) - Tree-level operations
|
|
236
|
+
- [Tags](./docs/TAG.md) - Cross-parameter validation
|
|
237
|
+
- [Tree Architecture](./docs/TREE.md) - Internal structure
|
|
238
|
+
|
|
239
|
+
### Guides
|
|
240
|
+
|
|
241
|
+
- [Migrating from Click](./docs/MIGRATING_FROM_CLICK.md) - Upgrade guide
|
|
242
|
+
|
|
243
|
+
## Contributing
|
|
244
|
+
|
|
245
|
+
Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
250
|
+
|
|
251
|
+
## Acknowledgements
|
|
252
|
+
|
|
253
|
+
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Click Extended
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Aliasing**: Add multiple aliases to a group or command.
|
|
20
|
+
- **Async supprt**: Automatically run both synchronous and asynchronous functions.
|
|
21
|
+
- **Extensible decorator API**: Extend the Click decorator API with custom decorators like validators, transformers, and more.
|
|
22
|
+
- **Environment variables**: Automatically validate and inject environment variables into the function.
|
|
23
|
+
- **Fully type-hinted**: The library is fully type-hinted and provides good types for easy development.
|
|
24
|
+
- **Help alias**: The `-h` and `--help` automatically show the help menu unless overridden.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install click-extended
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- **Python**: 3.10 or higher
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
### Basic Command
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from click_extended import command, option
|
|
42
|
+
|
|
43
|
+
@command()
|
|
44
|
+
@option("--name", default="World", help="Name to greet")
|
|
45
|
+
@option("--count", type=int, default=1, help="Number of greetings")
|
|
46
|
+
def greet(name: str, count: int):
|
|
47
|
+
"""Greet someone multiple times."""
|
|
48
|
+
for _ in range(count):
|
|
49
|
+
print(f"Hello, {name}!")
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
greet()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
$ python app.py --name Alice --count 3
|
|
57
|
+
Hello, Alice!
|
|
58
|
+
Hello, Alice!
|
|
59
|
+
Hello, Alice!
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Async Support
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import asyncio
|
|
66
|
+
|
|
67
|
+
from click_extended import command, option
|
|
68
|
+
|
|
69
|
+
@command()
|
|
70
|
+
@option("--url", required=True, help="URL to fetch")
|
|
71
|
+
async def fetch(url: str):
|
|
72
|
+
"""Fetch data from a URL asynchronously."""
|
|
73
|
+
await asyncio.sleep(1)
|
|
74
|
+
print(f"Fetched data from {url}")
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
fetch()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Command Aliases
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from click_extended import command, option
|
|
84
|
+
|
|
85
|
+
@command(aliases=["hi", "hello"])
|
|
86
|
+
@option("--name", default="World")
|
|
87
|
+
def greet(name: str):
|
|
88
|
+
"""Greet someone."""
|
|
89
|
+
print(f"Hello, {name}!")
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
greet()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
$ python app.py greet --name Alice
|
|
97
|
+
Hello, Alice!
|
|
98
|
+
$ python app.py hi --name Bob
|
|
99
|
+
Hello, Bob!
|
|
100
|
+
$ python app.py hello --name Charlie
|
|
101
|
+
Hello, Charlie!
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Environment Variables
|
|
105
|
+
|
|
106
|
+
Environment variables are automatically loaded from the `.env` file, but as long as the variable is defined in your system environment, it will work.
|
|
107
|
+
|
|
108
|
+
```txt
|
|
109
|
+
API_TOKEN=secret123
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from click_extended import command, option, env
|
|
114
|
+
|
|
115
|
+
@command()
|
|
116
|
+
@option("--token", help="API token")
|
|
117
|
+
@env("API_TOKEN", name="token", required=True)
|
|
118
|
+
def api_call(token: str):
|
|
119
|
+
"""Make an API call with authentication."""
|
|
120
|
+
print(f"Using token: {token[:8]}...")
|
|
121
|
+
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
api_call()
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
$ python app.py
|
|
128
|
+
Using token: secret12...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Value Validation
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from click_extended import command, option, ChildNode
|
|
135
|
+
|
|
136
|
+
class IsPositive(ChildNode):
|
|
137
|
+
"""Validate that a number is positive."""
|
|
138
|
+
|
|
139
|
+
def process(self, value, *args, **kwargs):
|
|
140
|
+
if value <= 0:
|
|
141
|
+
raise ValueError(f"Value must be positive, got {value}")
|
|
142
|
+
|
|
143
|
+
def is_positive(*args, **kwargs):
|
|
144
|
+
"""Validate positive numbers."""
|
|
145
|
+
return IsPositive.as_decorator(*args, **kwargs)
|
|
146
|
+
|
|
147
|
+
@command()
|
|
148
|
+
@option("--count", type=int, required=True)
|
|
149
|
+
@is_positive()
|
|
150
|
+
def process(count: int):
|
|
151
|
+
"""Process a positive number of items."""
|
|
152
|
+
print(f"Processing {count} items")
|
|
153
|
+
|
|
154
|
+
if __name__ == "__main__":
|
|
155
|
+
process()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
$ python app.py --count 5
|
|
160
|
+
Processing 5 items
|
|
161
|
+
$ python app.py --count -1
|
|
162
|
+
Error: Value must be positive, got -1
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Documentation
|
|
166
|
+
|
|
167
|
+
### Core Concepts
|
|
168
|
+
|
|
169
|
+
- [Commands and Groups](./docs/ROOT_NODE.md) - CLI entry points
|
|
170
|
+
- [Options, Arguments, and Environment Variables](./docs/PARENT_NODE.md) - Parameter sources
|
|
171
|
+
- [Validators and Transformers](./docs/CHILD_NODE.md) - Value processing
|
|
172
|
+
- [Global Nodes](./docs/GLOBAL_NODE.md) - Tree-level operations
|
|
173
|
+
- [Tags](./docs/TAG.md) - Cross-parameter validation
|
|
174
|
+
- [Tree Architecture](./docs/TREE.md) - Internal structure
|
|
175
|
+
|
|
176
|
+
### Guides
|
|
177
|
+
|
|
178
|
+
- [Migrating from Click](./docs/MIGRATING_FROM_CLICK.md) - Upgrade guide
|
|
179
|
+
|
|
180
|
+
## Contributing
|
|
181
|
+
|
|
182
|
+
Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
187
|
+
|
|
188
|
+
## Acknowledgements
|
|
189
|
+
|
|
190
|
+
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: click_extended
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: An extension to Click with additional features like automatic async support, aliasing and a modular decorator system.
|
|
5
|
+
Author-email: Marcus Fredriksson <marcus@marcusfredriksson.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Marcus Fredriksson
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/marcusfrdk/click-extended
|
|
29
|
+
Project-URL: Repository, https://github.com/marcusfrdk/click-extended
|
|
30
|
+
Project-URL: Issues, https://github.com/marcusfrdk/click-extended/issues
|
|
31
|
+
Keywords: click,cli,command-line,alias,aliasing,command,group,decorator,terminal,console
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
+
Classifier: Topic :: System :: Shells
|
|
42
|
+
Classifier: Topic :: Utilities
|
|
43
|
+
Classifier: Typing :: Typed
|
|
44
|
+
Requires-Python: >=3.10
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
License-File: LICENSE
|
|
47
|
+
License-File: AUTHORS.md
|
|
48
|
+
Requires-Dist: click>=8.3.0
|
|
49
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
50
|
+
Provides-Extra: build
|
|
51
|
+
Requires-Dist: build; extra == "build"
|
|
52
|
+
Requires-Dist: twine; extra == "build"
|
|
53
|
+
Provides-Extra: dev
|
|
54
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
|
|
57
|
+
Requires-Dist: mypy>=1.18.2; extra == "dev"
|
|
58
|
+
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
60
|
+
Requires-Dist: black>=25.9.0; extra == "dev"
|
|
61
|
+
Requires-Dist: pre-commit>=4.3.0; extra == "dev"
|
|
62
|
+
Dynamic: license-file
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
# Click Extended
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+

|
|
70
|
+

|
|
71
|
+

|
|
72
|
+

|
|
73
|
+

|
|
74
|
+

|
|
75
|
+

|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
|
|
79
|
+
|
|
80
|
+
## Features
|
|
81
|
+
|
|
82
|
+
- **Aliasing**: Add multiple aliases to a group or command.
|
|
83
|
+
- **Async supprt**: Automatically run both synchronous and asynchronous functions.
|
|
84
|
+
- **Extensible decorator API**: Extend the Click decorator API with custom decorators like validators, transformers, and more.
|
|
85
|
+
- **Environment variables**: Automatically validate and inject environment variables into the function.
|
|
86
|
+
- **Fully type-hinted**: The library is fully type-hinted and provides good types for easy development.
|
|
87
|
+
- **Help alias**: The `-h` and `--help` automatically show the help menu unless overridden.
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install click-extended
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Requirements
|
|
96
|
+
|
|
97
|
+
- **Python**: 3.10 or higher
|
|
98
|
+
|
|
99
|
+
## Quick Start
|
|
100
|
+
|
|
101
|
+
### Basic Command
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from click_extended import command, option
|
|
105
|
+
|
|
106
|
+
@command()
|
|
107
|
+
@option("--name", default="World", help="Name to greet")
|
|
108
|
+
@option("--count", type=int, default=1, help="Number of greetings")
|
|
109
|
+
def greet(name: str, count: int):
|
|
110
|
+
"""Greet someone multiple times."""
|
|
111
|
+
for _ in range(count):
|
|
112
|
+
print(f"Hello, {name}!")
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
greet()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
$ python app.py --name Alice --count 3
|
|
120
|
+
Hello, Alice!
|
|
121
|
+
Hello, Alice!
|
|
122
|
+
Hello, Alice!
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Async Support
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import asyncio
|
|
129
|
+
|
|
130
|
+
from click_extended import command, option
|
|
131
|
+
|
|
132
|
+
@command()
|
|
133
|
+
@option("--url", required=True, help="URL to fetch")
|
|
134
|
+
async def fetch(url: str):
|
|
135
|
+
"""Fetch data from a URL asynchronously."""
|
|
136
|
+
await asyncio.sleep(1)
|
|
137
|
+
print(f"Fetched data from {url}")
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
fetch()
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Command Aliases
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from click_extended import command, option
|
|
147
|
+
|
|
148
|
+
@command(aliases=["hi", "hello"])
|
|
149
|
+
@option("--name", default="World")
|
|
150
|
+
def greet(name: str):
|
|
151
|
+
"""Greet someone."""
|
|
152
|
+
print(f"Hello, {name}!")
|
|
153
|
+
|
|
154
|
+
if __name__ == "__main__":
|
|
155
|
+
greet()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
$ python app.py greet --name Alice
|
|
160
|
+
Hello, Alice!
|
|
161
|
+
$ python app.py hi --name Bob
|
|
162
|
+
Hello, Bob!
|
|
163
|
+
$ python app.py hello --name Charlie
|
|
164
|
+
Hello, Charlie!
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Environment Variables
|
|
168
|
+
|
|
169
|
+
Environment variables are automatically loaded from the `.env` file, but as long as the variable is defined in your system environment, it will work.
|
|
170
|
+
|
|
171
|
+
```txt
|
|
172
|
+
API_TOKEN=secret123
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from click_extended import command, option, env
|
|
177
|
+
|
|
178
|
+
@command()
|
|
179
|
+
@option("--token", help="API token")
|
|
180
|
+
@env("API_TOKEN", name="token", required=True)
|
|
181
|
+
def api_call(token: str):
|
|
182
|
+
"""Make an API call with authentication."""
|
|
183
|
+
print(f"Using token: {token[:8]}...")
|
|
184
|
+
|
|
185
|
+
if __name__ == "__main__":
|
|
186
|
+
api_call()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
$ python app.py
|
|
191
|
+
Using token: secret12...
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Value Validation
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from click_extended import command, option, ChildNode
|
|
198
|
+
|
|
199
|
+
class IsPositive(ChildNode):
|
|
200
|
+
"""Validate that a number is positive."""
|
|
201
|
+
|
|
202
|
+
def process(self, value, *args, **kwargs):
|
|
203
|
+
if value <= 0:
|
|
204
|
+
raise ValueError(f"Value must be positive, got {value}")
|
|
205
|
+
|
|
206
|
+
def is_positive(*args, **kwargs):
|
|
207
|
+
"""Validate positive numbers."""
|
|
208
|
+
return IsPositive.as_decorator(*args, **kwargs)
|
|
209
|
+
|
|
210
|
+
@command()
|
|
211
|
+
@option("--count", type=int, required=True)
|
|
212
|
+
@is_positive()
|
|
213
|
+
def process(count: int):
|
|
214
|
+
"""Process a positive number of items."""
|
|
215
|
+
print(f"Processing {count} items")
|
|
216
|
+
|
|
217
|
+
if __name__ == "__main__":
|
|
218
|
+
process()
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
$ python app.py --count 5
|
|
223
|
+
Processing 5 items
|
|
224
|
+
$ python app.py --count -1
|
|
225
|
+
Error: Value must be positive, got -1
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Documentation
|
|
229
|
+
|
|
230
|
+
### Core Concepts
|
|
231
|
+
|
|
232
|
+
- [Commands and Groups](./docs/ROOT_NODE.md) - CLI entry points
|
|
233
|
+
- [Options, Arguments, and Environment Variables](./docs/PARENT_NODE.md) - Parameter sources
|
|
234
|
+
- [Validators and Transformers](./docs/CHILD_NODE.md) - Value processing
|
|
235
|
+
- [Global Nodes](./docs/GLOBAL_NODE.md) - Tree-level operations
|
|
236
|
+
- [Tags](./docs/TAG.md) - Cross-parameter validation
|
|
237
|
+
- [Tree Architecture](./docs/TREE.md) - Internal structure
|
|
238
|
+
|
|
239
|
+
### Guides
|
|
240
|
+
|
|
241
|
+
- [Migrating from Click](./docs/MIGRATING_FROM_CLICK.md) - Upgrade guide
|
|
242
|
+
|
|
243
|
+
## Contributing
|
|
244
|
+
|
|
245
|
+
Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
250
|
+
|
|
251
|
+
## Acknowledgements
|
|
252
|
+
|
|
253
|
+
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "click_extended"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.4"
|
|
4
4
|
description = "An extension to Click with additional features like automatic async support, aliasing and a modular decorator system."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Marcus Fredriksson", email = "marcus@marcusfredriksson.com" },
|
|
@@ -472,13 +472,63 @@ class TestArgumentDefault:
|
|
|
472
472
|
arg = Argument(name="test", default={"key": "value"})
|
|
473
473
|
assert arg.default == {"key": "value"}
|
|
474
474
|
|
|
475
|
-
def
|
|
476
|
-
"""Test default
|
|
475
|
+
def test_default_makes_argument_optional(self) -> None:
|
|
476
|
+
"""Test that default automatically makes argument optional."""
|
|
477
|
+
arg = Argument(name="test", default="default")
|
|
478
|
+
assert arg.required is False
|
|
479
|
+
assert arg.default == "default"
|
|
480
|
+
|
|
481
|
+
def test_default_with_explicit_required_false(self) -> None:
|
|
482
|
+
"""Test default with explicit required=False still works."""
|
|
477
483
|
arg = Argument(name="test", required=False, default="default")
|
|
478
484
|
assert arg.required is False
|
|
479
485
|
assert arg.default == "default"
|
|
480
486
|
|
|
481
487
|
|
|
488
|
+
class TestArgumentDefaultBehavior:
|
|
489
|
+
"""Tests for default value auto-optional behavior."""
|
|
490
|
+
|
|
491
|
+
def test_default_string_makes_optional(self) -> None:
|
|
492
|
+
"""Test that string default makes argument optional."""
|
|
493
|
+
arg = Argument(name="test", default="value")
|
|
494
|
+
assert arg.required is False
|
|
495
|
+
|
|
496
|
+
def test_default_int_makes_optional(self) -> None:
|
|
497
|
+
"""Test that int default makes argument optional."""
|
|
498
|
+
arg = Argument(name="test", default=42)
|
|
499
|
+
assert arg.required is False
|
|
500
|
+
|
|
501
|
+
def test_default_zero_makes_optional(self) -> None:
|
|
502
|
+
"""Test that default=0 makes argument optional."""
|
|
503
|
+
arg = Argument(name="test", default=0)
|
|
504
|
+
assert arg.required is False
|
|
505
|
+
|
|
506
|
+
def test_default_empty_string_makes_optional(self) -> None:
|
|
507
|
+
"""Test that default='' makes argument optional."""
|
|
508
|
+
arg = Argument(name="test", default="")
|
|
509
|
+
assert arg.required is False
|
|
510
|
+
|
|
511
|
+
def test_default_false_makes_optional(self) -> None:
|
|
512
|
+
"""Test that default=False makes argument optional."""
|
|
513
|
+
arg = Argument(name="test", default=False)
|
|
514
|
+
assert arg.required is False
|
|
515
|
+
|
|
516
|
+
def test_default_empty_list_makes_optional(self) -> None:
|
|
517
|
+
"""Test that default=[] makes argument optional."""
|
|
518
|
+
arg = Argument(name="test", default=[])
|
|
519
|
+
assert arg.required is False
|
|
520
|
+
|
|
521
|
+
def test_no_default_stays_required(self) -> None:
|
|
522
|
+
"""Test that no default keeps argument required."""
|
|
523
|
+
arg = Argument(name="test")
|
|
524
|
+
assert arg.required is True
|
|
525
|
+
|
|
526
|
+
def test_default_none_stays_required(self) -> None:
|
|
527
|
+
"""Test that default=None doesn't change required status."""
|
|
528
|
+
arg = Argument(name="test", default=None)
|
|
529
|
+
assert arg.required is True
|
|
530
|
+
|
|
531
|
+
|
|
482
532
|
class TestArgumentExtraKwargs:
|
|
483
533
|
"""Tests for extra kwargs parameter."""
|
|
484
534
|
|
click_extended-0.0.3/PKG-INFO
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: click_extended
|
|
3
|
-
Version: 0.0.3
|
|
4
|
-
Summary: An extension to Click with additional features like automatic async support, aliasing and a modular decorator system.
|
|
5
|
-
Author-email: Marcus Fredriksson <marcus@marcusfredriksson.com>
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Marcus Fredriksson
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
28
|
-
Project-URL: Homepage, https://github.com/marcusfrdk/click-extended
|
|
29
|
-
Project-URL: Repository, https://github.com/marcusfrdk/click-extended
|
|
30
|
-
Project-URL: Issues, https://github.com/marcusfrdk/click-extended/issues
|
|
31
|
-
Keywords: click,cli,command-line,alias,aliasing,command,group,decorator,terminal,console
|
|
32
|
-
Classifier: Intended Audience :: Developers
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Operating System :: OS Independent
|
|
35
|
-
Classifier: Programming Language :: Python :: 3
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
-
Classifier: Topic :: System :: Shells
|
|
42
|
-
Classifier: Topic :: Utilities
|
|
43
|
-
Classifier: Typing :: Typed
|
|
44
|
-
Requires-Python: >=3.10
|
|
45
|
-
Description-Content-Type: text/markdown
|
|
46
|
-
License-File: LICENSE
|
|
47
|
-
License-File: AUTHORS.md
|
|
48
|
-
Requires-Dist: click>=8.3.0
|
|
49
|
-
Requires-Dist: python-dotenv>=1.2.1
|
|
50
|
-
Provides-Extra: build
|
|
51
|
-
Requires-Dist: build; extra == "build"
|
|
52
|
-
Requires-Dist: twine; extra == "build"
|
|
53
|
-
Provides-Extra: dev
|
|
54
|
-
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
55
|
-
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
56
|
-
Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
|
|
57
|
-
Requires-Dist: mypy>=1.18.2; extra == "dev"
|
|
58
|
-
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
59
|
-
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
60
|
-
Requires-Dist: black>=25.9.0; extra == "dev"
|
|
61
|
-
Requires-Dist: pre-commit>=4.3.0; extra == "dev"
|
|
62
|
-
Dynamic: license-file
|
|
63
|
-
|
|
64
|
-

|
|
65
|
-
|
|
66
|
-
# Click Extended
|
|
67
|
-
|
|
68
|
-
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator system and more.
|
|
69
|
-
|
|
70
|
-
## Features
|
|
71
|
-
|
|
72
|
-
- **Aliasing**: Add multiple aliases to a group or command.
|
|
73
|
-
- **Async supprt**: Automatically run both synchronous and asynchronous functions.
|
|
74
|
-
- **Extended decorator system**: Create or use pre-made validation and transformation decorators, inject values into the context and more.
|
|
75
|
-
- **Environment variables**: Automatically validate and inject environment variables into the function.
|
|
76
|
-
|
|
77
|
-
## Installation
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
pip install click-extended
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Requirements
|
|
84
|
-
|
|
85
|
-
- **Python**: 3.10 or higher
|
|
86
|
-
|
|
87
|
-
## Usage
|
|
88
|
-
|
|
89
|
-
TBD
|
|
90
|
-
|
|
91
|
-
## Contributing
|
|
92
|
-
|
|
93
|
-
TBD
|
|
94
|
-
|
|
95
|
-
## License
|
|
96
|
-
|
|
97
|
-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
98
|
-
|
|
99
|
-
## Acknowledgements
|
|
100
|
-
|
|
101
|
-
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
click_extended-0.0.3/README.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
# Click Extended
|
|
4
|
-
|
|
5
|
-
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator system and more.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **Aliasing**: Add multiple aliases to a group or command.
|
|
10
|
-
- **Async supprt**: Automatically run both synchronous and asynchronous functions.
|
|
11
|
-
- **Extended decorator system**: Create or use pre-made validation and transformation decorators, inject values into the context and more.
|
|
12
|
-
- **Environment variables**: Automatically validate and inject environment variables into the function.
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pip install click-extended
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Requirements
|
|
21
|
-
|
|
22
|
-
- **Python**: 3.10 or higher
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
TBD
|
|
27
|
-
|
|
28
|
-
## Contributing
|
|
29
|
-
|
|
30
|
-
TBD
|
|
31
|
-
|
|
32
|
-
## License
|
|
33
|
-
|
|
34
|
-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
35
|
-
|
|
36
|
-
## Acknowledgements
|
|
37
|
-
|
|
38
|
-
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: click_extended
|
|
3
|
-
Version: 0.0.3
|
|
4
|
-
Summary: An extension to Click with additional features like automatic async support, aliasing and a modular decorator system.
|
|
5
|
-
Author-email: Marcus Fredriksson <marcus@marcusfredriksson.com>
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Marcus Fredriksson
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
28
|
-
Project-URL: Homepage, https://github.com/marcusfrdk/click-extended
|
|
29
|
-
Project-URL: Repository, https://github.com/marcusfrdk/click-extended
|
|
30
|
-
Project-URL: Issues, https://github.com/marcusfrdk/click-extended/issues
|
|
31
|
-
Keywords: click,cli,command-line,alias,aliasing,command,group,decorator,terminal,console
|
|
32
|
-
Classifier: Intended Audience :: Developers
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Operating System :: OS Independent
|
|
35
|
-
Classifier: Programming Language :: Python :: 3
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
-
Classifier: Topic :: System :: Shells
|
|
42
|
-
Classifier: Topic :: Utilities
|
|
43
|
-
Classifier: Typing :: Typed
|
|
44
|
-
Requires-Python: >=3.10
|
|
45
|
-
Description-Content-Type: text/markdown
|
|
46
|
-
License-File: LICENSE
|
|
47
|
-
License-File: AUTHORS.md
|
|
48
|
-
Requires-Dist: click>=8.3.0
|
|
49
|
-
Requires-Dist: python-dotenv>=1.2.1
|
|
50
|
-
Provides-Extra: build
|
|
51
|
-
Requires-Dist: build; extra == "build"
|
|
52
|
-
Requires-Dist: twine; extra == "build"
|
|
53
|
-
Provides-Extra: dev
|
|
54
|
-
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
55
|
-
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
56
|
-
Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
|
|
57
|
-
Requires-Dist: mypy>=1.18.2; extra == "dev"
|
|
58
|
-
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
59
|
-
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
60
|
-
Requires-Dist: black>=25.9.0; extra == "dev"
|
|
61
|
-
Requires-Dist: pre-commit>=4.3.0; extra == "dev"
|
|
62
|
-
Dynamic: license-file
|
|
63
|
-
|
|
64
|
-

|
|
65
|
-
|
|
66
|
-
# Click Extended
|
|
67
|
-
|
|
68
|
-
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator system and more.
|
|
69
|
-
|
|
70
|
-
## Features
|
|
71
|
-
|
|
72
|
-
- **Aliasing**: Add multiple aliases to a group or command.
|
|
73
|
-
- **Async supprt**: Automatically run both synchronous and asynchronous functions.
|
|
74
|
-
- **Extended decorator system**: Create or use pre-made validation and transformation decorators, inject values into the context and more.
|
|
75
|
-
- **Environment variables**: Automatically validate and inject environment variables into the function.
|
|
76
|
-
|
|
77
|
-
## Installation
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
pip install click-extended
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Requirements
|
|
84
|
-
|
|
85
|
-
- **Python**: 3.10 or higher
|
|
86
|
-
|
|
87
|
-
## Usage
|
|
88
|
-
|
|
89
|
-
TBD
|
|
90
|
-
|
|
91
|
-
## Contributing
|
|
92
|
-
|
|
93
|
-
TBD
|
|
94
|
-
|
|
95
|
-
## License
|
|
96
|
-
|
|
97
|
-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
98
|
-
|
|
99
|
-
## Acknowledgements
|
|
100
|
-
|
|
101
|
-
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|