Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up circular imports and typing-only imports #414

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mesozoic
Copy link
Collaborator

@mesozoic mesozoic commented Nov 29, 2024

The bug we encountered in #411 highlighted some odd patterns in how pyairtable does its imports, which are more "emergent" (or "sloppy" 😁) than well-reasoned. This branch cleans it up, so that module-level imports only go "down" the hierarchy (i.e. Api can import Base, but not vice versa) and imports which go "up" the hierarchy must either (1) happen at runtime or (2) be wrapped in if TYPE_CHECKING.

I specifically tested this against pydantic==2.10.1 to ensure that whatever bug we were causing in that library is no longer triggered. I couldn't test against pydantic==2.10.0 because of pydantic/pydantic#10907

Along the way, I also replaced all relative imports with absolute imports.

Fixes #412

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.

Investigate ways of removing circular dependencies
1 participant