Skip to content

Commit 6fb949d

Browse files
committed
Merge 8.1.3
2 parents 244ff21 + 9c6f4c8 commit 6fb949d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1112
-782
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
3+
- package-ecosystem: "github-actions"
44
directory: "/"
55
schedule:
6-
interval: monthly
7-
time: "08:00"
8-
open-pull-requests-limit: 99
6+
interval: "monthly"
7+
day: "monday"
8+
time: "16:00"
9+
timezone: "UTC"

.github/workflows/lock.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
lock:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: dessant/lock-threads@v2
11+
- uses: dessant/lock-threads@v3
1212
with:
1313
github-token: ${{ github.token }}
14-
issue-lock-inactive-days: 14
15-
pr-lock-inactive-days: 14
14+
issue-inactive-days: 14
15+
pr-inactive-days: 14

.github/workflows/tests.yaml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,27 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
include:
27-
- {name: Linux, python: '3.9', os: ubuntu-latest, tox: py39}
28-
- {name: Windows, python: '3.9', os: windows-latest, tox: py39}
29-
- {name: Mac, python: '3.9', os: macos-latest, tox: py39}
27+
- {name: Linux, python: '3.10', os: ubuntu-latest, tox: py310}
28+
- {name: Windows, python: '3.10', os: windows-latest, tox: py310}
29+
- {name: Mac, python: '3.10', os: macos-latest, tox: py310}
30+
- {name: '3.11-dev', python: '3.11-dev', os: ubuntu-latest, tox: py311}
31+
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
3032
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
3133
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
32-
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
33-
- {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3}
34-
- {name: Typing, python: '3.9', os: ubuntu-latest, tox: typing}
34+
- {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37}
35+
- {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing}
3536
steps:
3637
- uses: actions/checkout@v2
37-
- uses: actions/setup-python@v2
38+
- uses: actions/setup-python@v3
3839
with:
3940
python-version: ${{ matrix.python }}
41+
cache: 'pip'
42+
cache-dependency-path: 'requirements/*.txt'
4043
- name: update pip
4144
run: |
4245
pip install -U wheel
4346
pip install -U setuptools
4447
python -m pip install -U pip
45-
- name: get pip cache dir
46-
id: pip-cache
47-
run: echo "::set-output name=dir::$(pip cache dir)"
48-
- name: cache pip
49-
uses: actions/cache@v2
50-
with:
51-
path: ${{ steps.pip-cache.outputs.dir }}
52-
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}|${{ hashFiles('requirements/*.txt') }}
5348
- name: cache mypy
5449
uses: actions/cache@v2
5550
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.idea/
22
/.vscode/
3+
.DS_Store/
34
/env/
45
/venv/
56
/.pybuild/

.pre-commit-config.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
ci:
2+
autoupdate_branch: "8.1.x"
23
autoupdate_schedule: monthly
34
repos:
45
- repo: https://github.com/asottile/pyupgrade
5-
rev: v2.29.0
6+
rev: v2.32.0
67
hooks:
78
- id: pyupgrade
8-
args: ["--py36-plus"]
9+
args: ["--py37-plus"]
910
- repo: https://github.com/asottile/reorder_python_imports
10-
rev: v2.6.0
11+
rev: v3.1.0
1112
hooks:
1213
- id: reorder-python-imports
1314
args: ["--application-directories", "src"]
15+
additional_dependencies: ["setuptools>60.9"]
1416
- repo: https://github.com/psf/black
15-
rev: 21.9b0
17+
rev: 22.3.0
1618
hooks:
1719
- id: black
1820
- repo: https://github.com/PyCQA/flake8
19-
rev: 3.9.2
21+
rev: 4.0.1
2022
hooks:
2123
- id: flake8
2224
additional_dependencies:
2325
- flake8-bugbear
2426
- flake8-implicit-str-concat
2527
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.0.1
28+
rev: v4.2.0
2729
hooks:
2830
- id: fix-byte-order-marker
2931
- id: trailing-whitespace

.readthedocs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
version: 2
2+
build:
3+
os: ubuntu-20.04
4+
tools:
5+
python: "3.10"
26
python:
37
install:
48
- requirements: requirements/docs.txt

CHANGES.rst

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,115 @@
11
.. currentmodule:: click
22

