Skip to content

Commit 1e4b807

Browse files
authored
Merge branch 'stable' into bugfix/OptionsAutoCompletion
2 parents 32c5f0f + 1c68e53 commit 1e4b807

101 files changed

Lines changed: 4707 additions & 3050 deletions

File tree

Some content is hidden

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

.github/workflows/lock.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
permissions:
1111
issues: write
1212
pull-requests: write
13+
discussions: write
1314
concurrency:
1415
group: lock
1516
jobs:

.github/workflows/pre-commit.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ jobs:
77
main:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
11-
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
12-
with:
13-
python-version: 3.x
14-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
15-
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
16-
if: ${{ !cancelled() }}
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
12+
with:
13+
enable-cache: true
14+
prune-cache: false
15+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
16+
id: setup-python
17+
with:
18+
python-version-file: pyproject.toml
19+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
20+
with:
21+
path: ~/.cache/pre-commit
22+
key: pre-commit|${{ hashFiles('pyproject.toml', '.pre-commit-config.yaml') }}
23+
- run: uv run --locked --group pre-commit pre-commit run --show-diff-on-failure --color=always --all-files
24+
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
25+
if: ${{ !cancelled() }}

.github/workflows/publish.yaml

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,45 @@
11
name: Publish
22
on:
33
push:
4-
tags:
5-
- '*'
4+
tags: ['*']
65
jobs:
76
build:
87
runs-on: ubuntu-latest
9-
outputs:
10-
hash: ${{ steps.hash.outputs.hash }}
118
steps:
129
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
10+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
1411
with:
15-
python-version: '3.x'
16-
cache: pip
17-
cache-dependency-path: requirements*/*.txt
18-
- run: pip install -r requirements/build.txt
19-
# Use the commit date instead of the current date during the build.
12+
enable-cache: true
13+
prune-cache: false
14+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
15+
with:
16+
python-version-file: pyproject.toml
2017
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
21-
- run: python -m build
22-
# Generate hashes used for provenance.
23-
- name: generate hash
24-
id: hash
25-
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
26-
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
18+
- run: uv build
19+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2720
with:
2821
path: ./dist
29-
provenance:
30-
needs: [build]
31-
permissions:
32-
actions: read
33-
id-token: write
34-
contents: write
35-
# Can't pin with hash due to how this workflow works.
36-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
37-
with:
38-
base64-subjects: ${{ needs.build.outputs.hash }}
3922
create-release:
40-
# Upload the sdist, wheels, and provenance to a GitHub release. They remain
41-
# available as build artifacts for a while as well.
42-
needs: [provenance]
23+
needs: [build]
4324
runs-on: ubuntu-latest
4425
permissions:
4526
contents: write
4627
steps:
47-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
28+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4829
- name: create release
49-
run: >
50-
gh release create --draft --repo ${{ github.repository }}
51-
${{ github.ref_name }}
52-
*.intoto.jsonl/* artifact/*
30+
run: gh release create --draft --repo ${{ github.repository }} ${{ github.ref_name }} artifact/*
5331
env:
5432
GH_TOKEN: ${{ github.token }}
5533
publish-pypi:
56-
needs: [provenance]
57-
# Wait for approval before attempting to upload to PyPI. This allows reviewing the
58-
# files in the draft release.
34+
needs: [build]
5935
environment:
6036
name: publish
6137
url: https://pypi.org/project/click/${{ github.ref_name }}
6238
runs-on: ubuntu-latest
6339
permissions:
6440
id-token: write
6541
steps:
66-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
67-
- uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
68-
with:
69-
repository-url: https://test.pypi.org/legacy/
70-
packages-dir: artifact/
71-
- uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
42+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
43+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
7244
with:
7345
packages-dir: artifact/

.github/workflows/tests.yaml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Tests
22
on:
3+
pull_request:
4+
paths-ignore: ['docs/**', 'README.md']
35
push:
46
branches: [main, stable]
5-
paths-ignore: ['docs/**', '*.md', '*.rst']
6-
pull_request:
7-
paths-ignore: [ 'docs/**', '*.md', '*.rst' ]
7+
paths-ignore: ['docs/**', 'README.md']
88
jobs:
99
tests:
1010
name: ${{ matrix.name || matrix.python }}
@@ -14,37 +14,36 @@ jobs:
1414
matrix:
1515
include:
1616
- {python: '3.13'}
17+
- {name: Windows, python: '3.13', os: windows-latest}
18+
- {name: Mac, python: '3.13', os: macos-latest}
1719
- {python: '3.12'}
18-
- {name: Windows, python: '3.12', os: windows-latest}
19-
- {name: Mac, python: '3.12', os: macos-latest}
2020
- {python: '3.11'}
2121
- {python: '3.10'}
22-
- {python: '3.9'}
23-
- {python: '3.8'}
24-
- {name: PyPy, python: 'pypy-3.10', tox: pypy310}
22+
- {name: PyPy, python: 'pypy-3.11', tox: pypy3.11}
2523
steps:
2624
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
25+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
26+
with:
27+
enable-cache: true
28+
prune-cache: false
29+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2830
with:
2931
python-version: ${{ matrix.python }}
30-
allow-prereleases: true
31-
cache: pip
32-
cache-dependency-path: requirements*/*.txt
33-
- run: pip install tox
34-
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
32+
- run: uv run --locked tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
3533
typing:
3634
runs-on: ubuntu-latest
3735
steps:
3836
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
37+
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
38+
with:
39+
enable-cache: true
40+
prune-cache: false
41+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4042
with:
41-
python-version: '3.x'
42-
cache: pip
43-
cache-dependency-path: requirements*/*.txt
43+
python-version-file: pyproject.toml
4444
- name: cache mypy
4545
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4646
with:
4747
path: ./.mypy_cache
4848
key: mypy|${{ hashFiles('pyproject.toml') }}
49-
- run: pip install tox
50-
- run: tox run -e typing
49+
- run: uv run --locked tox run -e typing

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
.idea/
22
.vscode/
3-
.venv*/
4-
venv*/
5-
.env*/
6-
env*/
73
__pycache__/
84
dist/
95
.coverage*

