Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit args need to be concatenated #721

Closed
amadeuspzs opened this issue May 17, 2022 · 2 comments
Closed

pre-commit args need to be concatenated #721

amadeuspzs opened this issue May 17, 2022 · 2 comments

Comments

@amadeuspzs
Copy link

The pre-commit example is:

  rev: 1.3.1
  hooks:
    - id: nbqa-black
    - id: nbqa-pyupgrade
      args: [--py36-plus]
    - id: nbqa-isort

However, black and isort sometimes fight over module import orders. This is resolved by passing args: ["--profile", "black"] into the precommit config, but for some reason, for the nbqa-isort module only, this needs to be args: ["--profile=black"]

I haven't seen this flagged anywhere so might be specific to my setup.

Is this an issue with pre-commit?

@MarcoGorelli
Copy link
Collaborator

Hi @amadeuspzs - you can put profile=black in your configuration file (e.g. pyproject.toml - see https://pycqa.github.io/isort/docs/configuration/config_files.html)

but for some reason, for the nbqa-isort module only, this needs to be args: ["--profile=black"]

yeah unfortunately pre-commit passes the args first, which isn't how nbQA expects its arguments. I might need to make a breaking change to the api to get this to work, e.g.

nbqa --tool isort --files file.ipynb

rather than

nbqa isort file.ipynb

For now, either args: ["--profile=black"] or just using a configuration file to specify this option is what I'd suggest as a workaround

@MarcoGorelli
Copy link
Collaborator

closed by #732

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants