Skip to content

Conversation

@rambleraptor
Copy link
Contributor

Part of #2700

Rationale for this change

This enables linter rule UP037

Are these changes tested?

make lint and make test should pass.

Are there any user-facing changes?

# TODO: Move TableProperties.DEFAULT_FORMAT_VERSION to separate file and set that as format_version default.
self,
new_schema: Schema | "pa.Schema",
new_schema: Schema | pa.Schema,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is safe, since we have a guard to avoid circular dependencies:

if TYPE_CHECKING:
    import pyarrow as pa

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldnt our linter catch this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with this in theory. The fact that CI passes (and our linter) suggests that it might not be the case

Copy link
Contributor

Choose a reason for hiding this comment

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

From my LLM:

Yes, it's safe to remove the quotes from "pa.Schema" and change it to just pa.Schema. Here's why:

  • TYPE_CHECKING guard: Since pyarrow is imported within the TYPE_CHECKING block, it's only available during static type checking, not at runtime.
  • PEP 563 compatibility: With from future import annotations at the top of the file (line 17), all annotations are automatically stringified at runtime anyway, so the quotes are redundant.

Makes sense to me 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

PEP 563 compatibility: With from future import annotations at the top of the file (line 17), all annotations are automatically stringified at runtime anyway, so the quotes are redundant.

Ah nice, thanks 👍

@kevinjqliu kevinjqliu merged commit 60ebe93 into apache:main Nov 12, 2025
8 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.

3 participants