-
Notifications
You must be signed in to change notification settings - Fork 756
Support for python 3.14 #5087
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
base: main
Are you sure you want to change the base?
Support for python 3.14 #5087
Conversation
| # limitations under the License. | ||
|
|
||
| """Support for keyword-only fields in dataclasses for Python versions <3.10. | ||
| """This module is kept for backward compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praxis is using flax/linen/kw_only_dataclasses.py module here: https://github.com/google/praxis/blob/main/praxis/base_hyperparams.py#L36
| v2 = Child(4, a=5) # pylint: disable=too-many-function-args | ||
| self.assertDictEqual(dataclasses.asdict(v2), dict(a=5, b=4)) | ||
|
|
||
| @absltest.expectedFailureIf(True, "non-default argument 'size' follows default argument") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is failing with built-in python dataclasses:
class B inherits from A where a default kwarg is defined, thus B can't define non-default size attribute.
| self.assertEqual( | ||
| list(Test2.__dataclass_fields__.keys()), | ||
| ['bar', 'baz', 'parent', 'name'], | ||
| set(Test2.__dataclass_fields__.keys()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test adaptation is needed with built-in python dataclasses vs linen.kw_only_dataclasses
aa49caa to
5fd3b57
Compare
| # Ignore uv.lock and always upgrade the package to the latest | ||
| upgrade-package = ["jax", "jaxlib", "orbax-checkpoint"] | ||
|
|
||
| [tool.uv.sources] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from #5086 and can be removed if that PR wont land
4be43de to
3eeb377
Compare
|
Here is a repro for the problem we see with this internally. It's kind of wild and I don't know what's going on here: I ran this under Python 3.12. With the changes in this CL, I get: |
|
I still don't know why this works, but adding: right before the: call seems to work around the problem. For some reason, |
|
@hawkinsp thanks a lot for investigations! |
|
Another note: for praxis I found that adding |
|
Reported the bug on cpython: python/cpython#141681 |
917ca90 to
1014b25
Compare
1014b25 to
964f503
Compare
964f503 to
b43ade8
Compare
Fixes #5027
fieldanddataclasslinked to python built-in dataclasseskw_only_dataclassesin linen module.py