From e3834772a6fb060b3178ca7b971707fc57799310 Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Wed, 30 Nov 2022 09:52:01 +0100 Subject: [PATCH] New upstream version 8.1.3 --- .github/dependabot.yml | 9 +- .github/workflows/lock.yaml | 6 +- .github/workflows/tests.yaml | 25 ++- .gitignore | 1 + .pre-commit-config.yaml | 14 +- .readthedocs.yaml | 4 + CHANGES.rst | 110 +++++++++++++ docs/.DS_Store | Bin 8196 -> 0 bytes docs/api.rst | 2 - docs/options.rst | 29 +++- docs/quickstart.rst | 2 +- docs/shell-completion.rst | 2 + examples/README | 2 +- requirements/dev.in | 2 +- requirements/dev.txt | 133 +++------------ requirements/docs.txt | 50 +++--- requirements/tests.txt | 17 +- requirements/typing.txt | 13 +- setup.cfg | 15 +- src/click/__init__.py | 4 +- src/click/_compat.py | 7 +- src/click/_termui_impl.py | 1 - src/click/_unicodefun.py | 100 ------------ src/click/core.py | 269 ++++++++++++++++++------------- src/click/decorators.py | 133 ++++++++++----- src/click/globals.py | 5 +- src/click/shell_completion.py | 21 ++- src/click/termui.py | 30 +--- src/click/testing.py | 8 +- src/click/types.py | 69 +++++--- src/click/utils.py | 77 ++++----- tests/test_arguments.py | 32 ++-- tests/test_basic.py | 189 +++++++++++----------- tests/test_chain.py | 67 ++++---- tests/test_command_decorators.py | 51 ++++++ tests/test_commands.py | 135 +++++++++++----- tests/test_context.py | 8 + tests/test_formatting.py | 3 +- tests/test_info_dict.py | 7 + tests/test_options.py | 101 ++++++++++-- tests/test_parser.py | 15 ++ tests/test_shell_completion.py | 53 ++++-- tests/test_termui.py | 17 +- tests/test_utils.py | 32 ++-- tox.ini | 2 +- 45 files changed, 1097 insertions(+), 775 deletions(-) delete mode 100644 docs/.DS_Store delete mode 100644 src/click/_unicodefun.py create mode 100644 tests/test_command_decorators.py diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 86e010d..90f94bc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,9 @@ version: 2 updates: -- package-ecosystem: pip +- package-ecosystem: "github-actions" directory: "/" schedule: - interval: monthly - time: "08:00" - open-pull-requests-limit: 99 + interval: "monthly" + day: "monday" + time: "16:00" + timezone: "UTC" diff --git a/.github/workflows/lock.yaml b/.github/workflows/lock.yaml index 7128f38..b4f7633 100644 --- a/.github/workflows/lock.yaml +++ b/.github/workflows/lock.yaml @@ -8,8 +8,8 @@ jobs: lock: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v2 + - uses: dessant/lock-threads@v3 with: github-token: ${{ github.token }} - issue-lock-inactive-days: 14 - pr-lock-inactive-days: 14 + issue-inactive-days: 14 + pr-inactive-days: 14 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b00a866..64268e1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -24,32 +24,27 @@ jobs: fail-fast: false matrix: include: - - {name: Linux, python: '3.9', os: ubuntu-latest, tox: py39} - - {name: Windows, python: '3.9', os: windows-latest, tox: py39} - - {name: Mac, python: '3.9', os: macos-latest, tox: py39} + - {name: Linux, python: '3.10', os: ubuntu-latest, tox: py310} + - {name: Windows, python: '3.10', os: windows-latest, tox: py310} + - {name: Mac, python: '3.10', os: macos-latest, tox: py310} + - {name: '3.11-dev', python: '3.11-dev', os: ubuntu-latest, tox: py311} + - {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39} - {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38} - {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37} - - {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36} - - {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3} - - {name: Typing, python: '3.9', os: ubuntu-latest, tox: typing} + - {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37} + - {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing} steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} + cache: 'pip' + cache-dependency-path: 'requirements/*.txt' - name: update pip run: | pip install -U wheel pip install -U setuptools python -m pip install -U pip - - name: get pip cache dir - id: pip-cache - run: echo "::set-output name=dir::$(pip cache dir)" - - name: cache pip - uses: actions/cache@v2 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}|${{ hashFiles('requirements/*.txt') }} - name: cache mypy uses: actions/cache@v2 with: diff --git a/.gitignore b/.gitignore index fc5a65f..c1a1723 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /.idea/ /.vscode/ +.DS_Store/ /env/ /venv/ __pycache__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a1f9e7..472866d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,31 @@ ci: + autoupdate_branch: "8.1.x" autoupdate_schedule: monthly repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.29.0 + rev: v2.32.0 hooks: - id: pyupgrade - args: ["--py36-plus"] + args: ["--py37-plus"] - repo: https://github.com/asottile/reorder_python_imports - rev: v2.6.0 + rev: v3.1.0 hooks: - id: reorder-python-imports args: ["--application-directories", "src"] + additional_dependencies: ["setuptools>60.9"] - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 + rev: 4.0.1 hooks: - id: flake8 additional_dependencies: - flake8-bugbear - flake8-implicit-str-concat - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.2.0 hooks: - id: fix-byte-order-marker - id: trailing-whitespace diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 0c36363..346900b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,4 +1,8 @@ version: 2 +build: + os: ubuntu-20.04 + tools: + python: "3.10" python: install: - requirements: requirements/docs.txt diff --git a/CHANGES.rst b/CHANGES.rst index b65e91d..1766567 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,115 @@ .. currentmodule:: click +Version 8.1.3 +------------- + +Released 2022-04-28 + +- Use verbose form of ``typing.Callable`` for ``@command`` and + ``@group``. :issue:`2255` +- Show error when attempting to create an option with + ``multiple=True, is_flag=True``. Use ``count`` instead. + :issue:`2246` + + +Version 8.1.2 +------------- + +Released 2022-03-31 + +- Fix error message for readable path check that was mixed up with the + executable check. :pr:`2236` +- Restore parameter order for ``Path``, placing the ``executable`` + parameter at the end. It is recommended to use keyword arguments + instead of positional arguments. :issue:`2235` + + +Version 8.1.1 +------------- + +Released 2022-03-30 + +- Fix an issue with decorator typing that caused type checking to + report that a command was not callable. :issue:`2227` + + +Version 8.1.0 +------------- + +Released 2022-03-28 + +- Drop support for Python 3.6. :pr:`2129` +- Remove previously deprecated code. :pr:`2130` + + - ``Group.resultcallback`` is renamed to ``result_callback``. + - ``autocompletion`` parameter to ``Command`` is renamed to + ``shell_complete``. + - ``get_terminal_size`` is removed, use + ``shutil.get_terminal_size`` instead. + - ``get_os_args`` is removed, use ``sys.argv[1:]`` instead. + +- Rely on :pep:`538` and :pep:`540` to handle selecting UTF-8 encoding + instead of ASCII. Click's locale encoding detection is removed. + :issue:`2198` +- Single options boolean flags with ``show_default=True`` only show + the default if it is ``True``. :issue:`1971` +- The ``command`` and ``group`` decorators can be applied with or + without parentheses. :issue:`1359` +- The ``Path`` type can check whether the target is executable. + :issue:`1961` +- ``Command.show_default`` overrides ``Context.show_default``, instead + of the other way around. :issue:`1963` +- Parameter decorators and ``@group`` handles ``cls=None`` the same as + not passing ``cls``. ``@option`` handles ``help=None`` the same as + not passing ``help``. :issue:`#1959` +- A flag option with ``required=True`` requires that the flag is + passed instead of choosing the implicit default value. :issue:`1978` +- Indentation in help text passed to ``Option`` and ``Command`` is + cleaned the same as using the ``@option`` and ``@command`` + decorators does. A command's ``epilog`` and ``short_help`` are also + processed. :issue:`1985` +- Store unprocessed ``Command.help``, ``epilog`` and ``short_help`` + strings. Processing is only done when formatting help text for + output. :issue:`2149` +- Allow empty str input for ``prompt()`` when + ``confirmation_prompt=True`` and ``default=""``. :issue:`2157` +- Windows glob pattern expansion doesn't fail if a value is an invalid + pattern. :issue:`2195` +- It's possible to pass a list of ``params`` to ``@command``. Any + params defined with decorators are appended to the passed params. + :issue:`2131`. +- ``@command`` decorator is annotated as returning the correct type if + a ``cls`` argument is used. :issue:`2211` +- A ``Group`` with ``invoke_without_command=True`` and ``chain=False`` + will invoke its result callback with the group function's return + value. :issue:`2124` +- ``to_info_dict`` will not fail if a ``ParamType`` doesn't define a + ``name``. :issue:`2168` +- Shell completion prioritizes option values with option prefixes over + new options. :issue:`2040` +- Options that get an environment variable value using + ``autoenvvar_prefix`` treat an empty value as ``None``, consistent + with a direct ``envvar``. :issue:`2146` + + +Version 8.0.4 +------------- + +Released 2022-02-18 + +- ``open_file`` recognizes ``Path("-")`` as a standard stream, the + same as the string ``"-"``. :issue:`2106` +- The ``option`` and ``argument`` decorators preserve the type + annotation of the decorated function. :pr:`2155` +- A callable default value can customize its help text by overriding + ``__str__`` instead of always showing ``(dynamic)``. :issue:`2099` +- Fix a typo in the Bash completion script that affected file and + directory completion. If this script was generated by a previous + version, it should be regenerated. :issue:`2163` +- Fix typing for ``echo`` and ``secho`` file argument. + :issue:`2174, 2185` + + Version 8.0.3 ------------- diff --git a/docs/.DS_Store b/docs/.DS_Store deleted file mode 100644 index 5a9186236dc8dcd3dbbd29203f0d81d33a83f323..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM&2G~`5T0!dagw$aQK>y4UywMosHM;%A*3jjLk~zuL4X9PjpHXB z!aD$Oz@zX4yaIO~pnNlHik;XMCxn#UXm>XDd^cgU>GnA7zPXj{{sVfW^=JJp8NW)X$=F0 zfvIGG&j%ZoWhs&)E#>GyBPjsn94<>iA9;Xa>`0a(Inq*~7*l5tDuSvg#ZVfK`!=gX zmLfUQQo~7UIH}08iZT=>)`7D{om5Fn(;5a01CtDJ?tYo}$)O&##`1UGO7~H3o=FjK zLf7ec!YJ4O=7e6W)7{wku4ZQEE?v%9R>3MP6kb=FLBGO5=J`}<4F4+FnjZTa=KfLm@IDzBcmd^hNqgP!kpWSok=VOe=AzrVCP7~H+L zxn^%|-yW{ngPom?HT%xi_HdZDR&H!Q*gH5neK&YN{P0=aAQhb>bVYwZZ@-|IaPqj) z_PxMw;5uV+Age=Ns-m{27JJ>nbbUpQ(=`u0myXf;RHHijx2VndBu=f2;c`HP7(ZS6 zZkC}BckUuAoHEPQ28bEp!V3bsw5(uASfiMq$0@ynew3}s77>VPG z5iW$aI-R6j6F%aooS=Lacymbd1!+}C&LDF5l3Cc>IAU!hef@{0T|8X zL|HLT7R4i8=TM@9kr^w&yd===2&FA zSt#ZqY4NQbc{TW^_j4QQbc@VM63cvdfoF>WK3$5ti#RbB>#gT`OG0QP(hMU!o?ESX;*k>_rI6+5R(k@lh58(~$LYFPpHI>|9! z8wRF?0X4T<*)7A_-@l2+{pMWTMm<2~!g?bu1%gJ>aY#wWA