isort icon indicating copy to clipboard operation
isort copied to clipboard

Add separate_packages option

Open alex-liang3 opened this issue 1 year ago • 4 comments

Resolves https://github.com/PyCQA/isort/issues/2104 by adding a separate_packages config option. This should also cover https://github.com/PyCQA/isort/pull/2262.

Sections provided in this field will have the packages within them be separated by a blank line. This also works with custom known_OTHER sections; see tests for examples.

For reference, these changes increase the cyclomatic complexity (PY-R1000) of this function from 68 to 75, so I'm proposing to ignore the check on this function for the same reason as in https://github.com/PyCQA/isort/pull/2340/files#diff-d97e563d18af5b82fdf3bbb340c60da3e6955177a064fcbaf7e8676589933ddaR243

alex-liang3 avatar Dec 12 '24 18:12 alex-liang3

Any chance of merging this one?

It would really help me. Now I had to write a very ugly hack for the config file to simulate this behavior.

vavanade avatar Jan 08 '25 21:01 vavanade

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.16%. Comparing base (1157b58) to head (7808f3f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2313   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files          40       40           
  Lines        3101     3128   +27     
  Branches      680      687    +7     
=======================================
+ Hits         3075     3102   +27     
  Misses         15       15           
  Partials       11       11           

codecov[bot] avatar Feb 19 '25 19:02 codecov[bot]

Thanks for the review @staticdev, and all your efforts on this project so far! I've made the requested changes now, but unfortunately the function call itself still adds +1 to the cyclomatic complexity (the criticality threshold is 50).

Let me know what you think of the changes :)

alex-liang3 avatar Feb 19 '25 22:02 alex-liang3

Hello @staticdev, I'm also interested in using this feature. Would it be possible to consider merging it?

lucas-bremond avatar May 20 '25 07:05 lucas-bremond