8000 Add support for 3.13 by sydney-runkle · Pull Request #9743 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@sydney-runkle
Copy link
Contributor
@sydney-runkle sydney-runkle commented Jun 24, 2024

Closes #9668 (add 3.13 support)
Addresses #9613 for the V2 case

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Jun 24, 2024
@sydney-runkle sydney-runkle added relnotes-packaging Used for dependency changes. and removed relnotes-fix Used for bugfixes. labels Jun 25, 2024
@cloudflare-workers-and-pages
Copy link
cloudflare-workers-and-pages bot commented Jun 25, 2024

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: cb007bd
Status: ✅  Deploy successful!
Preview URL: https://08ea05ea.pydantic-docs.pages.dev
Branch Preview URL: https://3-13.pydantic-docs.pages.dev

View logs

@codspeed-hq
Copy link
codspeed-hq bot commented Jun 25, 2024

CodSpeed Performance Report

Merging #9743 will not alter performance

Comparing 3-13 (cb007bd) with main (f024d03)

Summary

✅ 13 untouched benchmarks

@sydney-runkle
Copy link
Contributor Author
sydney-runkle commented Jun 25, 2024

TODOs here:

  • fix issues in v1 with _eval_type
  • fix issues in eval_type_backport with eval_type
  • fix issues with Annotated and issubclass

There's probably more...

@sydney-runkle sydney-runkle marked this pull request as ready for review June 25, 2024 15:23
@sydney-runkle
Copy link
Contributor Author
sydney-runkle commented Jun 25, 2024

Python 3.13 requires a newer version of typing_extensions - was there a reason good reason why we're stuck on 4.6.1 in pyproject.toml?

@pytest.mark.skipif(sys.version_info < (3, 9), reason='@computed_field @classmethod @property only works in 3.9+')
@pytest.mark.skipif(
sys.version_info < (3, 9) or sys.version_info >= (3, 13),
reason='@computed_field @classmethod @property only works in 3.9-3.12',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to do this in 3.13?

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 didn't find an easy way - I suppose you could create a custom decorator that basically handles the classmethod stuff with __wrapped__ as suggested here:

https://github.com/python/cpython/pull/92379/files#diff-78f24041d66ab8ed2ae1aee94bcd42396d27af833cb96a3c506294c6d6dce82d

Copy link
Contributor

Choose a reason for hiding this comment

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

Should a new issue be opened for this?

@sydney-runkle
Copy link
Contributor Author

I'm unsure of why pdm is now having issues after I made two minor changes:

https://github.com/pydantic/pydantic/actions/runs/9668346229/job/26672294116?pr=9743

Copy link
Contributor
@alexmojaki alexmojaki left a comment

Choose a reason for hiding this comment

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

I think this should be split into "support 3.13" and "support type params". The latter itself could be split for supporting different situations. In particular this doesn't cover parametrized classes at all, only @validate_call. Even for just @validate_call, this needs tests.

@sydney-runkle
Copy link
Contributor Author
sydney-runkle commented Jun 25, 2024

@alexmojaki,

Sure, I'll pull out the @validate_call changes for the type param support and write some tests on the corresponding PR. Thanks for the review!

@sydney-runkle
Copy link
Contributor Author

Edit: before, I had this in the description:

Closes #9536

@alexmojaki, I've added your suggested changes for #9536 with an additional comment for the fix in _validate_call.py regarding the fact that we should probably change how we pass around those type params.

I think it's probably worth sprinting on providing full and clean support for PEP 695 stuff (though not all in this PR)

I've now moved this to a different PR :) (to be linked soon)

@sydney-runkle sydney-runkle enabled auto-merge (squash) June 25, 2024 22:20
@sydney-runkle
Copy link
Contributor Author

I'd like to check in around the time of the official 3.13 release to remove some of the todos in pyproject.toml (testing packages that don't yet support 3.13, mostly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-packaging Used for dependency changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Python 3.13

4 participants

0