Skip to content

Pep8 doesn't speak to the walrus #12147

Description

@nstarman

Description

Pep8speaks doesn't like walrus operators.

Expected behavior

Now that we are py3.8+ (#11934), this should not trip up the checker.

Actual behavior

Pep8speaks flags := as invalid syntax.

#12136 (comment)

Steps to Reproduce

Push code with a := to astropy.

System Details

N/A.

Activity

  1. nstarman commented on Sep 5, 2021

    @nstarman
    MemberAuthor

    @pllim I see this issue has been raised in pep8speaks-org/pep8speaks#173
    A suggested fix is to use pycodestyle over flake8.
    Or we could just wait until pep8speaks-org/pep8speaks#173 is fixed...

  2. changed the title [-]Pep8 speaks vs. the walrus[/-] [+]Pep8 doesn't speak to the walrus[/+] on Sep 5, 2021
  3. pllim commented on Sep 7, 2021

    @pllim
    Member

    If upstream can fix it within reasonable time frame, we can wait?

  4. nstarman commented on Sep 8, 2021

    @nstarman
    MemberAuthor

    It doesn't make the CI fail; just gives a false error in the PR message. So long as maintainers know to ignore it, it's not a showstopper. The PR to fix the PEP8speaks error is a bit old, but now that many NumPy affiliated packages are dropping py3.7, I hope it's resolved soon...

  5. pllim commented on Sep 8, 2021

    @pllim
    Member

    @nstarman , I don't see why we cannot use pycodestyle for pep8speaks, but I'd rather not switching everything from flake8 to pycodestyle, does that make sense?

    @bsipocz , any advise here?

  6. bsipocz commented on Sep 8, 2021

    @bsipocz
    Member

    flake8 does much more than pycodestyle so there shouldn't be a downgrade switch, the early adoption of walrus doesn't worth it imo. For cases like this, do patch upstream.

  7. nstarman commented on Sep 8, 2021

    @nstarman
    MemberAuthor

    Just confirming, pep8speaks only runs on the diff. So a walrus in the codebase wouldn't make future PRs error, right?

  8. pllim commented on Sep 8, 2021

    @pllim
    Member

    So a walrus in the codebase wouldn't make future PRs error, right?

    Theoretically, no.

  9. nstarman commented on Sep 30, 2021

    @nstarman
    MemberAuthor

    Can confirm it only complains on new PRs. There are now a few walruses in the code and they are not stirring up trouble.

    Side note. pep8speaks also complains about positional-only arguments

    def function(x, /):
        print(x, "is a positional-only argument")
  10. nstarman commented on Jan 18, 2023

    @nstarman
    MemberAuthor

    We don't have pep8speaks anymore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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