Isort: dataclasses lib considered as part of stdlib in python 3.6

Created on 13 Oct 2020  路  3Comments  路  Source: PyCQA/isort

Hi,
I have installed dataclasses via pip (https://pypi.org/project/dataclasses/), I use python 3.6, but isort still reformats imports with placing import dataclasses in top section (probably into stdlib section).
Can I configure this somehow or what should I change to have it in 3rd party section?

thx

question

Most helpful comment

@adaamz if you don't specify the exact python version isort should use by --py flag, then as mentioned in https://github.com/PyCQA/isort/blob/develop/docs/configuration/options.md : Default is to assume any Python 3 version could be the target, and use a union of all stdlib modules across versions. You can also choose auto in --py options to use the python version of the interpreter isort is being executed from, also mentioned in https://github.com/PyCQA/isort/blob/develop/docs/configuration/options.md. I tried isort with '--py 36' option and it didn't classify dataclasses as STDLIB.

Hope this helps.

All 3 comments

@adaamz if you don't specify the exact python version isort should use by --py flag, then as mentioned in https://github.com/PyCQA/isort/blob/develop/docs/configuration/options.md : Default is to assume any Python 3 version could be the target, and use a union of all stdlib modules across versions. You can also choose auto in --py options to use the python version of the interpreter isort is being executed from, also mentioned in https://github.com/PyCQA/isort/blob/develop/docs/configuration/options.md. I tried isort with '--py 36' option and it didn't classify dataclasses as STDLIB.

Hope this helps.

tyvm!

Isort 4.X (used in Coala linting aggregation utility) seems to have no option to set python version. There is -o for 'KNOWN_THIRD_PARTY' libraries and --virtual-env for setting virtual env to determine whether a package is third-party. Not much though ((

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ionelmc picture ionelmc  路  3Comments

and-semakin picture and-semakin  路  3Comments

jedie picture jedie  路  3Comments

AlexandreYang picture AlexandreYang  路  3Comments

johnthagen picture johnthagen  路  3Comments