Skip to content

Fix type annotations: replace builtin any with typing.Any#1406

Open
coactive-victor wants to merge 3 commits intodatabricks:mainfrom
coactive-victor:fix/wait-typing-any
Open

Fix type annotations: replace builtin any with typing.Any#1406
coactive-victor wants to merge 3 commits intodatabricks:mainfrom
coactive-victor:fix/wait-typing-any

Conversation

@coactive-victor
Copy link
Copy Markdown

@coactive-victor coactive-victor commented Apr 27, 2026

Summary

Replaces all uses of the Python builtin any as a type annotation with typing.Any across the SDK, fixing incorrect type inference by mypy.

Why

any used as a type annotation refers to the builtin function any(iterable: Iterable) -> bool, not the typing.Any wildcard. mypy treats annotated parameters and return values as having the type of that callable, which causes spurious [attr-defined] errors when code accesses attributes on those values at runtime. For example, Wait.response was inferred as (Iterable[object]) -> bool, so any attribute access like .run_id would fail a mypy check even though the code is correct. The fix is mechanical: replace every : any / -> any annotation with typing.Any, which is the correct way to express "this value is intentionally untyped."

What changed

Interface changes

None.

Behavioral changes

None.

Internal changes

  • databricks/sdk/service/_internal.py - Fixed _from_dict, _repeated_dict, _enum, _repeated_enum, Wait.__init__, and Wait.__getattr__; added Any to the typing import.
  • databricks/sdk/config.py - Fixed ConfigAttribute.__set__; added Any to the typing import.
  • databricks/sdk/dbutils.py - Fixed taskValues.get (×2) and taskValues.set.
  • databricks/sdk/oauth.py - Fixed the noop_credentials parameter annotation.
  • databricks/sdk/runtime/dbutils_stub.py - Fixed data.summarize, jobs.taskValues.get (×2), and jobs.taskValues.set.

How is this tested?

Type-annotation-only change with no behavioral effect. Verified with black --check (all files pass). A mypy run on code that accesses attributes of annotated values (e.g. Wait.response.run_id) will no longer produce spurious [attr-defined] errors.

Signed-off-by: coactive-victor <victor@coactive.ai>
Occurrences in _internal.py, config.py, dbutils.py, oauth.py, and
runtime/dbutils_stub.py were using the builtin any (an Iterable->bool
callable) as a type annotation instead of typing.Any. mypy interprets
these as the callable type, causing spurious attr-defined errors on
annotated values.

Signed-off-by: Victor Hugo Xavier <victor@coactive.ai>
Signed-off-by: coactive-victor <victor@coactive.ai>
@coactive-victor coactive-victor changed the title Fix/wait typing any Fix type annotations: replace builtin \any with typing.Any`` Apr 27, 2026
@coactive-victor coactive-victor changed the title Fix type annotations: replace builtin \any with typing.Any`` Fix type annotations: replace builtin any with typing.Any Apr 27, 2026
Signed-off-by: coactive-victor <victor@coactive.ai>
@github-actions
Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1406
  • Commit SHA: 001184e519385ec5f98e811987db152b26171a9d

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant