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

It seems --jobs and --diff cannot be used together #2216

Open
ian-h-chamberlain opened this issue Dec 29, 2023 · 0 comments
Open

It seems --jobs and --diff cannot be used together #2216

ian-h-chamberlain opened this issue Dec 29, 2023 · 0 comments

Comments

@ian-h-chamberlain
Copy link

I couldn't find any documention or other issues on this, so I'm not sure if this is intended behavior (and undocumented) or just a bug.

Tested with isort 5.13.2, running isort --diff --jobs=2 acts the same as isort --jobs=2 (that is, the --diff option is ignored). I could imagine there might be a concern about interleaving diff output from different jobs, in which case I think there are a couple options:

  1. Disallow --diff --jobs (and equivalent config) entirely and display an error (and document this behavior)
  2. Implement some kind of locking to serialize the diffs from different jobs
  3. Do nothing to prevent interleaving and hope for the best (maybe document this as a caveat?)

The cause of the current behavior seems pretty clear: show_diff is not plumbed into the executor if jobs is used: https://github.com/PyCQA/isort/blob/main/isort/main.py#L1193-L1223

From a quick test, adding show_diff=show_diff to the executor.imap call seems to work in simple cases (effectively option 3) but I haven't tested it extensively with lots of files at once or high job counts.

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

No branches or pull requests

1 participant