Merge branch 'main' into fix/help-option-shadowing-suggestion
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Rowlando13 · committed by GitHub · parents a34f960, 8d34495 · Browse files · 22 files·+406 added−169 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
22 files+406 added−169 removed
- tests:+117 added−29 removed
- other:+289 added−140 removed
Provenance
- Commit
2d0490b- Tree
10382ce- Author
Rowlando13 <67291205+Rowlando13@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent 1
a34f960- Parent 2
8d34495
22 files changed+406 added−169 removed
modified:docs/commands.md+29 added
349 unmodified lines350 }351 })352 ```353 354+### Multi-value parameters355+356+When a `default_map` value is a string for a parameter with `nargs > 1` or a357+{class}`Tuple` type, the string is split automatically, the same way an358+environment variable would be. By default, values are split on whitespace. See359+[Multiple Options from Environment360+Values](options.md#multiple-options-from-environment-values) for details on361+splitting behavior.362+363+```python364+default_map = {365+ "draw": {366+ "point": "3 4", # split into ("3", "4") for nargs=2367+ "color": "red", # passed as-is for nargs=1368+ }369+}370+```371+372+You can also pass an already-structured tuple or list, which will be used as-is373+without splitting:374+375+```python376+default_map = {377+ "draw": {378+ "point": (3, 4), # used directly379+ }380+}381+```382+383 ## Context Defaults384 385 ```{versionadded} 2.0386 ```81 unmodified linesmodified:docs/conf.py+1 added
29 unmodified lines30 }31 intersphinx_mapping = {32 "python": ("https://docs.python.org/3/", None),33 }34+myst_heading_anchors = 335 36 # HTML -----------------------------------------------------------------37 38 html_theme = "click"20 unmodified linesmodified:docs/contributing.md+27 added-4 removed
1233456789101112139141516171819201521222324252627212829303132333435363738394041424344# Contributing
This is a quick reference for Click-specific development tasks. For setting up the development environment and the general contribution workflow, see the Pallets [quick reference](https://palletsprojects.com/contributing/quick/) and the [detailed contributing guide](https://palletsprojects.com/contributing/).This is a quick reference for Click-specific developmenttasks. For setting up the development environment and thegeneral contribution workflow, see the Pallets [quickreference](https://palletsprojects.com/contributing/quick/)and the [detailed contributingguide](https://palletsprojects.com/contributing/).
## Extra Test Environments
Click includes some extra test environments:
- `tox r -e stress` runs stress tests for race conditions in Click's test runner.- `tox r -e stress` runs stress tests for race conditions in Click's test runner.
```shell-session $ tox r -e stress ```
- `tox r -e random` runs tests in parallel in a random order to detect test pollution.- `tox r -e random` runs tests in parallel in a random order to detect test pollution.
```shell-session $ tox r -e random ```
- A CI workflow (`.github/workflows/test-flask.yaml`) runs Flask's test suite to catch downstream regressions.- A CI workflow (`.github/workflows/test-flask.yaml`) runs Flask's test suite to catch downstream regressions.
## Code Style
Avoid ternary expressions (`x if cond else y`): coveragecannot measure both branches. Use an explicit `if`/`else`block instead.
Do not add unnecessary dependencies. If a feature can beimplemented with the standard library, do not pull in anexternal package for it.
## Formatting
Wrap lines in Markdown files at 80 characters.modified:docs/parameter-types.md+21 added-2 removed
68 unmodified lines69 The resulting value from an option will always be one of the originally passed choices70 regardless of `case_sensitive`.71 ```72 73+```{versionchanged} 8.4.074+{class}`Choice` is now generic. Parameterize it with the choice value type75+({class}`!Choice[HashType]` for an enum, {class}`!Choice[str]` for plain76+strings) to enable type-checked consumers.77+```78+79 (ranges)=80 81 ### Int and Float Ranges82 75 unmodified lines158 To implement a custom type, you need to subclass the {class}`ParamType` class. For simple cases, passing a Python159 function that fails with a `ValueError` is also supported, though discouraged. Override the {meth}`~ParamType.convert`160 method to convert the value from a string to the correct type.161 162+{class}`ParamType` is generic in the converted value type: parameterize it with163+the type returned by `convert` so that consumers (and type checkers) can rely164+on the narrowed return type.165+166 The following code implements an integer type that accepts hex and octal numbers in addition to normal integers, and167 converts them into regular integers.168 169 ```python170 import click171 172+162-class BasedIntParamType(click.ParamType):173+class BasedIntParamType(click.ParamType[int]):174 name = "integer"175 165- def convert(self, value, param, ctx):176+ def convert(self, value, param, ctx) -> int:177 if isinstance(value, int):178 return value179 180 try:4 unmodified lines185 return int(value, 10)186 except ValueError:187 self.fail(f"{value!r} is not a valid integer", param, ctx)188 189+190 BASED_INT = BasedIntParamType()191 ```192 193 The {attr}`~ParamType.name` attribute is optional and is used for documentation. Call {meth}`~ParamType.fail` if1 unmodified line195 196 Values from user input or the command line will be strings, but default values and Python arguments may already be the197 correct type. The custom type should check at the top if the value is already valid and pass it through to support those198 cases.199+200+```{versionchanged} 8.4.0201+{class}`ParamType` is now a generic abstract base class. Parameterize it with202+the converted value type ({class}`!ParamType[int]` for an integer-returning203+type) so that {meth}`~ParamType.convert` and downstream consumers carry the204+narrowed type.205+```modified:docs/shell-completion.md+1 added-1 removed
118 unmodified lines119 120 In this example, the type will suggest environment variables that start with the incomplete value.121 122 ```python123-class EnvVarType(ParamType):123+class EnvVarType(ParamType[str]):124 name = "envvar"125 126 def shell_complete(self, ctx, param, incomplete):127 return [122 unmodified linesmodified:docs/support-multiple-versions.md+1 added-1 removed
53 unmodified lines5455565758585960616253 unmodified lines
Here's an example ``ParamType`` subclass which uses this:
```pythonclass CommaDelimitedString(click.ParamType):class CommaDelimitedString(click.ParamType[str]): @add_ctx_arg def get_metavar(self, param: click.Parameter, ctx: click.Context | None) -> str: return "TEXT,TEXT,..."```modified:examples/aliases/aliases.py+1 added-1 removed
38 unmodified lines39 file and with a bit of magic.40 """41 42 def get_command(self, ctx, cmd_name):43- # Step one: bulitin commands as normal43+ # Step one: built-in commands as normal44 rv = click.Group.get_command(self, ctx, cmd_name)45 if rv is not None:46 return rv47 96 unmodified linesmodified:examples/repo/repo.py+1 added-1 removed
46 unmodified lines47 48 This tool is supposed to look like a distributed version control49 system to show how something like this can be structured.50 """51- # Create a repo object and remember it as as the context object. From51+ # Create a repo object and remember it as the context object. From52 # this point onwards other commands can refer to it by using the53 # @pass_repo decorator.54 ctx.obj = Repo(os.path.abspath(repo_home))55 ctx.obj.verbose = verbose111 unmodified linesmodified:examples/validation/validation.py+2 added-2 removed
7 unmodified lines8 raise click.BadParameter("Should be a positive, even integer.")9 return value10 11 12-class URL(click.ParamType):12+class URL(click.ParamType[urlparse.ParseResult]):13 name = "url"14 15- def convert(self, value, param, ctx):15+ def convert(self, value, param, ctx) -> urlparse.ParseResult:16 if not isinstance(value, tuple):17 value = urlparse.urlparse(value)18 if value.scheme not in ("http", "https"):19 self.fail(29 unmodified linesmodified:src/click/core.py+34 added-10 removed
194 unmodified lines195 :param parent: the parent context.196 :param info_name: the info name for this invocation. Generally this197 is the most descriptive name for the script or198 command. For the toplevel script it is usually199- the name of the script, for commands below it it's199+ the name of the script, for commands below that it's200 the name of the script.201 :param obj: an arbitrary object of user data.202 :param auto_envvar_prefix: the prefix to use for automatic environment203 variables. If this is `None` then reading890 unmodified lines1094 return None1095 1096 # Cache the help option object in private _help_option attribute to1097 # avoid creating it multiple times. Not doing this will break the1098- # callback odering by iter_params_for_processing(), which relies on1098+ # callback ordering by iter_params_for_processing(), which relies on1099 # object comparison.1100 if self._help_option is None:1101 # Avoid circular import.1102 from .decorators import help_option1045 unmodified lines2148 2149 def __init__(2150 self,2151 param_decls: cabc.Sequence[str] | None = None,2152- type: types.ParamType | t.Any | None = None,2152+ type: types.ParamType[t.Any] | t.Any | None = None,2153 required: bool = False,2154 # XXX The default historically embed two concepts:2155 # - the declaration of a Parameter object carrying the default (handy to2156 # arbitrage the default value of coupled Parameters sharing the same23 unmodified lines2180 self.secondary_opts: list[str]2181 self.name, self.opts, self.secondary_opts = self._parse_decls(2182 param_decls or (), expose_value2183 )2184- self.type: types.ParamType = types.convert_type(type, default)2184+ self.type: types.ParamType[t.Any] = types.convert_type(type, default)2185 2186 # Default nargs to what the type tells us if we have that2187 # information available.2188 if nargs is None:166 unmodified lines2355 if default_map_value is not None or ctx._default_map_has(self.name):2356 value = default_map_value2357 source = ParameterSource.DEFAULT_MAP2358 2359+ # A string from default_map must be split for multi-value2360+ # parameters, matching value_from_envvar behavior.2361+ if isinstance(value, str) and self.nargs != 1:2362+ value = self.type.split_envvar_value(value)2363+2364 if value is UNSET:2365 default_value = self.get_default(ctx)2366 if default_value is not UNSET:2367 value = default_value284 unmodified lines2652 def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]:2653 """Return a list of completions for the incomplete value. If a2654 ``shell_complete`` function was given during init, it is used.2655 Otherwise, the :attr:`type`2651- :meth:`~click.types.ParamType.shell_complete` function is used.2656+ :meth:`~click.types.ParamType[t.Any].shell_complete` function is used.2657 2658 :param ctx: Invocation context for this command.2659 :param incomplete: Value being completed. May be empty.2660 57 unmodified lines2718 :param help: the help string.2719 :param hidden: hide this option from help outputs.2720 :param attrs: Other command arguments described in :class:`Parameter`.2721 2722+ .. versionchanged:: 8.42723+ Non-basic ``flag_value`` types (not ``str``, ``int``, ``float``, or2724+ ``bool``) are passed through unchanged instead of being stringified.2725+ Previously, ``type=click.UNPROCESSED`` was required to preserve them.2726+2727 .. versionchanged:: 8.22728 ``envvar`` used with ``flag_value`` will always use the ``flag_value``,2729 previously it would use the value of the environment variable.2730 9 unmodified lines2740 The default of a single option boolean flag is not shown if the2741 default value is ``False``.2742 2743 .. versionchanged:: 8.0.12734- ``type`` is detected from ``flag_value`` if given.2744+ ``type`` is detected from ``flag_value`` if given, for basic Python2745+ types (``str``, ``int``, ``float``, ``bool``).2746 """2747 2748 param_type_name = "option"2749 9 unmodified lines2759 flag_value: t.Any = UNSET,2760 multiple: bool = False,2761 count: bool = False,2762 allow_from_autoenv: bool = True,2752- type: types.ParamType | t.Any | None = None,2763+ type: types.ParamType[t.Any] | t.Any | None = None,2764 help: str | None = None,2765 hidden: bool = False,2766 show_choices: bool = True,2767 show_envvar: bool = False,67 unmodified lines2835 # Auto-detect the type of the flag based on the flag_value.2836 if type is None:2837 # A flag without a flag_value is a boolean flag.2838 if flag_value is UNSET:2828- self.type: types.ParamType = types.BoolParamType()2839+ self.type: types.ParamType[t.Any] = types.BoolParamType()2840 # If the flag value is a boolean, use BoolParamType.2841 elif isinstance(flag_value, bool):2842 self.type = types.BoolParamType()2843 # Otherwise, guess the type from the flag value.2844 else:2834- self.type = types.convert_type(None, flag_value)2845+ guessed = types.convert_type(None, flag_value)2846+ if (2847+ isinstance(guessed, types.StringParamType)2848+ and not isinstance(flag_value, str)2849+ and flag_value is not None2850+ ):2851+ # The flag_value type couldn't be auto-detected2852+ # (not str, int, float, or bool). Since flag_value2853+ # is a programmer-provided Python object, not CLI2854+ # input, pass it through unchanged instead of2855+ # stringifying it.2856+ self.type = types.UNPROCESSED2857+ else:2858+ self.type = guessed2859 2860 self.is_flag: bool = bool(is_flag)2861 self.is_bool_flag: bool = bool(2862 is_flag and isinstance(self.type, types.BoolParamType)4 unmodified lines2867 if self.is_bool_flag:2868 if self.default is UNSET and not self.required:2869 self.default = False2870 2847- # The alignement of default to the flag_value is resolved lazily in2871+ # The alignment of default to the flag_value is resolved lazily in2872 # get_default() to prevent callable flag_values (like classes) from2873 # being instantiated. Refs:2874 # https://github.com/pallets/click/issues/31212875 # https://github.com/pallets/click/issues/3024#issuecomment-3146199461625 unmodified linesmodified:src/click/parser.py+1 added-1 removed
419 unmodified lines420 break421 422 # If we got any unknown options we recombine the string of the423 # remaining options and re-attach the prefix, then report that424- # to the state as new larg. This way there is basic combinatorics424+ # to the state as new large. This way there is basic combinatorics425 # that can be achieved while still ignoring unknown arguments.426 if self.ignore_unknown_options and unknown_options:427 state.largs.append(f"{prefix}{''.join(unknown_options)}")428 104 unmodified linesmodified:src/click/termui.py+2 added-2 removed
61 unmodified lines62 suffix: str,63 show_default: bool | str = False,64 default: t.Any | None = None,65 show_choices: bool = True,66- type: ParamType | None = None,66+ type: ParamType[t.Any] | None = None,67 ) -> str:68 prompt = text69 if type is not None and show_choices and isinstance(type, Choice):70 prompt += f" ({', '.join(map(str, type.choices))})"15 unmodified lines86 text: str,87 default: t.Any | None = None,88 hide_input: bool = False,89 confirmation_prompt: bool | str = False,90- type: ParamType | t.Any | None = None,90+ type: ParamType[t.Any] | t.Any | None = None,91 value_proc: t.Callable[[str], t.Any] | None = None,92 prompt_suffix: str = ": ",93 show_default: bool | str = True,94 err: bool = False,797 unmodified linesmodified:src/click/types.py+145 added-97 removed
1 from __future__ import annotations2 3+import abc4 import collections.abc as cabc5 import enum6 import os7 import stat8 import sys9 import typing as t10+import uuid11 from datetime import datetime12 from gettext import gettext as _13 from gettext import ngettext14 13 unmodified lines28 29 ParamTypeValue = t.TypeVar("ParamTypeValue")30 31 30-class ParamType:32+class ParamTypeInfoDict(t.TypedDict):33+ param_type: str34+ name: str35+36+37+class ParamType(t.Generic[ParamTypeValue], abc.ABC):38 """Represents the type of a parameter. Validates and converts values39 from the command line or Python into the correct type.40 41 To implement a custom type, subclass and implement at least the23 unmodified lines65 #: are split by ``os.path.pathsep`` by default (":" on Unix and ";" on66 #: Windows).67 envvar_list_splitter: t.ClassVar[str | None] = None68 62- def to_info_dict(self) -> dict[str, t.Any]:69+ def to_info_dict(self) -> ParamTypeInfoDict:70 """Gather information that could be useful for a tool generating71 user-facing documentation.72 73 Use :meth:`click.Context.to_info_dict` to traverse the entire17 unmodified lines91 self,92 value: t.Any,93 param: Parameter | None = None,94 ctx: Context | None = None,88- ) -> t.Any:95+ ) -> ParamTypeValue | None:96 if value is not None:97 return self.convert(value, param, ctx)98+ return None99 100 def get_metavar(self, param: Parameter, ctx: Context) -> str | None:101 """Returns the metavar default for this param if it provides one."""102 5 unmodified lines108 """109 110 def convert(111 self, value: t.Any, param: Parameter | None, ctx: Context | None104- ) -> t.Any:112+ ) -> ParamTypeValue:113 """Convert the value to the correct type. This is not called if114 the value is ``None`` (the missing value).115 116 This must accept string values from the command line, as well as11 unmodified lines128 its value. May be ``None``.129 :param ctx: The current context that arrived at this value. May130 be ``None``.131 """124- return value132+ # The default returns the value as-is so subclasses that only customize133+ # metadata are not forced to redeclare ``convert``.134+ return t.cast("ParamTypeValue", value)135 136 def split_envvar_value(self, rv: str) -> cabc.Sequence[str]:137 """Given a value from an environment variable this splits it up138 into small chunks depending on the defined envvar list splitter.30 unmodified lines169 """170 return []171 172 163-class CompositeParamType(ParamType):173+class CompositeParamType(ParamType[ParamTypeValue]):174 is_composite = True175 176 @property167- def arity(self) -> int: # type: ignore168- raise NotImplementedError()177+ @abc.abstractmethod178+ def arity(self) -> int: ... # type: ignore[override]179 180 171-class FuncParamType(ParamType):172- def __init__(self, func: t.Callable[[t.Any], t.Any]) -> None:181+class FuncParamTypeInfoDict(ParamTypeInfoDict):182+ func: t.Callable[[t.Any], t.Any]183+184+185+class FuncParamType(ParamType[ParamTypeValue]):186+ def __init__(self, func: t.Callable[[t.Any], ParamTypeValue]) -> None:187 self.name: str = func.__name__188 self.func = func189 176- def to_info_dict(self) -> dict[str, t.Any]:177- info_dict = super().to_info_dict()178- info_dict["func"] = self.func179- return info_dict190+ def to_info_dict(self) -> FuncParamTypeInfoDict:191+ return {"func": self.func, **super().to_info_dict()}192 193 def convert(194 self, value: t.Any, param: Parameter | None, ctx: Context | None183- ) -> t.Any:195+ ) -> ParamTypeValue:196 try:197 return self.func(value)198 except ValueError:199 try:3 unmodified lines203 204 self.fail(value, param, ctx)205 206 195-class UnprocessedParamType(ParamType):207+class UnprocessedParamType(ParamType[t.Any]):208 name = "text"209 210 def convert(211 self, value: t.Any, param: Parameter | None, ctx: Context | None3 unmodified lines215 def __repr__(self) -> str:216 return "UNPROCESSED"217 218 207-class StringParamType(ParamType):219+class StringParamType(ParamType[str]):220 name = "text"221 222 def convert(223 self, value: t.Any, param: Parameter | None, ctx: Context | None212- ) -> t.Any:224+ ) -> str:225 if isinstance(value, bytes):226 enc = _get_argv_encoding()227 try:228 value = value.decode(enc)5 unmodified lines234 except UnicodeError:235 value = value.decode("utf-8", "replace")236 else:237 value = value.decode("utf-8", "replace")226- return value238+ return value # type: ignore[no-any-return]239 return str(value)240 241 def __repr__(self) -> str:242 return "STRING"243 244 233-class Choice(ParamType, t.Generic[ParamTypeValue]):245+class ChoiceInfoDict(ParamTypeInfoDict):246+ choices: cabc.Sequence[t.Any]247+ case_sensitive: bool248+249+250+class Choice(ParamType[ParamTypeValue], t.Generic[ParamTypeValue]):251 """The choice type allows a value to be checked against a fixed set252 of supported values.253 254 You may pass any iterable value which will be converted to a tuple22 unmodified lines277 ) -> None:278 self.choices: cabc.Sequence[ParamTypeValue] = tuple(choices)279 self.case_sensitive = case_sensitive280 264- def to_info_dict(self) -> dict[str, t.Any]:265- info_dict = super().to_info_dict()266- info_dict["choices"] = self.choices267- info_dict["case_sensitive"] = self.case_sensitive268- return info_dict281+ def to_info_dict(self) -> ChoiceInfoDict:282+ return {283+ "choices": self.choices,284+ "case_sensitive": self.case_sensitive,285+ **super().to_info_dict(),286+ }287 288 def _normalized_mapping(289 self, ctx: Context | None = None290 ) -> cabc.Mapping[ParamTypeValue, str]:124 unmodified lines415 416 return [CompletionItem(c) for c in matched]417 418 401-class DateTime(ParamType):419+class DateTimeInfoDict(ParamTypeInfoDict):420+ formats: cabc.Sequence[str]421+422+423+class DateTime(ParamType[datetime]):424 """The DateTime type converts date strings into `datetime` objects.425 426 The format strings which are checked are configurable, but default to some427 common (non-timezone aware) ISO 8601 formats.21 unmodified lines449 "%Y-%m-%dT%H:%M:%S",450 "%Y-%m-%d %H:%M:%S",451 ]452 431- def to_info_dict(self) -> dict[str, t.Any]:432- info_dict = super().to_info_dict()433- info_dict["formats"] = self.formats434- return info_dict453+ def to_info_dict(self) -> DateTimeInfoDict:454+ return {"formats": self.formats, **super().to_info_dict()}455 456 def get_metavar(self, param: Parameter, ctx: Context) -> str | None:457 return f"[{'|'.join(self.formats)}]"458 4 unmodified lines463 return None464 465 def convert(466 self, value: t.Any, param: Parameter | None, ctx: Context | None447- ) -> t.Any:467+ ) -> datetime:468 if isinstance(value, datetime):469 return value470 471 for format in self.formats:16 unmodified lines488 def __repr__(self) -> str:489 return "DateTime"490 491 472-class _NumberParamTypeBase(ParamType):473- _number_class: t.ClassVar[type[t.Any]]492+class _NumberParamTypeBase(ParamType[ParamTypeValue]):493+ _number_class: t.Callable[[t.Any], ParamTypeValue]494 495 def convert(496 self, value: t.Any, param: Parameter | None, ctx: Context | None477- ) -> t.Any:497+ ) -> ParamTypeValue:498 try:499 return self._number_class(value)500 except ValueError:501 self.fail(4 unmodified lines506 ctx,507 )508 509 510+class NumberRangeInfoDict(ParamTypeInfoDict):511+ min: float | None512+ max: float | None513+ min_open: bool514+ max_open: bool515+ clamp: bool516+517+490-class _NumberRangeBase(_NumberParamTypeBase):518+class _NumberRangeBase(_NumberParamTypeBase[ParamTypeValue]):519 def __init__(520 self,521 min: float | None = None,522 max: float | None = None,6 unmodified lines529 self.min_open = min_open530 self.max_open = max_open531 self.clamp = clamp532 505- def to_info_dict(self) -> dict[str, t.Any]:506- info_dict = super().to_info_dict()507- info_dict.update(508- min=self.min,509- max=self.max,510- min_open=self.min_open,511- max_open=self.max_open,512- clamp=self.clamp,513- )514- return info_dict533+ def to_info_dict(self) -> NumberRangeInfoDict:534+ return {535+ "min": self.min,536+ "max": self.max,537+ "min_open": self.min_open,538+ "max_open": self.max_open,539+ "clamp": self.clamp,540+ **super().to_info_dict(),541+ }542 543 def convert(544 self, value: t.Any, param: Parameter | None, ctx: Context | None518- ) -> t.Any:545+ ) -> ParamTypeValue:546 import operator547 548 rv = super().convert(value, param, ctx)549+ min = self.min550+ max = self.max522- lt_min: bool = self.min is not None and (551+ lt_min: bool = min is not None and (552 operator.le if self.min_open else operator.lt524- )(rv, self.min)525- gt_max: bool = self.max is not None and (553+ )(rv, min) # type: ignore[arg-type]554+ gt_max: bool = max is not None and (555 operator.ge if self.max_open else operator.gt527- )(rv, self.max)556+ )(rv, max) # type: ignore[arg-type]557 558 if self.clamp:530- if lt_min:531- return self._clamp(self.min, 1, self.min_open) # type: ignore559+ if min is not None and lt_min:560+ return self._clamp(min, 1, self.min_open) # type: ignore[arg-type]561 533- if gt_max:534- return self._clamp(self.max, -1, self.max_open) # type: ignore562+ if max is not None and gt_max:563+ return self._clamp(max, -1, self.max_open) # type: ignore[arg-type]564 565 if lt_min or gt_max:566 self.fail(567 _("{value} is not in the range {range}.").format(4 unmodified lines572 )573 574 return rv575 547- def _clamp(self, bound: float, dir: t.Literal[1, -1], open: bool) -> float:576+ @abc.abstractmethod577+ def _clamp(578+ self, bound: ParamTypeValue, dir: t.Literal[1, -1], open: bool579+ ) -> ParamTypeValue:580 """Find the valid value to clamp to bound in the given581 direction.582 583 :param bound: The boundary value.584 :param dir: 1 or -1 indicating the direction to move.585 :param open: If true, the range does not include the bound.586 """555- raise NotImplementedError587+ ...588 589 def _describe_range(self) -> str:590 """Describe the range for use in help text."""591 if self.min is None:12 unmodified lines604 clamp = " clamped" if self.clamp else ""605 return f"<{type(self).__name__} {self._describe_range()}{clamp}>"606 607 576-class IntParamType(_NumberParamTypeBase):608+class IntParamType(_NumberParamTypeBase[int]):609 name = "integer"610 _number_class = int611 612 def __repr__(self) -> str:613 return "INT"614 615 584-class IntRange(_NumberRangeBase, IntParamType):616+class IntRange(_NumberRangeBase[int], IntParamType):617 """Restrict an :data:`click.INT` value to a range of accepted618 values. See :ref:`ranges`.619 620 If ``min`` or ``max`` are not passed, any value is accepted in that8 unmodified lines629 """630 631 name = "integer range"632 601- def _clamp( # type: ignore602- self, bound: int, dir: t.Literal[1, -1], open: bool603- ) -> int:633+ def _clamp(self, bound: int, dir: t.Literal[1, -1], open: bool) -> int:634 if not open:635 return bound636 637 return bound + dir638 639 610-class FloatParamType(_NumberParamTypeBase):640+class FloatParamType(_NumberParamTypeBase[float]):641 name = "float"642 _number_class = float643 644 def __repr__(self) -> str:645 return "FLOAT"646 647 618-class FloatRange(_NumberRangeBase, FloatParamType):648+class FloatRange(_NumberRangeBase[float], FloatParamType):649 """Restrict a :data:`click.FLOAT` value to a range of accepted650 values. See :ref:`ranges`.651 652 If ``min`` or ``max`` are not passed, any value is accepted in that34 unmodified lines687 # left up to the user to write a callback to do it if needed.688 raise RuntimeError("Clamping is not supported for open bounds.")689 690 661-class BoolParamType(ParamType):691+class BoolParamType(ParamType[bool]):692 name = "boolean"693 694 bool_states: dict[str, bool] = {695 "1": True,60 unmodified lines756 def __repr__(self) -> str:757 return "BOOL"758 759 730-class UUIDParameterType(ParamType):760+class UUIDParameterType(ParamType[uuid.UUID]):761 name = "uuid"762 763 def convert(764 self, value: t.Any, param: Parameter | None, ctx: Context | None735- ) -> t.Any:736- import uuid737-765+ ) -> uuid.UUID:766 if isinstance(value, uuid.UUID):767 return value768 769 value = value.strip()8 unmodified lines778 def __repr__(self) -> str:779 return "UUID"780 781 754-class File(ParamType):782+class FileInfoDict(ParamTypeInfoDict):783+ mode: str784+ encoding: str | None785+786+787+class File(ParamType[t.IO[t.Any]]):788 """Declares a parameter to be a file for reading or writing. The file789 is automatically closed once the context tears down (after the command790 finished working).791 38 unmodified lines830 self.errors = errors831 self.lazy = lazy832 self.atomic = atomic833 801- def to_info_dict(self) -> dict[str, t.Any]:802- info_dict = super().to_info_dict()803- info_dict.update(mode=self.mode, encoding=self.encoding)804- return info_dict834+ def to_info_dict(self) -> FileInfoDict:835+ return {836+ "mode": self.mode,837+ "encoding": self.encoding,838+ **super().to_info_dict(),839+ }840 841 def resolve_lazy_flag(self, value: str | os.PathLike[str]) -> bool:842 if self.lazy is not None:843 return self.lazy66 unmodified lines910 def _is_file_like(value: t.Any) -> te.TypeGuard[t.IO[t.Any]]:911 return hasattr(value, "read") or hasattr(value, "write")912 913 879-class Path(ParamType):914+class PathInfoDict(ParamTypeInfoDict):915+ exists: bool916+ file_okay: bool917+ dir_okay: bool918+ writable: bool919+ readable: bool920+ allow_dash: bool921+922+923+class Path(ParamType[str | bytes | os.PathLike[str]]):924 """The ``Path`` type is similar to the :class:`File` type, but925 returns the filename instead of an open file. Various checks can be926 enabled to validate the type of file and permissions.927 55 unmodified lines983 self.name = _("directory")984 else:985 self.name = _("path")986 943- def to_info_dict(self) -> dict[str, t.Any]:944- info_dict = super().to_info_dict()945- info_dict.update(946- exists=self.exists,947- file_okay=self.file_okay,948- dir_okay=self.dir_okay,949- writable=self.writable,950- readable=self.readable,951- allow_dash=self.allow_dash,952- )953- return info_dict987+ def to_info_dict(self) -> PathInfoDict:988+ return {989+ "exists": self.exists,990+ "file_okay": self.file_okay,991+ "dir_okay": self.dir_okay,992+ "writable": self.writable,993+ "readable": self.readable,994+ "allow_dash": self.allow_dash,995+ **super().to_info_dict(),996+ }997 998 def coerce_path_result(999 self, value: str | os.PathLike[str]1000 ) -> str | bytes | os.PathLike[str]:98 unmodified lines1099 type = "dir" if self.dir_okay and not self.file_okay else "file"1100 return [CompletionItem(incomplete, type=type)]1101 1102 1060-class Tuple(CompositeParamType):1103+class TupleInfoDict(ParamTypeInfoDict):1104+ types: cabc.Sequence[ParamTypeInfoDict]1105+1106+1107+class Tuple(CompositeParamType[tuple[t.Any, ...]]):1108 """The default behavior of Click is to apply a type on a value directly.1109 This works well in most cases, except for when `nargs` is set to a fixed1110 count and different types should be used for different items. In this1111 case the :class:`Tuple` type can be used. This type can only be used5 unmodified lines1117 1118 :param types: a list of types that should be used for the tuple items.1119 """1120 1074- def __init__(self, types: cabc.Sequence[type[t.Any] | ParamType]) -> None:1075- self.types: cabc.Sequence[ParamType] = [convert_type(ty) for ty in types]1121+ def __init__(self, types: cabc.Sequence[type[t.Any] | ParamType[t.Any]]) -> None:1122+ self.types: cabc.Sequence[ParamType[t.Any]] = [convert_type(ty) for ty in types]1123 1077- def to_info_dict(self) -> dict[str, t.Any]:1078- info_dict = super().to_info_dict()1079- info_dict["types"] = [t.to_info_dict() for t in self.types]1080- return info_dict1124+ def to_info_dict(self) -> TupleInfoDict:1125+ return {1126+ "types": [ty.to_info_dict() for ty in self.types],1127+ **super().to_info_dict(),1128+ }1129 1130 @property1083- def name(self) -> str: # type: ignore1131+ def name(self) -> str: # type: ignore[override]1132 return f"<{' '.join(ty.name for ty in self.types)}>"1133 1134 @property1087- def arity(self) -> int: # type: ignore1135+ def arity(self) -> int: # type: ignore[override]1136 return len(self.types)1137 1138 def convert(1139 self, value: t.Any, param: Parameter | None, ctx: Context | None1092- ) -> t.Any:1140+ ) -> tuple[t.Any, ...]:1141 len_type = len(self.types)1142 len_value = len(value)1143 1144 if len_value != len_type:11 unmodified lines1156 ty(x, param, ctx) for ty, x in zip(self.types, value, strict=False)1157 )1158 1159 1112-def convert_type(ty: t.Any | None, default: t.Any | None = None) -> ParamType:1160+def convert_type(ty: t.Any | None, default: t.Any | None = None) -> ParamType[t.Any]:1161 """Find the most appropriate :class:`ParamType` for the given Python1162 type. If the type isn't provided, it can be inferred from a default1163 value.1164 """59 unmodified lines1224 #: appear in bytes and unicode.1225 #:1226 #: For path related uses the :class:`Path` type is a better choice but1227 #: there are situations where an unprocessed type is useful which is why1180-#: it is is provided.1228+#: it is provided.1229 #:1230 #: .. versionadded:: 4.01231 UNPROCESSED = UnprocessedParamType()1232 25 unmodified linesmodified:tests/test_defaults.py+39 added-2 removed
82 unmodified lines83 assert result.output.splitlines() == ["<1|2>", "<3|4>"]84 85 86 def test_multiple_flag_default(runner):87- """Default default for flags when multiple=True should be empty tuple."""87+ """Default for flags when multiple=True should be empty tuple."""88 89 @click.command90 # flag due to secondary token91 @click.option("-y/-n", multiple=True)181 unmodified lines273 subclass that falls back to prefix-based lookup when the parent returns274 ``None``.275 276 Previous attempts in https://github.com/pallets/click/pr/3199 were entirely277- bypassing the user's overridded method.277+ bypassing the user's overridden method.278 """279 280 class CustomContext(click.Context):281 def lookup_default(self, name, call=True):74 unmodified lines356 assert result.exit_code == 0357 assert result.output == repr(expected)358 359 360+@pytest.mark.parametrize(361+ ("default_map", "option_kwargs", "cli_args", "expected"),362+ [363+ # String is split for nargs=2 option.364+ ({"point": "3 4"}, {"nargs": 2, "type": int}, [], (3, 4)),365+ # String is split for explicit Tuple type.366+ ({"point": "hello world"}, {"type": (str, str)}, [], ("hello", "world")),367+ # Already-structured tuple passes through unchanged.368+ ({"point": ("a", "b")}, {"nargs": 2}, [], ("a", "b")),369+ # Already-structured list passes through unchanged.370+ ({"point": [5, 6]}, {"nargs": 2, "type": int}, [], (5, 6)),371+ # CLI args override default_map for nargs > 1.372+ (373+ {"point": "3 4"},374+ {"nargs": 2, "type": int},375+ ["--point", "10", "20"],376+ (10, 20),377+ ),378+ ],379+)380+def test_default_map_nargs(runner, default_map, option_kwargs, cli_args, expected):381+ """A string in ``default_map`` for an option with ``nargs > 1`` should be382+ split the same way an environment variable string is split.383+384+ Regression test for https://github.com/pallets/click/issues/2745.385+ """386+387+ @click.command()388+ @click.option("--point", **option_kwargs)389+ def cli(point):390+ click.echo(repr(point))391+392+ result = runner.invoke(cli, cli_args, default_map=default_map)393+ assert result.exit_code == 0394+ assert result.output.strip() == repr(expected)395+396+397 def test_unset_in_default_map(runner):398 """An ``UNSET`` value in ``default_map`` should be treated as if399 the key is absent, and so fallback to the parameter's own default.400 13 unmodified linesmodified:tests/test_imports.py+2 added
25 unmodified lines26 """27 28 ALLOWED_IMPORTS = {29 "__future__",30+ "abc",31 "codecs",32 "collections",33 "collections.abc",34 "configparser",14 unmodified lines49 "sys",50 "threading",51 "types",52 "typing",53+ "uuid",54 "weakref",55 }56 57 if WIN:23 unmodified linesmodified:tests/test_options.py+74 added-25 removed
518 unmodified lines519 @pytest.mark.parametrize(520 "value",521 (522 # Extra spaces inside the value.523- "tr ue",523+ "tr ue", # codespell:ignore ue524 "fa lse",525 # Numbers.526 "10",527 "01",470 unmodified lines998 """a dumb override of a default value for testing"""999 return "I am a default"1000 1001 @click.command()1002- @click.argument("testarg", cls=CustomArgument, default="you wont see me")1002+ @click.argument("testarg", cls=CustomArgument, default="you won't see me")1003 def cmd(testarg):1004 click.echo(testarg)1005 1006 result = runner.invoke(cmd)1007 assert "I am a default" in result.output1008- assert "you wont see me" not in result.output1008+ assert "you won't see me" not in result.output1009 1010 1011 def test_option_custom_class(runner):1012 class CustomOption(click.Option):1 unmodified line1014 """a dumb override of a help text for testing"""1015 return ("--help", "I am a help text")1016 1017 @click.command()1018- @click.option("--testoption", cls=CustomOption, help="you wont see me")1018+ @click.option("--testoption", cls=CustomOption, help="you won't see me")1019 def cmd(testoption):1020 click.echo(testoption)1021 1022 result = runner.invoke(cmd, ["--help"])1023 assert "I am a help text" in result.output1024- assert "you wont see me" not in result.output1024+ assert "you won't see me" not in result.output1025 1026 1027 @pytest.mark.parametrize(1028 ("param_decl", "option_kwargs", "pass_argv"),38 unmodified lines1067 def get_help_record(self, ctx):1068 """a dumb override of a help text for testing"""1069 return ("--help", "I am a help text")1070 1071- # Assign to a variable to re-use the decorator.1072- testoption = click.option("--testoption", cls=CustomOption, help="you wont see me")1071+ # Assign to a variable to reuse the decorator.1072+ testoption = click.option("--testoption", cls=CustomOption, help="you won't see me")1073 1074 @click.command()1075 @testoption1076 def cmd1(testoption):7 unmodified lines1084 # Both of the commands should have the --help option now.1085 for cmd in (cmd1, cmd2):1086 result = runner.invoke(cmd, ["--help"])1087 assert "I am a help text" in result.output1088- assert "you wont see me" not in result.output1088+ assert "you won't see me" not in result.output1089 1090 1091 @pytest.mark.parametrize("custom_class", (True, False))1092 @pytest.mark.parametrize(312 unmodified lines1405 param = click.Option(["-a", "x"], default=True, flag_value=4)1406 assert param.type is click.INT1407 param = click.Option(["-b", "x"], flag_value=8)1408 assert param.type is click.INT1409+ # Non-basic types auto-detect as UNPROCESSED to avoid stringification.1410+ param = click.Option(["-c", "x"], flag_value=EngineType.OSS)1411+ assert param.type is click.UNPROCESSED1412+ param = click.Option(["-d", "x"], flag_value=frozenset())1413+ assert param.type is click.UNPROCESSED1414 1415 1416 @pytest.mark.parametrize(1417 ("opt_params", "args", "expected"),713 unmodified lines2131 {"type": EngineType, "flag_value": EngineType.OSS, "default": True},2132 [],2133 EngineType.OSS,2134 ),2130- # Type is not specified and default to string, so the default value is2131- # returned as a string, even if it is a boolean. Also, defaults to the2132- # flag_value instead of the default value to support legacy behavior.2135+ # Type is not specified. For string flag_value, STRING type is used and2136+ # the default value is converted to string. For non-basic types (like2137+ # enums), UNPROCESSED is used and values pass through unchanged.2138 ({"flag_value": "1", "default": True}, [], "1"),2139 ({"flag_value": "1", "default": 42}, [], "42"),2135- ({"flag_value": EngineType.OSS, "default": True}, [], "EngineType.OSS"),2136- ({"flag_value": EngineType.OSS, "default": 42}, [], "42"),2140+ ({"flag_value": EngineType.OSS, "default": True}, [], EngineType.OSS),2141+ ({"flag_value": EngineType.OSS, "default": 42}, [], 42),2142 # See: the result is the same if we force the type to be str.2143 ({"type": str, "flag_value": 1, "default": True}, [], "1"),2144 ({"type": str, "flag_value": 1, "default": 42}, [], "42"),2145 ({"type": str, "flag_value": "1", "default": True}, [], "1"),57 unmodified lines2203 {"flag_value": EngineType.PRO, "type": UNPROCESSED},2204 ["--opt2"],2205 EngineType.PRO,2206 ),2202- # Check that passing exotic flag values like classes is supported, but are2203- # rendered to strings when the type is not specified.2207+ # Exotic flag values like classes are passed through unchanged when no2208+ # explicit type is given (UNPROCESSED is auto-detected).2209+ # https://github.com/pallets/click/issues/20122210 # https://github.com/pallets/click/issues/31212211 (2212 {"flag_value": Class1, "default": True},2213 {"flag_value": Class2},2214 [],2209- "<class 'test_options.Class1'>",2215+ Class1,2216 ),2217 (2218 {"flag_value": Class1, "default": True},2219 {"flag_value": Class2},2220 ["--opt1"],2215- "<class 'test_options.Class1'>",2221+ Class1,2222 ),2223 (2224 {"flag_value": Class1, "default": True},2225 {"flag_value": Class2},2226 ["--opt2"],2221- "<class 'test_options.Class2'>",2227+ Class2,2228 ),2223- # Even the default is processed as a string.2229+ # String and None defaults pass through unchanged.2230 ({"flag_value": Class1, "default": "True"}, {"flag_value": Class2}, [], "True"),2231 ({"flag_value": Class1, "default": None}, {"flag_value": Class2}, [], None),2232 # To get the classes as-is, we need to specify the type as UNPROCESSED.2233 # https://github.com/pallets/click/issues/312116 unmodified lines2250 Class2,2251 ),2252 # Setting the default to a class, an instance of the class is returned instead2253 # of the class itself, because the default is allowed to be callable (and2248- # consummd). And this happens whatever the type is.2254+ # consumed). And this happens whatever the type is.2255 (2256 {"flag_value": Class1, "default": Class1},2257 {"flag_value": Class2},2258 [],2253- re.compile(r"'<test_options.Class1 object at 0x[0-9A-Fa-f]+>'"),2259+ re.compile(r"<test_options.Class1 object at 0x[0-9A-Fa-f]+>"),2260 ),2261 (2262 {"flag_value": Class1, "default": Class2},2263 {"flag_value": Class2},2264 [],2259- re.compile(r"'<test_options.Class2 object at 0x[0-9A-Fa-f]+>'"),2265+ re.compile(r"<test_options.Class2 object at 0x[0-9A-Fa-f]+>"),2266 ),2267 (2268 {"flag_value": Class1, "type": UNPROCESSED, "default": Class1},2269 {"flag_value": Class2, "type": UNPROCESSED},57 unmodified lines2327 {"flag_value": Class1, "type": UNPROCESSED, "default": True},2328 ["--opt"],2329 Class1,2330 ),2325- # Without UNPROCESSED, the class is str()-ified by the default STRING type.2326- ({"flag_value": Class1, "default": True}, [], "<class 'test_options.Class1'>"),2331+ # Without explicit UNPROCESSED, the class still passes through unchanged2332+ # because UNPROCESSED is auto-detected for non-basic flag_value types.2333+ ({"flag_value": Class1, "default": True}, [], Class1),2334 (2335 {"flag_value": Class1, "default": True},2336 ["--opt"],2330- "<class 'test_options.Class1'>",2337+ Class1,2338 ),2339 # Explicit default=Class1 (not via default=True alignment): callable IS invoked,2340 # because the user explicitly set a callable as the default.2341 (137 unmodified lines2479 ctx = click.Context(cli)2480 assert opt.get_default(ctx, call=True) is expected_get_default2481 2482 2483+def test_flag_value_not_stringified_for_custom_types(runner):2484+ """Non-basic flag_value types are passed through unchanged without2485+ requiring ``type=click.UNPROCESSED``.2486+2487+ Regression test for https://github.com/pallets/click/issues/20122488+ """2489+2490+ @click.command()2491+ @click.option("--cls1", "config_cls", flag_value=Class1, default=True)2492+ @click.option("--cls2", "config_cls", flag_value=Class2)2493+ def cli(config_cls):2494+ click.echo(repr(config_cls), nl=False)2495+2496+ # Default activates --cls1 (default=True resolves to flag_value).2497+ result = runner.invoke(cli, [])2498+ assert result.exit_code == 02499+ assert result.output == repr(Class1)2500+2501+ result = runner.invoke(cli, ["--cls1"])2502+ assert result.exit_code == 02503+ assert result.output == repr(Class1)2504+2505+ result = runner.invoke(cli, ["--cls2"])2506+ assert result.exit_code == 02507+ assert result.output == repr(Class2)2508+2509+ # Enum flag_value without explicit type is also preserved.2510+ @click.command()2511+ @click.option("--oss", "engine", flag_value=EngineType.OSS, default=True)2512+ @click.option("--pro", "engine", flag_value=EngineType.PRO)2513+ def cli2(engine):2514+ click.echo(repr(engine), nl=False)2515+2516+ result = runner.invoke(cli2, [])2517+ assert result.exit_code == 02518+ assert result.output == repr(EngineType.OSS)2519+2520+ result = runner.invoke(cli2, ["--pro"])2521+ assert result.exit_code == 02522+ assert result.output == repr(EngineType.PRO)2523+2524+2525 def test_custom_type_frozenset_flag_value(runner):2526 """Check that frozenset is correctly handled as a type, a flag value and a default.2527 2528 Reproduces https://github.com/pallets/click/issues/261096 unmodified linesmodified:tests/test_termui.py+1 added-1 removed
394 unmodified lines395 396 result = click.edit(filename=named_tempfile.name, editor="sed -i~ 's/$/Test/'")397 assert result is None398 399- # We need ot reopen the file as it becomes unreadable after the edit.399+ # We need to reopen the file as it becomes unreadable after the edit.400 with open(named_tempfile.name) as reopened_file:401 # POSIX says that when sed writes a pattern space to output then it402 # is immediately followed by a newline and so the expected result403 # should contain the newline. However, some sed implementations587 unmodified linesmodified:tests/test_types.py+1 added-1 removed
226 unmodified lines227 path = tmp_path / "\udcff"228 229 # - common case: �': No such file or directory230 # - special case: Illegal byte sequence231- # The spacial case is seen with rootless Podman. The root cause is most231+ # The special case is seen with rootless Podman. The root cause is most232 # likely that the path is handled by a user-space program (FUSE).233 match = r"(�': No such file or directory|Illegal byte sequence)"234 with pytest.raises(click.BadParameter, match=match):235 type.convert(path, None, None)22 unmodified linesmodified:.pre-commit-config.yaml+6 added-1 removed
1 repos:2 - repo: https://github.com/astral-sh/ruff-pre-commit3 rev: c60c980e561ed3e73101667fe8365c609d19a438 # frozen: v0.15.94 hooks:5- - id: ruff5+ - id: ruff-check6 - id: ruff-format7 - repo: https://github.com/astral-sh/uv-pre-commit8 rev: 0397b68f6f88c024f1d2b355a9818779f6336d16 # frozen: 0.11.39 hooks:10 - id: uv-lock11+ - repo: https://github.com/codespell-project/codespell12+ rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.213+ hooks:14+ - id: codespell15+ args: ['--write-changes', '--ignore-words-list=inout,te']16 - repo: https://github.com/pre-commit/pre-commit-hooks17 rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.018 hooks:19 - id: check-merge-conflict5 unmodified linesmodified:CHANGES.rst+2 added-2 removed
31 unmodified lines32 33 Version 8.3.334 -------------35 36-Unreleased36+Released 2026-04-2037 38 - Use :func:`shlex.split` to split pager and editor commands into ``argv``39 lists for :class:`subprocess.Popen`, removing ``shell=True``.40 :issue:`1026` :pr:`1477` :pr:`2775`930 unmodified lines971 - ``_AtomicFile`` now uses the ``realpath`` of the original filename972 so that changing the working directory does not affect it. :pr:`920`973 - Fix incorrect completions when defaults are present :issue:`925`,974 :pr:`930`975-- Add copy option attrs so that custom classes can be re-used.975+- Add copy option attrs so that custom classes can be reused.976 :issue:`926`, :pr:`994`977 - "x" and "a" file modes now use stdout when file is ``"-"``.978 :pr:`929`979 - Fix missing comma in ``__all__`` list. :pr:`935`420 unmodified linesmodified:pyproject.toml+1 added-1 removed
1 [project]2 name = "click"3-version = "8.3.2"3+version = "8.3.3"4 description = "Composable command line interface toolkit"5 readme = "README.md"6 license = "BSD-3-Clause"7 license-files = ["LICENSE.txt"]229 unmodified linesmodified:uv.lock+14 added-14 removed
171 unmodified lines172 ]173 174 [[package]]175 name = "click"176-version = "8.3.2"176+version = "8.3.3"177 source = { editable = "." }178 dependencies = [179 { name = "colorama", marker = "sys_platform == 'win32'" },180 ]719 unmodified lines900 { url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" },901 ]902 903 [[package]]904-name = "python-discovery"905-version = "1.2.1"906-source = { registry = "https://pypi.org/simple" }907-dependencies = [908- { name = "filelock" },909- { name = "platformdirs" },910-]911-sdist = { url = "https://files.pythonhosted.org/packages/b9/88/815e53084c5079a59df912825a279f41dd2e0df82281770eadc732f5352c/python_discovery-1.2.1.tar.gz", hash = "sha256:180c4d114bff1c32462537eac5d6a332b768242b76b69c0259c7d14b1b680c9e", size = 58457, upload-time = "2026-03-26T22:30:44.496Z" }912-wheels = [913- { url = "https://files.pythonhosted.org/packages/67/0f/019d3949a40280f6193b62bc010177d4ce702d0fce424322286488569cd3/python_discovery-1.2.1-py3-none-any.whl", hash = "sha256:b6a957b24c1cd79252484d3566d1b49527581d46e789aaf43181005e56201502", size = 31674, upload-time = "2026-03-26T22:30:43.396Z" },914-]915-916-[[package]]904 name = "pytest-randomly"905 version = "4.0.1"906 source = { registry = "https://pypi.org/simple" }907 dependencies = [17 unmodified lines925 { url = "https://files.pythonhosted.org/packages/ca/31/d4e37e9e550c2b92a9cbc2e4d0b7420a27224968580b5a447f420847c975/pytest_xdist-3.8.0-py3-none-any.whl", hash = "sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88", size = 46396, upload-time = "2025-07-01T13:30:56.632Z" },926 ]927 928 [[package]]929+name = "python-discovery"930+version = "1.2.1"931+source = { registry = "https://pypi.org/simple" }932+dependencies = [933+ { name = "filelock" },934+ { name = "platformdirs" },935+]936+sdist = { url = "https://files.pythonhosted.org/packages/b9/88/815e53084c5079a59df912825a279f41dd2e0df82281770eadc732f5352c/python_discovery-1.2.1.tar.gz", hash = "sha256:180c4d114bff1c32462537eac5d6a332b768242b76b69c0259c7d14b1b680c9e", size = 58457, upload-time = "2026-03-26T22:30:44.496Z" }937+wheels = [938+ { url = "https://files.pythonhosted.org/packages/67/0f/019d3949a40280f6193b62bc010177d4ce702d0fce424322286488569cd3/python_discovery-1.2.1-py3-none-any.whl", hash = "sha256:b6a957b24c1cd79252484d3566d1b49527581d46e789aaf43181005e56201502", size = 31674, upload-time = "2026-03-26T22:30:43.396Z" },939+]940+941+[[package]]942 name = "pyyaml"943 version = "6.0.3"944 source = { registry = "https://pypi.org/simple" }945 sdist = { url = "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", size = 130960, upload-time = "2025-09-25T21:33:16.546Z" }720 unmodified lines