astroid icon indicating copy to clipboard operation
astroid copied to clipboard

TODO list for Python 3.11 support

Open DanielNoord opened this issue 4 years ago • 7 comments

  • [ ] Re-enable numpy as a test dependency once they provide wheels for 3.11 > See #1517
  • [ ] Remove the if: ${{ always() }} line from the coverage CI jobs

DanielNoord avatar Apr 17 '22 17:04 DanielNoord

Some recent AST changes:

  • Add support for new TryStar node. Almost identical to the ast.Try node. We shouldn't use the old TryExcept / TryFinally structure though! It's probably better to look at #1389 https://docs.python.org/3.11/library/ast.html#ast.TryStar https://github.com/python/cpython/pull/29581
  • FormattedValue.conversion is a required field (instead of optional). This was an error in the Python documentation which was addressed recently. https://docs.python.org/3.11/library/ast.html#ast.FormattedValue https://github.com/python/cpython/pull/30467
  • [Optional] We could add an enum for FormattedValue.conversion. The int values can be confusion on its own.

cdce8p avatar Apr 22 '22 21:04 cdce8p

The wrapt dependency needs to be ">=1.14" for python 3.11. See changelog

rkhwaja avatar Jul 31 '22 05:07 rkhwaja

@rkhwaja I think pip handle that, if pylint require wrapt >= 1.12 but python 3.11 require wrapt >= 1.14 then pip download >= 1.14. We should not change our lower bound, as we could imagine that wrapt >=1.14 is incompatible with python 3.7 and changing this would break pylint for python 3.7.

Pierre-Sassoulas avatar Jul 31 '22 05:07 Pierre-Sassoulas

You could add a dependency like "wrapt>=1.14,<2;python_version>='3.11'" and then both the old and the new python will work.

I don't know if you have other users than pylint but they would all just work too if you did it this way.

rkhwaja avatar Aug 02 '22 01:08 rkhwaja

But is this required at all ? wrapt is the package that should handle the metadata about the pytho interpreters it supports and pip takes it into account.

Pierre-Sassoulas avatar Aug 02 '22 04:08 Pierre-Sassoulas

But is this required at all ? wrapt is the package that should handle the metadata about the pytho interpreters it supports and pip takes it into account.

Took me a moment to understand the issue. wrap doesn't pin a max supported version (which is the recommendation). Thus pip will happily install 1.12 even on python 3.11 if the dependency resolution requires it. However, only 1.14 is compatible. The options

  • Add wrapt>=1.14,<2;python_version>='3.11' like @rkhwaja suggested
  • Or just bump the min requirement to 1.14. 1.14 is compatible with Python >=3.5 so that wouldn't be an issue.
  • End-users can always add the wrapt>=1.14 constraint themselves. Although that won't fix existing environments.

cdce8p avatar Aug 19 '22 18:08 cdce8p

  • Or just bump the min requirement to 1.14. 1.14 is compatible with Python >=3.5 so that wouldn't be an issue.

See https://github.com/PyCQA/astroid/pull/1745

DanielNoord avatar Aug 21 '22 11:08 DanielNoord