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

Compatibility with Pydantic 2.10 #369

Open
Viicos opened this issue Nov 25, 2024 · 4 comments · May be fixed by #372
Open

Compatibility with Pydantic 2.10 #369

Viicos opened this issue Nov 25, 2024 · 4 comments · May be fixed by #372

Comments

@Viicos
Copy link
Member

Viicos commented Nov 25, 2024

Due to a circular import, the AnyComponent alias is imported in an if TYPE_CHECKING: block in fastui.components.forms:

if _t.TYPE_CHECKING:
from . import AnyComponent

and later used in one of the defined models for this module:

loading: '_t.Union[_t.List[AnyComponent], None]' = None
"""Components to display while the form is submitting."""
footer: '_t.Union[_t.List[AnyComponent], None]' = None
"""Components to display in the form footer."""

While this used to work in <2.10 because of namespace pollution inconsistencies, it doesn't with 2.10 as AnyComponent (which doesn't exist in the module namespace at runtime) isn't available.

Best way forward would be to fix the circular import, haven't found a viable implementation yet.

@EnyMan
Copy link

EnyMan commented Dec 3, 2024

I think the easiest solution would be to clean up the contents of the __init__.py into separate files and have the AnyComponent also separate

@BonifacioCalindoro
Copy link

The example code in the docs is also broken because of pydantic 2.10. Downgrading to 2.9.2 makes it work again

@EnyMan
Copy link

EnyMan commented Dec 3, 2024

I have managed to not throw any errors but its not rendering anything anymore will try to figure out a nice solution

@EnyMan
Copy link

EnyMan commented Dec 9, 2024

Finished the refactor and have working version of FastUI added a PR so maybe we can get someone from pydantic to look at it in near future.

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 a pull request may close this issue.

3 participants