john-hen / Flake8-pyproject

Flake8 plug-in loading the configuration from pyproject.toml
https://pypi.org/project/Flake8-pyproject
MIT License
218 stars 10 forks source link

Alternatives to this project? #2

Closed ekalosak closed 1 year ago

ekalosak commented 2 years ago

So, I'll start off by saying that this is super useful. But doesn't it duplicate:

I wonder if it wouldn't be better to join up? Or, what distinguishes this project?

john-hen commented 2 years ago

You're absolutely right. And you may want to consider using one of those other projects instead, especially FlakeHell.

I looked at FlakeHell some time ago, maybe six months ago or so. If I remember correctly, it was inactive at the time and had been archived. It has been revived since. I think in January, if I read the commit history correctly. Well, I missed that.

Anyway, I preferred the minimal wrapper that is pyproject-flake8, which I mention in the ReadMe. As opposed to FlakeHell, it has no extra dependencies on top of Flake8 itself. So I used that for a while. But then there was a very simple bug, and a PR that was ignored for months. So I decided to do something about it. I could have forked the project and applied the fix. But there is so little code, a rewrite was quick enough to do, and I liked my way better. Writing the tests is the part that actually took some time (though not a lot of it either).

Now, the author of pyproject-flake8 did eventually turn up again and did the maintenance. But that was only like two weeks ago, and now this project here is indeed quite redundant. 🤷 I don't see what other development there's left to do, except add a test in case someone discovers a bug. So at this point, joining forces seems more effort than just... well, doing nothing, really.

We can leave this issue open so that it's clear there are alternatives.

john-hen commented 2 years ago

Another project brought up in a different issue is Flake9. But it seems to be dormant, last commit (as of this writing) more than two years ago. Probably because they would vendor Flake8, not monkey-patch it as an external dependency. Which requires more maintenance if they want to keep up with Flake8 development.

Then I stumbled across Flake518, which also seems to do the same as pyproject-Flake8. Neither of them, as of this writing, have caught up with Flake8 version 5 yet, but that may just be a matter of time.

As for this project, and thanks to @vcalvert pitching in, it now (as of version 1.1.0) simply works as a Flake8 plug-in. That is, if you run the usual flake8 command in the terminal from inside the folder than contains pyproject.toml, it will grab the configuration from there, as long as "we" (Flake8-pyproject) have been pip-installed in the same Python environment. The flake8p entry point is still supported, but I, for one, have stopped using it.

Also also, this should mean that you don't need a different pre-commit hook, if you're using one. Personally, I don't, so I cannot be sure.

fgimian commented 1 year ago

I just wanted to mention that one of the biggest advantages of this project is that it allows you to continue using the regular flake8 command which makes it seamless to integrate with IDEs which support flake8.

Just wanted to say thanks a lot for building this 😄

hoefling commented 1 year ago

This project is super helpful, thank you so much for the idea and the implementation!

odigity commented 1 year ago

I asked the author of Flake8 to add a link to this project from issue 234 and he said no. Dude's an a-hole.

Thanks for this project, it worked for me.

borice commented 1 year ago

Also wanted to say Thank You for this. I'm still trying to get it to work, but it's probably user error on my part.

What I did was poetry add flake8 flake8-pyproject and then added a [tool.flake8] section in pyproject.toml with the config I wanted, then just ran flake8 <folder_with_src> and it still reported the E501 error even though I have max-line-length = 120 in the TOML config.

flake8 --version returns:

6.0.0 (mccabe: 0.7.0, pycodestyle: 2.10.0, pyflakes: 3.0.0) CPython 3.11.1 on Darwin

I don't have any other configuration file present (such as .flake8, setup.cfg, tox.ini...) Is there some way to activate the plugin once installed?

borice commented 1 year ago

Seems like after deactivating and re-activating the virtual environment things started working. Sorry for the false alarm.

trim21 commented 1 year ago

flakehell doesn't support flake8 >= 4.0 https://github.com/flakehell/flakehell/issues/22

dciborow commented 1 year ago

Have tried pretty much all of the alternatives, and I find this is the easiest one to use.

odigity commented 1 year ago

If the praise keeps rolling in, this thread will never be closeable. :)

trim21 commented 1 year ago

I asked the author of Flake8 to add a link to this project from issue 234 and he said no. Dude's an a-hole.

if i remember correctly the authoer of flake8 once said he will consider adding pyproject.toml support after toml lang spec hit 1.0 and python add toml to stdlib...

ekalosak commented 1 year ago

Seems ok to close, the consensus has appeared to emerge: this project is a simpler, smoother, more actively maintained competitor to other Flake8-to-pyproject.toml implementations.