Skip to content

Black updates: drop py27+py35; upgrade from 19.x to 20.x #4406

@wchargin

Description

@wchargin

Our pyproject.toml has:

target-version = ["py27", "py35", "py36", "py37", "py38"]

Now that we’ve flipped srcs_version to PY3 and let that soak for a
bit with no problems (#4361), we can safely drop py27 compatibility, and
we can also drop py35 since TensorFlow has done so and we’ve announced
as much in our release notes (#4320).

The main changes are removing u"" sigils and permitting trailing
commas after splats, since bpo-9232 was fixed. Diffstat is +112/−118
across 25 files.

I also propose that we upgrade from Black 19.x to 20.x. One concrete
improvement on the tooling side is that editor integrations now respect
pyproject.toml, and this depends on a helper added in 20.x. And, as
usual, staying reasonably up to date is nice to have.

The main changes seem to be adding newlines where there was an inline
trailing comma:

         self.assertTagsEqual(
             accumulator.Tags(),
-            {ea.IMAGES: tags, ea.GRAPH: True, ea.META_GRAPH: False,},
@@ note this comma ------------------------------------------------^
+            {
+                ea.IMAGES: tags,
+                ea.GRAPH: True,
+                ea.META_GRAPH: False,
+            },
         )

I don’t know why we have quite so many of those, and I’m not sure
whether they all should really exist, but given that they’re there, the
change seems reasonable to me. Diffstat is +854/−259 over 84 files.

As usual, I propose that we do this in three steps: (a) update configs
and temporarily disable Black enforcement, (b) reformat everything, and
(c) re-enable enforcement. This way, we can mark the commit(s) of (b) as
ignored for git-blame purposes via our .git-blame-ignore-revs file.
We can still handle these with a single PR, just merged with rebase.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions