-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
quiet in pyproject.toml not respected when isort run from code #1461
quiet in pyproject.toml not respected when isort run from code #1461
Comments
Hi @czerus, Thank you for the report, and I am sorry you are encountering this issue! My initial hunch is that the most likely thing is that when you call it from the API it's not finding your configuration file. You can manually specify the file or path: isort.file("my_file.py", settings_file="full/path/to/pyproject.toml") Additionally, you can always override single settings just by passing them in, similar to how the CLI allows overriding similar settings: isort.file("my_file.py", quiet=True) Let me know if these suggestions help resolve your issue! Thanks! ~Timothy |
Also, if you are doing this on more than one file in your script, I recommend reusing the configuration to help improve performance: import isort
isort_config = isort.Config(settings_file=".isort.cfg", quiet=True)
for file in files:
isort.file(file, config=isort_config) |
Thank you for such fast reply 👍
and made sure that in debugger quiet is set to
and debugger shows that What works is providing the whole config that is earlier read from toml:
|
Fixed #1461: Quiet config option not respected by file API in some ci…
@czerus Thanks for all the information! I was able to isolate the cause of quiet not being skipped unless the config was predefined, and I’ve fixed it in develop. This will go out with the 5.6.0 release of isort. Thanks! ~Timothy |
Super! Glad I could help. @timothycrosley when can we expect this 5.6.0 release? |
The expected release date is on or before October 1st |
Update: this has just been released to PyPI in 5.6.0 release of isort: https://pycqa.github.io/isort/CHANGELOG/#560-october-7-2020 Thanks! ~Timothy |
Hi
I have an isort settings in pyproject.toml that looks like follow:
and using isort in python script (together with autopep) to format the code:
isort.file(path_to_file)
. When isort finds that something needs to be reformatted in a file it prints: "Fixing path_to_file". So it does not respect the configuration from toml. In order to fix that I need to pass the customConfig
instance tofile
method but this overwrites all the settings from toml. Wha is strange is that isort run from command line properly handles this quiet in toml and does not prints "Fixing...."I am using python 3.6.8 and isort 5.5.0
The text was updated successfully, but these errors were encountered: