nbQA-dev / nbQA

Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
https://nbqa.readthedocs.io/en/latest/index.html
MIT License
1.02k stars 39 forks source link

Support flake8 configured through pyproject.toml #776

Closed jason-curtis closed 1 year ago

jason-curtis commented 1 year ago

Most tools have been converging towards having their configuration live in pyproject.toml but the core flake8 has not yet done so.

flake8-pyproject is a variant of flake8 that supports configuration through pyproject.toml. Is there a way to enable that with your tool or precommit hook so that those of us configuring flake8 through pyproject.toml can get the benefits of configuring nbqa-flake8?

Right now, workarounds include moving my config to setup.cfg or duplicating the important config as command-line arguments.

s-weigand commented 1 year ago

Does adding it as an additional dependency not work?

- repo: https://github.com/nbQA-dev/nbQA
  rev: 1.5.3
  hooks:
    - id: nbqa-flake8
      additional_dependencies: [flake8, flake8-pyproject] 

From the project itself, it seems to me that it should just work like this

jason-curtis commented 1 year ago

Yes that absolutely does work, thank you! I had not seen that that additional_dependencies was an option.

FWIW, I did not have to include flake8 in additional_dependencies. Only flake8-pyproject.