Skip to content

Fix constructor signatures and test annotations for ty - #3965

Merged
kevinjqliu merged 4 commits into
apache:mainfrom
rambleraptor:ty-type-errors
Sep 14, 2026
Merged

kevinjqliu merged 4 commits into
apache:mainfrom
rambleraptor:ty-type-errors

Conversation

@rambleraptor

@rambleraptor rambleraptor commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Rationale for this change'

ty exposes out 3,547 type errors. This gets us down to 655 type errors. These errors all stem from the fact that mypy is ignoring errors relating to optional dependencies.

These come from two different situations:

  1. We need __init__ methods on Pydantic subclasses. This ends up being an issue on expressions mostly. I found a GitHub issue on Pydantic that talks about the same issue. The duplicative __init__ methods are annoying, but I don't see any way around it.
  2. There's a bunch of tests where we have to explicitly pass in client=None since it won't be coming from an untyped dictionary. This actually feels more correct, since client isn't a property. This is only occurring in tests and it's a semantic difference. This feels like splitting hairs with the type checker, but I'm happy to let it do its thing.

Are these changes tested?

Run uv run ty check.

Are there any user-facing changes?

@kevinjqliu

Copy link
Copy Markdown
Contributor

should we make ty part of make lint? I dont think #3964 does this

@kevinjqliu kevinjqliu changed the title Remove 2892 type errors Fix constructor signatures and test annotations for ty Sep 14, 2026

@kevinjqliu kevinjqliu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2 nits

Comment thread pyiceberg/expressions/literals.py Outdated
Comment thread pyiceberg/expressions/literals.py Outdated
@rambleraptor

Copy link
Copy Markdown
Collaborator Author

@kevinjqliu we very much should not...yet. Mypy and ty have conflicting views on which # type: ignore statements are necessary / not. Some of those type: ignore statements are necessary because mypy believes the pyarrow import resolves as an Any... which isn't true and the source of our issues here.

Once we get ty in a good place, the last PR will have to be removing the unnecessary type: ignore statements as we move over to ty.

auto-merge was automatically disabled September 14, 2026 20:59

Head branch was pushed to by a user without write access

@kevinjqliu
kevinjqliu added this pull request to the merge queue Sep 14, 2026
Merged via the queue into apache:main with commit 4a0eeea Sep 14, 2026
21 of 23 checks passed
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.

2 participants