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

Python 3.13 deprecates forward references #1308

Open
gaborbernat opened this issue Jan 27, 2025 · 4 comments
Open

Python 3.13 deprecates forward references #1308

gaborbernat opened this issue Jan 27, 2025 · 4 comments
Labels
type:bug A general bug

Comments

@gaborbernat
Copy link

gaborbernat commented Jan 27, 2025

Following issue python/cpython#118418 is no longer recommended to wrap pydantic definitions behind future annotations here https://github.com/argoproj-labs/hera/blob/main/src/hera/events/models/io/argoproj/workflow/v1alpha1.py#L4. This now raises a deprecation warning.

Fixing this, however, will require a slightly more complicated solution, as that forward reference stops circular references between definitions. Furthermore, it seems we're still using the V1 compatibility layer from pydantic that is planned to be removed pydantic/pydantic#5165, so likely a better solution would be to stop pydantic v1 support.

Inside pytest one can side-step for now as:

[tool.pytest.ini_options]
filterwarnings = [
  "error",
  "ignore::DeprecationWarning:pydantic.v1.typing",
]
@gaborbernat gaborbernat added the type:bug A general bug label Jan 27, 2025
@alicederyn
Copy link
Collaborator

We auto-generate this file with https://github.com/koxudaxi/datamodel-code-generator, so I assume this needs to be raised + fixed upstream?

@gaborbernat
Copy link
Author

Reported upstream as well. Once they fix it we need to regenerate it to fix it here, so we should keep this issue open until then.

@gaborbernat
Copy link
Author

@alicederyn we could also fix it by generating pydantic v2 classes instead of v1, no?

@alicederyn
Copy link
Collaborator

I can't speak to the implications of that / the maintainers' willingness to do so. @elliotgunton ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants