darker icon indicating copy to clipboard operation
darker copied to clipboard

Python 3.14 compatibility

Open akaihola opened this issue 1 year ago • 3 comments

As reported by our future test, the following issues need to be resolved to ensure Python 3.14 compatibility:

  • ast class hierarchy changes – upgrade astor, flynt

  • [x] astor/op_util.py:92: DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/utils/utils.py:74: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/candidates/ast_call_candidates.py:14: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/transform/format_call_transforms.py:18: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/transform/format_call_transforms.py:22: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3 14; use value instead

  • [x] flynt/transform/format_call_transforms.py:29: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/utils/utils.py:90: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/transform/format_call_transforms.py:88: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] astor/code_gen.py:599: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

  • [x] flynt/transform/format_call_transforms.py:89: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

akaihola avatar Jan 08 '25 16:01 akaihola

Is Python 3.13 even supported? 😅

https://github.com/akaihola/darker/blob/master/pyproject.toml#L15-L16

    "Programming Language :: Python :: 3.12",
]

reneleonhardt avatar Sep 03 '25 09:09 reneleonhardt

Thanks @reneleonhardt, you're right – I added both 3.13 and 3.14 to the metadata in #851.

Also, Astor 0.8.1 no longer uses ast.Num in astor/op_util.py, so that warning didn't materialize.

astor/code_gen.py still does reference ast.Str, so that might be a problem.

I'll look into Flynt next.

akaihola avatar Oct 21 '25 20:10 akaihola

Updating to Flynt 1.0.3+ will get rid of ast.Str usage in Flynt, as well as the s attribute.

akaihola avatar Oct 21 '25 20:10 akaihola