-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Starting with Click 8.2, OptionParser
is deprecated. It's used in a single location in the codebase:
dbt-core/core/dbt/cli/options.py
Line 6 in faeee35
from click.parser import OptionParser, ParsingState |
dbt-core/core/dbt/cli/options.py
Line 36 in faeee35
def add_to_parser(self, parser: OptionParser, ctx: Context): |
Expected Behavior
No deprecation warnings are raised when running dbt.
Steps To Reproduce
Run dbt with the PYTHONWARNINGS=error
env var set:
PYTHONWARNINGS=error dbt --help
Relevant log output
$ PYTHONWARNINGS=error dbt --help
Traceback (most recent call last):
File "/repro/dbt-labs/dbt-core/.venv/bin/dbt", line 4, in <module>
from dbt.cli.main import cli
File "/repro/dbt-labs/dbt-core/core/dbt/cli/__init__.py", line 1, in <module>
from .main import cli as dbt_cli # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/repro/dbt-labs/dbt-core/core/dbt/cli/main.py", line 14, in <module>
from dbt.cli import params as p
File "/repro/dbt-labs/dbt-core/core/dbt/cli/params.py", line 13, in <module>
from dbt.cli.options import MultiOption
File "/repro/dbt-labs/dbt-core/core/dbt/cli/options.py", line 6, in <module>
from click.parser import OptionParser, ParsingState
File "/repro/dbt-labs/dbt-core/.venv/lib/python3.13/site-packages/click/parser.py", line 513, in __getattr__
warnings.warn(
~~~~~~~~~~~~~^
f"'parser.{name}' is deprecated and will be removed in Click 9.0."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
stacklevel=2,
^^^^^^^^^^^^^
)
^
DeprecationWarning: 'parser.OptionParser' is deprecated and will be removed in Click 9.0. The old parser is available in 'optparse'.
Environment
- OS: macOS 15.6
- Python: 3.13.7
- dbt: 1.10.12
Which database adapter are you using with dbt?
other (mention it in "Additional Context")
Additional Context
Using dbt with dbt-duckdb, though this problem is independent of the adapter used.
To be fair, the class will only be removed in 9.0, and dbt currently constrains click to <9.0
so this is not going to break any time soon,
Line 58 in faeee35
"click>=8.0.2,<9.0", |
but an annoying warning is still displayed.
I think the warning can be easily addressed at run time by making those click imports type-checking only.