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

Do not cache configuration files #1995

Merged
merged 2 commits into from
Feb 10, 2023
Merged

Conversation

kaste
Copy link
Contributor

@kaste kaste commented Nov 11, 2022

Fixes #1994

isort can run in long processes when used in an editor. In that scenario it is confusing for users when editing a configuration file does not change isorts outcome.

Remove the caches in settings.py completely to re-read the configuration on each run.

This is safe for the CLI case as we here either use the Trie implementation which collects all known configuration files beforehand, or we exactly construct one Config object based on the first filename, the working dir, or the explicit settings_path|file settings.

Not caching is therefore more efficient for the CLI case and more useful for the editor case.

@kaste kaste force-pushed the less-cache branch 2 times, most recently from e19356f to 37a6187 Compare February 8, 2023 14:49
Fixes PyCQA#1994

isort can run in long processes when used in an editor.  In that
scenario it is confusing for users when editing a configuration file
does not change isorts outcome.

Remove the caches in `settings.py` completely to re-read the
configuration on each run.

This is safe for the CLI case as we here either use the `Trie`
implementation which collects all known configuration files beforehand,
or we exactly construct one `Config` object based on the first filename,
the working dir, or the explicit `settings_path|file` settings.

Not caching is therefore more efficient for the CLI case and more
useful for the editor case.
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #1995 (924466e) into main (4e3ccb1) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1995      +/-   ##
==========================================
- Coverage   99.22%   99.22%   -0.01%     
==========================================
  Files          38       38              
  Lines        3091     3087       -4     
  Branches      747      747              
==========================================
- Hits         3067     3063       -4     
  Misses         14       14              
  Partials       10       10              

@kaste
Copy link
Contributor Author

kaste commented Feb 8, 2023

@timothycrosley Sorry for the delayed rebase and actually making it green.

@timothycrosley timothycrosley merged commit 759d969 into PyCQA:main Feb 10, 2023
@kaste kaste deleted the less-cache branch February 10, 2023 14:49
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 this pull request may close these issues.

Do not cache configuration files
2 participants