.pre-commit-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.1
3+
rev: 9aeda5d1f4bbd212c557da1ea78eca9e8c829e19 # frozen: v0.11.13
44
hooks:
55
- id: ruff
66
- id: ruff-format
7+
- repo: https://github.com/astral-sh/uv-pre-commit
8+
rev: a621b109bab2e7e832d98c88fd3e83399f4e6657 # frozen: 0.7.12
9+
hooks:
10+
- id: uv-lock
711
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v5.0.0
12+
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
913
hooks:
1014
- id: check-merge-conflict
1115
- id: debug-statements

.readthedocs.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
version: 2
2+
# Do not specify sphinx key here to be in full control of build steps.
3+
# https://docs.readthedocs.com/platform/stable/build-customization.html#extend-or-override-the-build-process
4+
25
build:
3-
os: ubuntu-22.04
6+
os: ubuntu-24.04
47
tools:
5-
python: '3.12'
6-
python:
7-
install:
8-
- requirements: requirements/docs.txt
9-
- method: pip
10-
path: .
11-
sphinx:
12-
builder: dirhtml
13-
configuration: docs/conf.py
14-
fail_on_warning: true
8+
python: '3.13'
9+
jobs:
10+
install:
11+
- echo "Installing dependencies"
12+
- asdf plugin add uv
13+
- asdf install uv latest
14+
- asdf global uv latest
15+
build:
16+
html:
17+
- uv run --group docs sphinx-build -W -b dirhtml docs $READTHEDOCS_OUTPUT/html

CHANGES.rst

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

3+
Version 8.2.2
4+
-------------
5+
6+
Released 2025-07-31
7+
8+
- Fix reconciliation of `default`, `flag_value` and `type` parameters for
9+
flag options, as well as parsing and normalization of environment variables.
10+
:issue:`2952` :pr:`2956`
11+
- Fix typing issue in ``BadParameter`` and ``MissingParameter`` exceptions for the
12+
parameter ``param_hint`` that did not allow for a sequence of string where the
13+
underlying functino ``_join_param_hints`` allows for it. :issue:`2777` :pr:`2990`
14+
- Use the value of ``Enum`` choices to render their default value in help
15+
screen. Refs :issue:`2911` :pr:`3004`
16+
- Fix completion for the Z shell (``zsh``) for completion items containing
17+
colons. :issue:`2703` :pr:`2846`
18+
- Don't include envvar in error hint when not configured. :issue:`2971` :pr:`2972`
19+
- Fix a rare race in ``click.testing.StreamMixer``'s finalization that manifested
20+
as a ``ValueError`` on close in a multi-threaded test session.
21+
:issue:`2993` :pr:`2991`
22+
23+
Version 8.2.1
24+
-------------
25+
26+
Released 2025-05-20
27+
28+
- Fix flag value handling for flag options with a provided type. :issue:`2894`
29+
:issue:`2897` :pr:`2930`
30+
- Fix shell completion for nested groups. :issue:`2906` :pr:`2907`
31+
- Flush ``sys.stderr`` at the end of ``CliRunner.invoke``. :issue:`2682`
32+
- Fix EOF handling for stdin input in CliRunner. :issue:`2787`
33+
334
Version 8.2.0
435
-------------
536

6-
Released 2025-01-12
37+
Released 2025-05-10
738

8-
- Drop support for Python 3.7. :pr:`2588`
39+
- Drop support for Python 3.7, 3.8, and 3.9. :pr:`2588` :pr:`2893`
940
- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
1041
:pr:`2438`
1142
- Use ``flit_core`` instead of ``setuptools`` as build backend. :pr:`2543`
@@ -89,8 +120,8 @@ Released 2025-01-12
89120
- A warning will be printed when something deprecated is used.
90121

91122
- Add a ``catch_exceptions`` parameter to ``CliRunner``. If
92-
``catch_exceptions`` is not passed to ``CliRunner.invoke``,
93-
the value from ``CliRunner``. :issue:`2817` :pr:`2818`
123+
``catch_exceptions`` is not passed to ``CliRunner.invoke``, the value
124+
from ``CliRunner`` is used. :issue:`2817` :pr:`2818`
94125
- ``Option.flag_value`` will no longer have a default value set based on
95126
``Option.default`` if ``Option.is_flag`` is ``False``. This results in
96127
``Option.default`` not needing to implement `__bool__`. :pr:`2829`
@@ -104,7 +135,7 @@ Released 2025-01-12
104135
Version 8.1.8
105136
-------------
106137

107-
Unreleased
138+
Released 2024-12-19
108139

109140
- Fix an issue with type hints for ``click.open_file()``. :issue:`2717`
110141
- Fix issue where error message for invalid ``click.Path`` displays on
@@ -117,6 +148,19 @@ Unreleased
117148
:issue:`2632`
118149
- Fix ``click.echo(color=...)`` passing ``color`` to coloroma so it can be
119150
forced on Windows. :issue:`2606`.
151+
- More robust bash version check, fixing problem on Windows with git-bash.
152+
:issue:`2638`
153+
- Cache the help option generated by the ``help_option_names`` setting to
154+
respect its eagerness. :pr:`2811`
155+
- Replace uses of ``os.system`` with ``subprocess.Popen``. :issue:`1476`
156+
- Exceptions generated during a command will use the context's ``color``
157+
setting when being displayed. :issue:`2193`
158+
- Error message when defining option with invalid name is more descriptive.
159+
:issue:`2452`
160+
- Refactor code generating default ``--help`` option to deduplicate code.
161+
:pr:`2563`
162+
- Test ``CLIRunner`` resets patched ``_compat.should_strip_ansi``.
163+
:issue:`2732`
120164

121165

122166
Version 8.1.7

0 commit comments

Comments
 (0)