You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Configure black and isort only once in pyproject.toml #1684
#1626 added a pyproject.toml, which can be used to configure code formatters black and isort in one place only. Let's put the config parameters (line length, which files to include, etc) there.
I am planning to do that when resolving #1582.
I am submitting changes applying each of the linters separately and in the end, will add a pr moving the linters configuration options in pyproject.toml and actually starting linting the tests.
I was successful in moving all of the black configuration options in pyproject.toml except those about which files are included. These days I tried multiple ways to use the include option, so we can just call black --config=pyproject.toml, but I was not successful.
Finally, I found this comment psf/black#861 (comment), and issue psf/black#740 which explained that we can't use black without the --path argument included.
As a result, I will move all configuration options for black inside pyproject.toml without the actual directories that need to be linted.
Sadly, I can't move check and diff attributes as well. In the documentation it's said that for both check and diff are not supported in configuration files.
Additionally, in two issues PyCQA/isort#954 and PyCQA/isort#599 it was confirmed that in integration tests we should use --check and --diff the way we did until now.
Activity
MVrachev commentedon Nov 18, 2021
I am planning to do that when resolving #1582.
I am submitting changes applying each of the linters separately and in the end, will add a pr moving the linters configuration options in
pyproject.tomland actually starting linting the tests.MVrachev commentedon Nov 29, 2021
I was successful in moving all of the
blackconfiguration options inpyproject.tomlexcept those about which files are included. These days I tried multiple ways to use theincludeoption, so we can just callblack --config=pyproject.toml, but I was not successful.Finally, I found this comment psf/black#861 (comment), and issue psf/black#740 which explained that we can't use
blackwithout the--pathargument included.As a result, I will move all configuration options for black inside
pyproject.tomlwithout the actual directories that need to be linted.MVrachev commentedon Nov 30, 2021
It's the same situation with
isortas it was withblack.I thought I can use only src_path and remove the target directories, but it seems I am wrong because when I tried running
isortwithisort --settings-path=pyproject.tomlI got the error:Error: arguments passed in without any paths or content.I am not the only one with that problem as a user explicitly asked about that PyCQA/isort#1616 and I saw one project with source configuration https://github.com/Pylons/pyramid/blob/master/pyproject.toml, but they had to give explicit folders too https://github.com/Pylons/pyramid/blob/8061fce297cc7117d3e6e2b39e47512c7db2904f/tox.ini#L26 and https://github.com/Pylons/pyramid/blob/8061fce297cc7117d3e6e2b39e47512c7db2904f/tox.ini#L66
As a result, I will move all configuration options for
isortinside pyproject.toml without the actual directories that need to be linted.MVrachev commentedon Nov 30, 2021
Sadly, I can't move
checkanddiffattributes as well. In the documentation it's said that for both check and diff are not supported in configuration files.Additionally, in two issues PyCQA/isort#954 and PyCQA/isort#599 it was confirmed that in integration tests we should use
--checkand--diffthe way we did until now.