3+
Version 8.1.3
4+
-------------
5+
6+
Released 2022-04-28
7+
8+
- Use verbose form of ``typing.Callable`` for ``@command`` and
9+
``@group``. :issue:`2255`
10+
- Show error when attempting to create an option with
11+
``multiple=True, is_flag=True``. Use ``count`` instead.
12+
:issue:`2246`
13+
14+
15+
Version 8.1.2
16+
-------------
17+
18+
Released 2022-03-31
19+
20+
- Fix error message for readable path check that was mixed up with the
21+
executable check. :pr:`2236`
22+
- Restore parameter order for ``Path``, placing the ``executable``
23+
parameter at the end. It is recommended to use keyword arguments
24+
instead of positional arguments. :issue:`2235`
25+
26+
27+
Version 8.1.1
28+
-------------
29+
30+
Released 2022-03-30
31+
32+
- Fix an issue with decorator typing that caused type checking to
33+
report that a command was not callable. :issue:`2227`
34+
35+
36+
Version 8.1.0
37+
-------------
38+
39+
Released 2022-03-28
40+
41+
- Drop support for Python 3.6. :pr:`2129`
42+
- Remove previously deprecated code. :pr:`2130`
43+
44+
- ``Group.resultcallback`` is renamed to ``result_callback``.
45+
- ``autocompletion`` parameter to ``Command`` is renamed to
46+
``shell_complete``.
47+
- ``get_terminal_size`` is removed, use
48+
``shutil.get_terminal_size`` instead.
49+
- ``get_os_args`` is removed, use ``sys.argv[1:]`` instead.
50+
51+
- Rely on :pep:`538` and :pep:`540` to handle selecting UTF-8 encoding
52+
instead of ASCII. Click's locale encoding detection is removed.
53+
:issue:`2198`
54+
- Single options boolean flags with ``show_default=True`` only show
55+
the default if it is ``True``. :issue:`1971`
56+
- The ``command`` and ``group`` decorators can be applied with or
57+
without parentheses. :issue:`1359`
58+
- The ``Path`` type can check whether the target is executable.
59+
:issue:`1961`
60+
- ``Command.show_default`` overrides ``Context.show_default``, instead
61+
of the other way around. :issue:`1963`
62+
- Parameter decorators and ``@group`` handles ``cls=None`` the same as
63+
not passing ``cls``. ``@option`` handles ``help=None`` the same as
64+
not passing ``help``. :issue:`#1959`
65+
- A flag option with ``required=True`` requires that the flag is
66+
passed instead of choosing the implicit default value. :issue:`1978`
67+
- Indentation in help text passed to ``Option`` and ``Command`` is
68+
cleaned the same as using the ``@option`` and ``@command``
69+
decorators does. A command's ``epilog`` and ``short_help`` are also
70+
processed. :issue:`1985`
71+
- Store unprocessed ``Command.help``, ``epilog`` and ``short_help``
72+
strings. Processing is only done when formatting help text for
73+
output. :issue:`2149`
74+
- Allow empty str input for ``prompt()`` when
75+
``confirmation_prompt=True`` and ``default=""``. :issue:`2157`
76+
- Windows glob pattern expansion doesn't fail if a value is an invalid
77+
pattern. :issue:`2195`
78+
- It's possible to pass a list of ``params`` to ``@command``. Any
79+
params defined with decorators are appended to the passed params.
80+
:issue:`2131`.
81+
- ``@command`` decorator is annotated as returning the correct type if
82+
a ``cls`` argument is used. :issue:`2211`
83+
- A ``Group`` with ``invoke_without_command=True`` and ``chain=False``
84+
will invoke its result callback with the group function's return
85+
value. :issue:`2124`
86+
- ``to_info_dict`` will not fail if a ``ParamType`` doesn't define a
87+
``name``. :issue:`2168`
88+
- Shell completion prioritizes option values with option prefixes over
89+
new options. :issue:`2040`
90+
- Options that get an environment variable value using
91+
``autoenvvar_prefix`` treat an empty value as ``None``, consistent
92+
with a direct ``envvar``. :issue:`2146`
93+
94+
95+
Version 8.0.4
96+
-------------
97+
98+
Released 2022-02-18
99+
100+
- ``open_file`` recognizes ``Path("-")`` as a standard stream, the
101+
same as the string ``"-"``. :issue:`2106`
102+
- The ``option`` and ``argument`` decorators preserve the type
103+
annotation of the decorated function. :pr:`2155`
104+
- A callable default value can customize its help text by overriding
105+
``__str__`` instead of always showing ``(dynamic)``. :issue:`2099`
106+
- Fix a typo in the Bash completion script that affected file and
107+
directory completion. If this script was generated by a previous
108+
version, it should be regenerated. :issue:`2163`
109+
- Fix typing for ``echo`` and ``secho`` file argument.
110+
:issue:`2174, 2185`
111+
112+
3113
Version 8.0.3
4114
-------------
5115

docs/.DS_Store

-8 KB
Binary file not shown.

docs/api.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ Utilities
6363

6464
.. autofunction:: pause
6565

66-
.. autofunction:: get_terminal_size
67-
6866
.. autofunction:: get_binary_stream
6967

7068
.. autofunction:: get_text_stream

docs/options.rst

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,27 @@ To show the default values when showing command help, use ``show_default=True``
109109
110110
invoke(dots, args=['--help'])
111111

112+
For single option boolean flags, the default remains hidden if the default
113+
value is False.
114+
115+
.. click:example::
116+
117+
@click.command()
118+
@click.option('--n', default=1, show_default=True)
119+
@click.option("--gr", is_flag=True, show_default=True, default=False, help="Greet the world.")
120+
@click.option("--br", is_flag=True, show_default=True, default=True, help="Add a thematic break")
121+
def dots(n, gr, br):
122+
if gr:
123+
click.echo('Hello world!')
124+
click.echo('.' * n)
125+
if br:
126+
click.echo('-' * n)
127+
128+
.. click:run::
129+
130+
invoke(dots, args=['--help'])
131+
132+
112133
Multi Value Options
113134
-------------------
114135

@@ -538,10 +559,10 @@ parameter ``--foo`` was required and defined before, you would need to
538559
specify it for ``--version`` to work. For more information, see
539560
:ref:`callback-evaluation-order`.
540561

541-
A callback is a function that is invoked with two parameters: the current
542-
:class:`Context` and the value. The context provides some useful features
543-
such as quitting the application and gives access to other already
544-
processed parameters.
562+
A callback is a function that is invoked with three parameters: the
563+
current :class:`Context`, the current :class:`Parameter`, and the value.
564+
The context provides some useful features such as quitting the
565+
application and gives access to other already processed parameters.
545566

546567
Here an example for a ``--version`` flag:
547568

0 commit comments

Comments
 (0)