summaryrefslogtreecommitdiff
path: root/python-click-option-group.spec
blob: c170a427d265d24d4d299f648dff05975ad236e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
%global _empty_manifest_terminate_build 0
Name:		python-click-option-group
Version:	0.5.5
Release:	1
Summary:	Option groups missing in Click
License:	BSD-3-Clause
URL:		https://github.com/click-contrib/click-option-group
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/4c/29/ff7cd69825b5bfb48e39853b75d5dc2e98a581730f2b6c9c014188730755/click-option-group-0.5.5.tar.gz
BuildArch:	noarch

Requires:	python3-Click
Requires:	python3-sphinx
Requires:	python3-Pallets-Sphinx-Themes
Requires:	python3-m2r2
Requires:	python3-pytest
Requires:	python3-pytest
Requires:	python3-pytest-cov
Requires:	python3-coverage
Requires:	python3-coveralls

%description
# click-option-group

[![PyPI version](https://img.shields.io/pypi/v/click-option-group.svg)](https://pypi.python.org/pypi/click-option-group)
[![Build status](https://travis-ci.org/click-contrib/click-option-group.svg?branch=master)](https://travis-ci.org/click-contrib/click-option-group)
[![Coverage Status](https://coveralls.io/repos/github/click-contrib/click-option-group/badge.svg?branch=master)](https://coveralls.io/github/click-contrib/click-option-group?branch=master)
![Supported Python versions](https://img.shields.io/pypi/pyversions/click-option-group.svg)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)


**click-option-group** is a Click-extension package that adds option groups 
missing in [Click](https://github.com/pallets/click/).

## Aim and Motivation

Click is a package for creating powerful and beautiful command line interfaces (CLI) in Python, 
but it has no the functionality for creating option groups.

Option groups are convenient mechanism for logical structuring CLI, also it allows you to set 
the specific behavior and set the relationship among grouped options (mutually exclusive options for example). 
Moreover, [argparse](https://docs.python.org/3/library/argparse.html) stdlib package contains this 
functionality out of the box.

At the same time, many Click users need this functionality.
You can read interesting discussions about it in the following issues:

* [issue 257](https://github.com/pallets/click/issues/257)
* [issue 373](https://github.com/pallets/click/issues/373)
* [issue 509](https://github.com/pallets/click/issues/509)
* [issue 1137](https://github.com/pallets/click/issues/1137)

The aim of this package is to provide group options with extensible functionality 
using canonical and clean API (Click-like API as far as possible).

## Quickstart

### Installing 

Install and update using pip:

```bash
pip install -U click-option-group
```

### A Simple Example

Here is a simple example how to use option groups in your Click-based CLI.
Just use `optgroup` for declaring option groups by decorating 
your command function in Click-like API style.

```python
# app.py

import click
from click_option_group import optgroup, RequiredMutuallyExclusiveOptionGroup

@click.command()
@optgroup.group('Server configuration', 
                help='The configuration of some server connection')
@optgroup.option('-h', '--host', default='localhost', help='Server host name')
@optgroup.option('-p', '--port', type=int, default=8888, help='Server port')
@optgroup.option('-n', '--attempts', type=int, default=3, help='The number of connection attempts')
@optgroup.option('-t', '--timeout', type=int, default=30, help='The server response timeout')
@optgroup.group('Input data sources', cls=RequiredMutuallyExclusiveOptionGroup, 
                help='The sources of the input data')
@optgroup.option('--tsv-file', type=click.File(), help='CSV/TSV input data file')
@optgroup.option('--json-file', type=click.File(), help='JSON input data file')
@click.option('--debug/--no-debug', default=False, help='Debug flag')
def cli(**params):
    print(params)

if __name__ == '__main__':
    cli()
```

```bash
$ python app.py --help
Usage: app.py [OPTIONS]

Options:
  Server configuration:           The configuration of some server connection
    -h, --host TEXT               Server host name
    -p, --port INTEGER            Server port
    -n, --attempts INTEGER        The number of connection attempts
    -t, --timeout INTEGER         The server response timeout
  Input data sources: [mutually_exclusive, required]
                                  The sources of the input data
    --tsv-file FILENAME           CSV/TSV input data file
    --json-file FILENAME          JSON input data file
  --debug / --no-debug            Debug flag
  --help                          Show this message and exit.
```

## Documentation

https://click-option-group.readthedocs.io

# Changelog

## v0.5.5 (12.10.2022)

* Add `tests/` directory to tarball
* Add `tests_cov` extra dependencies for testing with coverage

## v0.5.4 (12.10.2022)

* Move frame gathering into error code path (PR [#34](https://github.com/click-contrib/click-option-group/pull/34))
* Fix typos (PR [#37](https://github.com/click-contrib/click-option-group/pull/37))
* PEP 561 support (PR [#42](https://github.com/click-contrib/click-option-group/pull/42))
* Update docs dependencies and Travis CI Python version matrix (PR [#43](https://github.com/click-contrib/click-option-group/pull/43))

## v0.5.3 (14.05.2021)

* Update Click dependency version to `<9` (Issue [#33](https://github.com/click-contrib/click-option-group/issues/33))

## v0.5.2 (28.11.2020)

* Do not use default option group name. An empty group name will not be displayed
* Slightly edited error messages
* All arguments except `name` in `optgroup` decorator must be keyword-only

## v0.5.1 (14.06.2020)

* Fix incompatibility with autocomplete: out of the box Click completion and click-repl (Issue [#14](https://github.com/click-contrib/click-option-group/issues/14))

## v0.5.0 (10.06.2020)

* Add `AllOptionGroup` class: all options from the group must be set or none must be set (PR [#13](https://github.com/click-contrib/click-option-group/pull/13))
* Fix type hints
* Update docs

## v0.4.0 (18.05.2020)

* Support multi-layer wrapped functions (PR [#10](https://github.com/click-contrib/click-option-group/pull/10))
* Fix flake8 issues

## v0.3.1

* Add `hidden=True` to `_GroupTitleFakeOption` as a temporary workaroud for issue [#4](https://github.com/click-contrib/click-option-group/issues/4)

## v0.3.0
* Add support for hidden options inside groups (PR [#2](https://github.com/click-contrib/click-option-group/pull/2))

## v0.2.3
* Transfer the repo to click-contrib organisation

## v0.2.2
* Add true lineno in warning when declaring empty option group
* Update readme

## v0.2.1
* Use RuntimeWarning and stacklevel 2 when declaring empty option group
* Update readme

## v0.2.0
* Implement `RequiredMutuallyExclusiveOptionGroup` class instead of `required` argument for `MutuallyExclusiveOptionGroup`
* Add tests with 100% coverage
* Update readme

## v0.1.0
* First public release


%package -n python3-click-option-group
Summary:	Option groups missing in Click
Provides:	python-click-option-group
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-click-option-group
# click-option-group

[![PyPI version](https://img.shields.io/pypi/v/click-option-group.svg)](https://pypi.python.org/pypi/click-option-group)
[![Build status](https://travis-ci.org/click-contrib/click-option-group.svg?branch=master)](https://travis-ci.org/click-contrib/click-option-group)
[![Coverage Status](https://coveralls.io/repos/github/click-contrib/click-option-group/badge.svg?branch=master)](https://coveralls.io/github/click-contrib/click-option-group?branch=master)
![Supported Python versions](https://img.shields.io/pypi/pyversions/click-option-group.svg)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)


**click-option-group** is a Click-extension package that adds option groups 
missing in [Click](https://github.com/pallets/click/).

## Aim and Motivation

Click is a package for creating powerful and beautiful command line interfaces (CLI) in Python, 
but it has no the functionality for creating option groups.

Option groups are convenient mechanism for logical structuring CLI, also it allows you to set 
the specific behavior and set the relationship among grouped options (mutually exclusive options for example). 
Moreover, [argparse](https://docs.python.org/3/library/argparse.html) stdlib package contains this 
functionality out of the box.

At the same time, many Click users need this functionality.
You can read interesting discussions about it in the following issues:

* [issue 257](https://github.com/pallets/click/issues/257)
* [issue 373](https://github.com/pallets/click/issues/373)
* [issue 509](https://github.com/pallets/click/issues/509)
* [issue 1137](https://github.com/pallets/click/issues/1137)

The aim of this package is to provide group options with extensible functionality 
using canonical and clean API (Click-like API as far as possible).

## Quickstart

### Installing 

Install and update using pip:

```bash
pip install -U click-option-group
```

### A Simple Example

Here is a simple example how to use option groups in your Click-based CLI.
Just use `optgroup` for declaring option groups by decorating 
your command function in Click-like API style.

```python
# app.py

import click
from click_option_group import optgroup, RequiredMutuallyExclusiveOptionGroup

@click.command()
@optgroup.group('Server configuration', 
                help='The configuration of some server connection')
@optgroup.option('-h', '--host', default='localhost', help='Server host name')
@optgroup.option('-p', '--port', type=int, default=8888, help='Server port')
@optgroup.option('-n', '--attempts', type=int, default=3, help='The number of connection attempts')
@optgroup.option('-t', '--timeout', type=int, default=30, help='The server response timeout')
@optgroup.group('Input data sources', cls=RequiredMutuallyExclusiveOptionGroup, 
                help='The sources of the input data')
@optgroup.option('--tsv-file', type=click.File(), help='CSV/TSV input data file')
@optgroup.option('--json-file', type=click.File(), help='JSON input data file')
@click.option('--debug/--no-debug', default=False, help='Debug flag')
def cli(**params):
    print(params)

if __name__ == '__main__':
    cli()
```

```bash
$ python app.py --help
Usage: app.py [OPTIONS]

Options:
  Server configuration:           The configuration of some server connection
    -h, --host TEXT               Server host name
    -p, --port INTEGER            Server port
    -n, --attempts INTEGER        The number of connection attempts
    -t, --timeout INTEGER         The server response timeout
  Input data sources: [mutually_exclusive, required]
                                  The sources of the input data
    --tsv-file FILENAME           CSV/TSV input data file
    --json-file FILENAME          JSON input data file
  --debug / --no-debug            Debug flag
  --help                          Show this message and exit.
```

## Documentation

https://click-option-group.readthedocs.io

# Changelog

## v0.5.5 (12.10.2022)

* Add `tests/` directory to tarball
* Add `tests_cov` extra dependencies for testing with coverage

## v0.5.4 (12.10.2022)

* Move frame gathering into error code path (PR [#34](https://github.com/click-contrib/click-option-group/pull/34))
* Fix typos (PR [#37](https://github.com/click-contrib/click-option-group/pull/37))
* PEP 561 support (PR [#42](https://github.com/click-contrib/click-option-group/pull/42))
* Update docs dependencies and Travis CI Python version matrix (PR [#43](https://github.com/click-contrib/click-option-group/pull/43))

## v0.5.3 (14.05.2021)

* Update Click dependency version to `<9` (Issue [#33](https://github.com/click-contrib/click-option-group/issues/33))

## v0.5.2 (28.11.2020)

* Do not use default option group name. An empty group name will not be displayed
* Slightly edited error messages
* All arguments except `name` in `optgroup` decorator must be keyword-only

## v0.5.1 (14.06.2020)

* Fix incompatibility with autocomplete: out of the box Click completion and click-repl (Issue [#14](https://github.com/click-contrib/click-option-group/issues/14))

## v0.5.0 (10.06.2020)

* Add `AllOptionGroup` class: all options from the group must be set or none must be set (PR [#13](https://github.com/click-contrib/click-option-group/pull/13))
* Fix type hints
* Update docs

## v0.4.0 (18.05.2020)

* Support multi-layer wrapped functions (PR [#10](https://github.com/click-contrib/click-option-group/pull/10))
* Fix flake8 issues

## v0.3.1

* Add `hidden=True` to `_GroupTitleFakeOption` as a temporary workaroud for issue [#4](https://github.com/click-contrib/click-option-group/issues/4)

## v0.3.0
* Add support for hidden options inside groups (PR [#2](https://github.com/click-contrib/click-option-group/pull/2))

## v0.2.3
* Transfer the repo to click-contrib organisation

## v0.2.2
* Add true lineno in warning when declaring empty option group
* Update readme

## v0.2.1
* Use RuntimeWarning and stacklevel 2 when declaring empty option group
* Update readme

## v0.2.0
* Implement `RequiredMutuallyExclusiveOptionGroup` class instead of `required` argument for `MutuallyExclusiveOptionGroup`
* Add tests with 100% coverage
* Update readme

## v0.1.0
* First public release


%package help
Summary:	Development documents and examples for click-option-group
Provides:	python3-click-option-group-doc
%description help
# click-option-group

[![PyPI version](https://img.shields.io/pypi/v/click-option-group.svg)](https://pypi.python.org/pypi/click-option-group)
[![Build status](https://travis-ci.org/click-contrib/click-option-group.svg?branch=master)](https://travis-ci.org/click-contrib/click-option-group)
[![Coverage Status](https://coveralls.io/repos/github/click-contrib/click-option-group/badge.svg?branch=master)](https://coveralls.io/github/click-contrib/click-option-group?branch=master)
![Supported Python versions](https://img.shields.io/pypi/pyversions/click-option-group.svg)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)


**click-option-group** is a Click-extension package that adds option groups 
missing in [Click](https://github.com/pallets/click/).

## Aim and Motivation

Click is a package for creating powerful and beautiful command line interfaces (CLI) in Python, 
but it has no the functionality for creating option groups.

Option groups are convenient mechanism for logical structuring CLI, also it allows you to set 
the specific behavior and set the relationship among grouped options (mutually exclusive options for example). 
Moreover, [argparse](https://docs.python.org/3/library/argparse.html) stdlib package contains this 
functionality out of the box.

At the same time, many Click users need this functionality.
You can read interesting discussions about it in the following issues:

* [issue 257](https://github.com/pallets/click/issues/257)
* [issue 373](https://github.com/pallets/click/issues/373)
* [issue 509](https://github.com/pallets/click/issues/509)
* [issue 1137](https://github.com/pallets/click/issues/1137)

The aim of this package is to provide group options with extensible functionality 
using canonical and clean API (Click-like API as far as possible).

## Quickstart

### Installing 

Install and update using pip:

```bash
pip install -U click-option-group
```

### A Simple Example

Here is a simple example how to use option groups in your Click-based CLI.
Just use `optgroup` for declaring option groups by decorating 
your command function in Click-like API style.

```python
# app.py

import click
from click_option_group import optgroup, RequiredMutuallyExclusiveOptionGroup

@click.command()
@optgroup.group('Server configuration', 
                help='The configuration of some server connection')
@optgroup.option('-h', '--host', default='localhost', help='Server host name')
@optgroup.option('-p', '--port', type=int, default=8888, help='Server port')
@optgroup.option('-n', '--attempts', type=int, default=3, help='The number of connection attempts')
@optgroup.option('-t', '--timeout', type=int, default=30, help='The server response timeout')
@optgroup.group('Input data sources', cls=RequiredMutuallyExclusiveOptionGroup, 
                help='The sources of the input data')
@optgroup.option('--tsv-file', type=click.File(), help='CSV/TSV input data file')
@optgroup.option('--json-file', type=click.File(), help='JSON input data file')
@click.option('--debug/--no-debug', default=False, help='Debug flag')
def cli(**params):
    print(params)

if __name__ == '__main__':
    cli()
```

```bash
$ python app.py --help
Usage: app.py [OPTIONS]

Options:
  Server configuration:           The configuration of some server connection
    -h, --host TEXT               Server host name
    -p, --port INTEGER            Server port
    -n, --attempts INTEGER        The number of connection attempts
    -t, --timeout INTEGER         The server response timeout
  Input data sources: [mutually_exclusive, required]
                                  The sources of the input data
    --tsv-file FILENAME           CSV/TSV input data file
    --json-file FILENAME          JSON input data file
  --debug / --no-debug            Debug flag
  --help                          Show this message and exit.
```

## Documentation

https://click-option-group.readthedocs.io

# Changelog

## v0.5.5 (12.10.2022)

* Add `tests/` directory to tarball
* Add `tests_cov` extra dependencies for testing with coverage

## v0.5.4 (12.10.2022)

* Move frame gathering into error code path (PR [#34](https://github.com/click-contrib/click-option-group/pull/34))
* Fix typos (PR [#37](https://github.com/click-contrib/click-option-group/pull/37))
* PEP 561 support (PR [#42](https://github.com/click-contrib/click-option-group/pull/42))
* Update docs dependencies and Travis CI Python version matrix (PR [#43](https://github.com/click-contrib/click-option-group/pull/43))

## v0.5.3 (14.05.2021)

* Update Click dependency version to `<9` (Issue [#33](https://github.com/click-contrib/click-option-group/issues/33))

## v0.5.2 (28.11.2020)

* Do not use default option group name. An empty group name will not be displayed
* Slightly edited error messages
* All arguments except `name` in `optgroup` decorator must be keyword-only

## v0.5.1 (14.06.2020)

* Fix incompatibility with autocomplete: out of the box Click completion and click-repl (Issue [#14](https://github.com/click-contrib/click-option-group/issues/14))

## v0.5.0 (10.06.2020)

* Add `AllOptionGroup` class: all options from the group must be set or none must be set (PR [#13](https://github.com/click-contrib/click-option-group/pull/13))
* Fix type hints
* Update docs

## v0.4.0 (18.05.2020)

* Support multi-layer wrapped functions (PR [#10](https://github.com/click-contrib/click-option-group/pull/10))
* Fix flake8 issues

## v0.3.1

* Add `hidden=True` to `_GroupTitleFakeOption` as a temporary workaroud for issue [#4](https://github.com/click-contrib/click-option-group/issues/4)

## v0.3.0
* Add support for hidden options inside groups (PR [#2](https://github.com/click-contrib/click-option-group/pull/2))

## v0.2.3
* Transfer the repo to click-contrib organisation

## v0.2.2
* Add true lineno in warning when declaring empty option group
* Update readme

## v0.2.1
* Use RuntimeWarning and stacklevel 2 when declaring empty option group
* Update readme

## v0.2.0
* Implement `RequiredMutuallyExclusiveOptionGroup` class instead of `required` argument for `MutuallyExclusiveOptionGroup`
* Add tests with 100% coverage
* Update readme

## v0.1.0
* First public release


%prep
%autosetup -n click-option-group-0.5.5

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-click-option-group -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri Apr 21 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.5-1
- Package Spec generated