#4243 add isort for automatically import sorting
Opened 3 months ago by julian8628. Modified 3 months ago
julian8628/koji isort  into  master

file modified
+28
@@ -79,6 +79,34 @@ 

  commands =

      {[testenv:py2]commands}

  

+ [testenv:isort]

+ deps =

+     isort

+ skip_install=true

+ usedevelop=true

+ whitelist_externals = isort

+ allowlist_externals = isort

+ commands = isort --check --diff {posargs:.}

+ 

+ [testenv:isort-format]

+ deps =

+     isort

+ skip_install=true

+ usedevelop=true

+ whitelist_externals = isort

+ allowlist_externals = isort

+ commands = isort {posargs:.}

+ 

+ [isort]

+ ; skip_glob = tests

+ not_skip = __init__.py

+ default_section = THIRDPARTY

+ known_first_party = koji,koji_cli,kojihub,kojiweb,__main__

+ sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

+ no_lines_before = LOCALFOLDER

+ multi_line_output = 3

+ line_length = 99

+ 

  [testenv:bandit]

  # These two lines just speed things up by avoiding unnecessary setup

  skip_install=true

Metadata Update from @julian8628:
- Pull-request tagged with: no_qe

3 months ago

Metadata Update from @julian8628:
- Pull-request untagged with: no_qe

3 months ago

I'm not quite sold on building isort into our automation. While I agree it's nice to have well structured imports, I'm not sure the opinionated choices of isort are always ideal. It also does very little to address actual issues (unlike say, flake8 which can often find real code problems).

But more importantly, I'm not sure that isort gives completely reproducible results across systems. The disparity between work in #4239 and my local isort results gives me pause.

It's pretty easy to just run a direct isort command as needed. I'm not sure this needs to be enshrined in our tox config.

I was intending to have isort there to align this format for all developers. But if the default isort config is sufficient to us, I think we don't need this in tox.ini

The isort config I have here was customized years before so the result might be much different from the default one:

https://pagure.io/fork/julian8628/koji/commits/import-sorting

It was created by isort . with python3-isort-5.13.2-1.fc39.noarch which might be the same as yours. Is it?

If so, I think it should be good enough to replace this PR

Metadata