tholo / pytest-flake8

pytest plugin to run flake8
Other
116 stars 47 forks source link

flake8 5 breaks plugin no attribute ConfigFileFinder #87

Open jaraco opened 2 years ago

jaraco commented 2 years ago

Setuptools tests have started failing in the pytest-flake8 plugin:

AttributeError: module 'flake8.options.config' has no attribute 'ConfigFileFinder'
PackeTsar commented 2 years ago

I'm having the same problem

tdenewiler commented 2 years ago

This is affecting us as well, copying the same fix as others.

https://github.com/sscpac/statick

jvavrek commented 2 years ago

I had the same problem with versions 5.0.0 and up of flake8. FWIW, some of the pytest devs now consider using flake8 within pytest to be an anti-pattern, and prefer doing flake8/black/etc. checks using pre-commit: https://github.com/pytest-dev/pytest/issues/9217#issuecomment-965144375

valeriupredoi commented 2 years ago

we're seeing the same behaviour with flake8==5.0.4 - incidentally I saw some fellow opened an issue on the flake8 GH repo https://github.com/PyCQA/flake8/issues/1652 that got immediately closed - not sure what the dev that closed that issue was on about and frankly I wish he was a bit nicer too :grin:

sigmavirus24 commented 2 years ago

@valeriupredoi flake8 had a public API that we're committed to not breaking but this plugin does not use that and instead is accessing things only intended for use by Flake8. If people won't develop against the API, and then their tooling breaks, that's not a big in flake8. Hence why it was closed. Did you read the comments on the issue you found?

valeriupredoi commented 2 years ago

@sigmavirus24 that makes sense! I did - and I wanted to find a comment like yours, and with a bit more context too, and a possible solution too, not a terse snap of a comment - I like it when people learn stuff, helped by the ones that know what the problem is :smiley: Also, it's none of our faults that flake8>5 is breaking, flake8 and pytest-flake8 should get their affairs in order for happy users :grin:

sigmavirus24 commented 2 years ago

I'm a Flake8 maintainer. I've tried to help this plugin to the right thing and been ignored. Flake8 bears no further responsibility here and you telling me that we do is a shitty way to behave. Read the license of Flake8. We already go above and beyond that but it's apparently not enough? I have tried to help but that's not enough? You decide you have the right to demand more of our time helping a project that the pytest devs don't condone, that had ignored offers of help to do the right thing? That sucks and that's the attitude burning people out

valeriupredoi commented 2 years ago

@sigmavirus24 I am very sorry to hear that - and that exposes a few issues I've seen around here (the Python packages ecosystem, not here-here) - being ignored or not having a healthy collaboration with the groups that actually are related to your project - not to mention the feedstock maintainers that don't communicate with the package devs or vice-versa - I feel your pain. Regardless, note that I didn't demand anything, I was just hoping for a nicer, more informative comment, like we all should try to provide on GitHub, and I know it's a bit more time-consuming, but it goes a long way: e.g. if your colleague wasn't such a buzz-kill and shut off that issue (literally, by locking it) and wrote only two more lines a la "pytest-flake8 is causing the issues, I recommend pinning flake8 for now until we/they sort out the issues" and maybe post a link for a relevant, open issue you wouldn't have to waste your time writing comments here. Having said this, cheers for the explanation about the problems flake8 is having with pytest_flake8, we'll rethink the use of the plugin :+1:

sigmavirus24 commented 2 years ago

Except that the issue you commented on was a duplicate linked (if I remember correctly to the duplicate which had greater detail), so there was already greater detail available already.

Also you said

Also, it's none of our faults that flake8>5 is breaking, flake8 and pytest-flake8 should get their affairs in order for happy users 😁

Implying that Flake8 shared blame here and "should" do something else. That's what I'm reacting to. The idea that we should do something else. The idea anyone should do anything is in excess of what the project guarantees in the license. Your choice of language is shame-y which leads to burnout.

valeriupredoi commented 2 years ago

sorry, mate, nowhere on https://github.com/PyCQA/flake8/issues/1652 does it say it's a duplicate of anything - the only label is Invalid; alas, my apologies for the choice of words, but a nice and polite pointer to the License would have sorted this out; don't expect newcomers to the repo to have read the license, also do expect newcomers to the repo to assume that flake8 is somehow well related to pytest-flake8 - I get your frustration from the plugin vs package set of conflicts (now that you told me about them, I've actually initiated the move to move away from pytest-flake8 in our project thanks to info from you, cheers!) but please be patient with people posting on your GH repo - again, coming back to being a bit nicer and accommodating - we're Europeans, we demand politeness :grin: :grin:

sigmavirus24 commented 2 years ago

You demand politeness but politeness would be searching an issue tracker for your issue. You found one closed issue with the exception related to a different tool accessing internals but not the 2+ others?

Further there isn't a single open source license that guarantees your right to demand anything. You do have the right to use without any implicit warranty, right to redistribute and right to modify but that is pretty much the basics. Some licenses have other things like patent/intellectual property protections and copyright assignment etc but there's no guarantee that a developer has to respond to you, repair a bug, or provide you free support (technical, or in this case, emotional).

I've worked with tonnes of Europeans all of whom understood this. I don't think that is a valid excuse for being impolite. If you're going to demand politeness, learn to show it yourself first. Kindness begets kindness.

valeriupredoi commented 2 years ago

@sigmavirus24 mate, like I said above, I don't demand, oh sorry - demand - anything, all I was saying was:

I must apologize to the other fellas around on this open issue for this sort of back and forth, it is neither professional nor pertinent to the issue at hand, but it looks like some people are simply unable to admit they, and their project, and their employees/colleagues can improve. @sigmavirus24 I suggest we wrap this up, and if you would still want to go on, please feel free to contact me at my work email valeriu.predoi@ncas.ac.uk Cheers!

jaraco commented 1 year ago

This issue becomes even more pressing now that importlib_metadata 5 no longer supports the deprecated interfaces used by flake8 4.x. Later versions of flake8 do seem to support it.

jaraco commented 1 year ago

I had the same problem with versions 5.0.0 and up of flake8. FWIW, some of the pytest devs now consider using flake8 within pytest to be an anti-pattern, and prefer doing flake8/black/etc. checks using pre-commit: pytest-dev/pytest#9217 (comment)

See https://github.com/jaraco/skeleton/issues/48 why that recommendation leads to unnecessary complexity and a degraded experience.

jvavrek commented 1 year ago

See https://github.com/jaraco/skeleton/issues/48 why that recommendation leads to unnecessary complexity and a degraded experience.

Interesting, thanks. In our case we were already doing flake8 and black checks in both pre-commit and pytest on the CI, so removing them from pytest actually reduced complexity. I haven't noticed any major downsides since making the change. But depending on your setup, of course, YMMV.

jaraco commented 1 year ago

This issue means pytest-flake8 is unusable on Python 3.12, as flake8<5 is incompatible with Python 3.12. Are there any plans to fix it?

ahharu commented 1 year ago

Help!!!

jaraco commented 1 year ago

I see that this project was almost abandoned earlier this year and even had a PEP 541 request (https://github.com/pypa/pypi-support/issues/1584) to hand off ownership. I'm going to file a separate issue about general project maintenance and explore options there.

valeriupredoi commented 1 year ago

Help!!!

use flake8 (and call it with eg flake8 -n 4 for CircleCI or flake8 -n 2 for Github Actions, the recommended numbers of processes differ between platforms) and remove pytest-flake8 from your environment; we've done that (and even unpinned flake8 from flake8 <5 while we were using the plugin) and all works fine :+1: