Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20250922-151726.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Address Click 8.2+ deprecation warning
time: 2025-09-22T15:17:26.983151-06:00
custom:
Author: edgarrmondragon
Issue: "12038"
12 changes: 7 additions & 5 deletions core/dbt/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import typing as t

import click
from click import Context
from click.parser import _OptionParser, _ParsingState

from dbt.cli.option_types import ChoiceTuple

if t.TYPE_CHECKING:
from click import Context
from click.parser import _OptionParser, _ParsingState


# Implementation from: https://stackoverflow.com/a/48394004
# Note MultiOption options must be specified with type=tuple or type=ChoiceTuple (https://github.com/pallets/click/issues/2012)
Expand All @@ -33,8 +35,8 @@ def __init__(self, *args, **kwargs) -> None:
else:
assert isinstance(option_type, ChoiceTuple), msg

def add_to_parser(self, parser: _OptionParser, ctx: Context):
def parser_process(value: str, state: _ParsingState):
def add_to_parser(self, parser: "_OptionParser", ctx: "Context"):
def parser_process(value: str, state: "_ParsingState"):
# method to hook to the parser.process
done = False
value_list = str.split(value, " ")
Expand Down Expand Up @@ -65,7 +67,7 @@ def parser_process(value: str, state: _ParsingState):
break
return retval

def type_cast_value(self, ctx: Context, value: t.Any) -> t.Any:
def type_cast_value(self, ctx: "Context", value: t.Any) -> t.Any:
def flatten(data):
if isinstance(data, tuple):
for x in data:
Expand Down