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

Avoid using relative imports #413

Closed
OlivierBinette opened this issue Nov 25, 2024 · 3 comments
Closed

Avoid using relative imports #413

OlivierBinette opened this issue Nov 25, 2024 · 3 comments

Comments

@OlivierBinette
Copy link

OlivierBinette commented Nov 25, 2024

I'm getting issues with pyairtable:

image

I noticed that relative imports are being used, which seems to be the root of the issue in my case. Relative imports should be avoided in packages:

Relative imports for intra-package imports are highly discouraged. Always use the absolute package path for all imports. Even now that PEP 328 is fully implemented in Python 2.5, its style of explicit relative imports is actively discouraged; absolute imports are more portable and usually more readable.

from .api import Api, Base, Table
from .api.enterprise import Enterprise
from .api.retrying import retry_strategy
from .api.workspace import Workspace

@adamhetherington-dmi
Copy link

I'm experiencing the same issue, scripts are failing as a result

@bkolasa
Copy link

bkolasa commented Nov 26, 2024

The same for me

@mesozoic
Copy link
Collaborator

Thanks for the report! This is the same as #411, a bug in pydantic 2.10.0 and 2.10.1. It was fixed in pydantic 2.10.2. Relative imports are discouraged (and I'll cut a branch to fix them) but they're a red herring here.

Try pinning your project's dependencies to either pydantic>=2,<2.10 or pydantic>=2.10.2,<3. If you still get that error, a minimal code snippet that reproduces the problem would help a lot.

@mesozoic mesozoic closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2024
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

No branches or pull requests

4 participants