microsoft / vscode-flake8

Linting support for python using the flake8 library.
https://marketplace.visualstudio.com/items?itemName=ms-python.flake8
MIT License
41 stars 30 forks source link

enable flake8 configuration from pyproject.toml #134

Closed dciborow closed 1 year ago

dciborow commented 1 year ago

Adding a flake8 extension that enables configuration of flake8 via pyproject.toml. Also updating the readme to better describe the setup process for users.

Closes https://github.com/microsoft/vscode-flake8/issues/135

dciborow commented 1 year ago

removed request for luabud and cwebster-99

Did not mean to do that. @luabud and @cwebster-99 for review as well please :-)

brettcannon commented 1 year ago

I don't know if I'm comfortable in taking this. This requires a 3rd-party library from flake8 to work, so we would have to track a second project for this to make sense. And the flake8 maintainers have made it very clear that they don't want to support pyproject.toml.

adzenith commented 1 year ago

While I agree from a purity of flake8 standpoint this seems like not the best idea, I have to say I came here to the issues section because I wanted this exact functionality. I ended up just setting fromEnvironment and installing this plugin myself, but it would be cool to have this work automatically so that a workspace can be shared with others and "just work" rather than requiring manual pip installs. Perhaps there could instead just be a configurable list of plugins that the extension could install? That would be better from a purity of design standpoint, and also useful in many more scenarios, but would presumably be much harder to implement.

brettcannon commented 1 year ago

While I agree from a purity of flake8 standpoint this seems like not the best idea

Honestly the best idea would be for flake8 to add support for pyproject.toml, but the project's maintainers are pretty vehement that they don't want that. But we also have to balance this with the maintenance cost. If someone wants to fork this repo and create an extension that uses one of these helper libraries then please do so! Otherwise we want to keep this extension easy to maintain and that means keeping it somewhat simple.

I honestly would recommend looking at Ruff as a linter as it uses pyproject.toml and whose VS Code extension is maintained by the Ruff team themselves.

dciborow commented 1 year ago

Honestly the best idea would be for flake8 to add support for pyproject.toml, but the project's maintainers are pretty vehement that they don't want that. But we also have to balance this with the maintenance cost.

I completely agree with you, but based on the repo maintainer gave up on that being possible.

I have also started using the Ruff linter. But find I still like to include my flake8 configuration in my pyproject.toml, particularly to disable overlapping warnings from flake8. Some people may be using flake8 more widely than my project and may have the extension installed in vscode, and this lets me make sure they aren't spamming with problems in my projects.

Will regroup offline on how to move forward.

brettcannon commented 1 year ago

I have also started using the Ruff linter. But find I still like to include my flake8 configuration in my pyproject.toml, particularly to disable overlapping warnings from flake8.

If Ruff is a missing a lint you want from flake8, then I would ask Ruff to consider including it and getting off of flake8.

Some people may be using flake8 more widely than my project and may have the extension installed in vscode, and this lets me make sure they aren't spamming with problems in my projects.

Unfortunately that's the potential cost of working outside of what flake8 wants by using pyproject.toml for your flake8 configuration; pick your poison.

I'm going to leave other comments on the issue, but I'm closing this (at least for now) as I don't think this is the direction we want to go.