Skip to content

Commit

Permalink
Fix pre-commit
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
  • Loading branch information
LecrisUT committed Aug 16, 2023
1 parent 0ed8e55 commit 71e8246
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 371 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
[![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
**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,
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
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.
Expand All @@ -28,12 +28,12 @@ You can read interesting discussions about it in the following issues:
* [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
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
### Installing

Install and update using pip:

Expand All @@ -44,7 +44,7 @@ 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
Just use `optgroup` for declaring option groups by decorating
your command function in Click-like API style.

```python
Expand All @@ -54,13 +54,13 @@ import click
from click_option_group import optgroup, RequiredMutuallyExclusiveOptionGroup

@click.command()
@optgroup.group('Server configuration',
@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,
@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')
Expand Down
43 changes: 23 additions & 20 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
import os
import sys

sys.path.insert(0, os.path.abspath('.'))

from pallets_sphinx_themes import ProjectLink
from click_option_group import __version__ # noqa

sys.path.insert(0, os.path.abspath("."))


# -- Project information -----------------------------------------------------

project = 'click-option-group'
copyright = '2019-2020, Eugene Prilepin'
author = 'Eugene Prilepin'
project = "click-option-group"
copyright = "2019-2020, Eugene Prilepin"
author = "Eugene Prilepin"

# The full version, including alpha/beta/rc tags
release = __version__
Expand All @@ -35,40 +35,43 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'pallets_sphinx_themes',
'm2r2',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"pallets_sphinx_themes",
"m2r2",
]

autodoc_member_order = 'bysource'
autodoc_member_order = "bysource"

intersphinx_mapping = {
'Click': ('https://click.palletsprojects.com', None)
}
intersphinx_mapping = {"Click": ("https://click.palletsprojects.com", None)}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'click'
html_theme = "click"

html_context = {
"project_links": [
ProjectLink("PyPI releases", "https://pypi.org/project/click-option-group/"),
ProjectLink("Source Code", "https://github.com/click-contrib/click-option-group/"),
ProjectLink("Issue Tracker", "https://github.com/click-contrib/click-option-group/issues/"),
ProjectLink(
"Source Code", "https://github.com/click-contrib/click-option-group/"
),
ProjectLink(
"Issue Tracker",
"https://github.com/click-contrib/click-option-group/issues/",
),
]
}

Expand All @@ -80,4 +83,4 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import pytest


@pytest.fixture(scope='function')
@pytest.fixture(scope="function")
def runner():
return CliRunner()
Loading

0 comments on commit 71e8246

Please sign in to comment.