Yapf: Python 3.8 support

Created on 18 Oct 2019  路  15Comments  路  Source: google/yapf

Add support for python 3.8 new syntax changes:

Most helpful comment

How important is to still support Python2, which is deprecated, vs support Python3.8+? Isn't it easier to just drop support for v2? I know a ton of people is going to hate me, but its probably easier to just fork the project to support v2 and simply remove its support here.

All 15 comments

It appears that lib2to3/Grammar.txt hasn't been updated to include the new features. (I've downloaded the Python 3.8 source tarball and also looked at github.

https://bugs.python.org/issue36541 contains a proposed PR to bring lib2to3 up-to-date.

Has support for python 3.8 syntax been added yet? I tried cloning the repo today and running on a file with the walrus operator, and got a lib2to3.pgen2.parse.ParseError, so I guess lib2to3 hasn't merged the PR for updating to 3.8 yet?

I just bumped into this as well.

This appears to solve the problem: https://bugs.python.org/issue36541

Also, Python 3.9 will add a positional-only grammar change: https://www.python.org/dev/peps/pep-0570/

Also, Python 3.9 will add a positional-only grammar change: https://www.python.org/dev/peps/pep-0570/

Which grammar change would that be? I couldn't find it in the PEP regarding current grammar for 3.8. Thanks!

It works with Python 3.8.3rc1

Edit: only the walrus operator

Any update on this issue? lib2to3 is deprecated anyhow and YAPF is now unusable in newer projects...

@gwelymernans - want to have a chat about this? I might be persuaded to figure out what's needed and maybe even implement it (step 1: figure out which of the alternatives to lib2to3 is likely to be the best).

The big question: how popular is yapf vs black? I wouldn't want to put in a lot of effort if it turns out that the world has decided on the one-size-fits-all approach.

@kamahen https://github.com/google/yapf/issues/448 is an open issue about this. I would love for someone to take this up, as my current projects don't allow for much time to focus on YAPF.

How important is to still support Python2, which is deprecated, vs support Python3.8+? Isn't it easier to just drop support for v2? I know a ton of people is going to hate me, but its probably easier to just fork the project to support v2 and simply remove its support here.

dropping py2 sounds great. seems like a good excuse to jump the version series too.

Let's see if there's any discussion on this proposal (linked from item #448) for replacing lib2to3 with an augmented stdlib ast module:
https://mail.python.org/archives/list/[email protected]/thread/X2HJ6I6XLIGRZDB27HRHIVQC3RXNZAY4/

https://github.com/python/cpython/pull/23759 should fix lib2to3 for the remaining positional only argument pep-570 syntax omission; that'll take a while to trickle down to various people's CPython installs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haphut picture haphut  路  3Comments

Daenyth picture Daenyth  路  8Comments

tschijnmo picture tschijnmo  路  6Comments

jamesqo picture jamesqo  路  5Comments

advance512 picture advance512  路  6Comments