Pycodestyle: AttributeError: 'module' object has no attribute 'break_around_binary_operator

Created on 10 Apr 2018  路  27Comments  路  Source: PyCQA/pycodestyle

2.4 release broke AttributeError: 'module' object has no attribute 'break_around_binary_operator' see https://travis-ci.org/EBI-Metagenomics/emgapi/jobs/364572048#L637

Most helpful comment

Y'all seem to be forcing flake8 to use a version of pycodestyle that it's dependencies explicitly state it doesn't support.

If it helps anyone else - to avoid situations like this, we added pip check to our Travis run, which outputs:
flake8 3.5.0 has requirement pycodestyle<2.4.0,>=2.0.0, but you have pycodestyle 2.4.0.

...thereby making it much harder to accidentally update to incompatible versions, particularly when using bots like pyup.io and so not running the PR locally first.

See:
https://pip.pypa.io/en/latest/reference/pip_check/

Edit:
Note: pip check is new as of pip v9.

All 27 comments

huge +1, fix this ASAP.

ping me when ready ;-)

Looks like a backwards incompatibility that flake8 doesn't handle.

+1 pls

Y'all seem to be forcing flake8 to use a version of pycodestyle that it's dependencies explicitly state it doesn't support. This is not a bug in pycodestyle. This is a bug in how you're forcing a newer version of pycodestyle. Flake8's dependencies explicitly state "< 2.4.0"

Y'all seem to be forcing flake8 to use a version of pycodestyle that it's dependencies explicitly state it doesn't support.

If it helps anyone else - to avoid situations like this, we added pip check to our Travis run, which outputs:
flake8 3.5.0 has requirement pycodestyle<2.4.0,>=2.0.0, but you have pycodestyle 2.4.0.

...thereby making it much harder to accidentally update to incompatible versions, particularly when using bots like pyup.io and so not running the PR locally first.

See:
https://pip.pypa.io/en/latest/reference/pip_check/

Edit:
Note: pip check is new as of pip v9.

@edmorley that's incredibly useful. Thank you

@edmorley congrats, you won one internet today. :)

Adding just some information:

@sigmavirus24

forcing a newer version of pycodestyle

For me it comes via Arch Linux' package - but your point is still valid of course, it's a packaging issue there then after all.

@edmorley
pip check does not complain about using flake8 3.5.0 and pycodestyle 2.4.0 together in this setup (using the system Python/pip), or when creating a virtualenv using --system-site-packages.
It works in a separate virtualenv however.

Arch Linux bug for reference: https://bugs.archlinux.org/task/58210.

As a warning to folks here, some of your linux distributions that don't ensure the stability of their packages before shipping them are planning to break Flake8 and pycodestyle for you to resolve this before the upstream maintainers have time to. They're not interested in the correct fix. They're just interested in stopping the complaints. I would advise not using these packages from your system package manager if you can.

They're not interested in the correct fix.

What are you sources on this and what are they planning?

-.-

As a warning to folks here, some of your linux distributions that don't ensure the stability of their packages before shipping them

In the case where I try to help, we did not even ship pycodestyle 2.4.0. We detected this bug before doing so.

They're not interested in the correct fix.

No. You invented that statement.

I am not interested in starting a flame war here. Sorry.

What are you sources on this and what are they planning?

The pull request they sent to Flake8 to "fix" this by deleting usage of checks in pycodestyle and their commentary that it's good enough for them when told it wasn't the correct fix. In other words, they're deliberately removing checks to violate constraints that demonstrate what is supported software.

To quote them directly:

A partly broken flake8 is still better than a completely broken and completely unusable flake8

I invented nothing

A partly broken flake8 is still better than a completely broken and completely unusable flake8

What a shameless commentary...

For those who do not follow the issue and pull request at the flake8 repository: The patch has meanwhile been accepted upstream, see https://gitlab.com/pycqa/flake8/merge_requests/230

What are you sources on this and what are they planning?

The pull request they sent to Flake8 to "fix" this by deleting usage of checks in pycodestyle and their commentary that it's good enough for them when told it wasn't the correct fix. In other words, they're deliberately removing checks to violate constraints that demonstrate what is supported software.

To quote them directly:

A partly broken flake8 is still better than a completely broken and completely unusable flake8

I invented nothing

Can you confirm this random person is a linux distribution maintainer for OpenSUSE? Because OpenSUSE is one of the two distros you called out elsewhere for this.

I can confirm this random person is not an Arch Linux team member -- we are the other distro you called out.

Please do not accuse random people of violating your software. Unleashing your aggravation on someone may be better for your emotional state than having no one to rant about, but it is certainly not correct, and will result in false accusations, much like removing valuable safety features from flake8 is not correct and will result in not working flake8.

Any (relevant and respectful) update guys? If someone has found a temporary workaround i think it would help us greatly :)

@manugarri A workaround/fix for flake8 is at https://gitlab.com/pycqa/flake8/merge_requests/230 Does that work for you? There hasn't been a release of flake8 since then unfortunately.

@manugarri there's no need for a workaround. The flake8 maintainer has been sitting on the working development version for two months without releasing it.

If you get flake8 from PyPI it should be pinned to the earlier version of pycodestyle. If you get flake8 from Linux distributions that provide newer versions of pycodestyle, they should have backported the fixes for flake8.

im not sure I understand @eli-schwartz . Currently I am experiencing this issue on ubuntu 18.04 . Basically, ale stopped working because of this issue.

What do you suggest doing, reinstalling the system flake8 from pypi?

EDIT. Ok, i just did pip install flake8 from my root (so no virtual/conda environment) and now Ale works on vim. Thanks!

That seems unlikely since Ubuntu still packages the old pycodestyle...

@manugarri might have used sudo pip here.. :/

@blueyed I did not.

@manugarri

pip install flake8 from my root

What does that mean then? Are you using pyenv etc? What is "your root"?
Anyway, quite offtopic, sorry.

my root environment, that is, no virtualenv/pipenv/conda environment.

this was due to upgrading pycodestyle beyond what flake8 was asking for -- flake8 has since been released allowing the latest version

Was this page helpful?
0 / 5 - 0 ratings