You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is created to address a discussion in the comments of PR #8.
We're currently using the place_module function from the isort library to assess whether an imported dependency is part of Python's stdlib.
It turns out that isort has a static list of stdlib modules for each Python version. And on further digging in the isort code, @jherland found out that the way these lists are compiled is based on non documented features:
I followed your above link, and looked at the files themselves, which led me to the script that isort uses to make those files, and it's is even more horrible: There seems to be an objects.inv file available from python.org for each release (e.g. https://docs.python.org/3.7/objects.inv), but it's in some weird undocumented partially zlib-compressed format that is decoded by some utility inside Sphinx (a tool for generating API documentation). Yuck...
(edit: more information here: https://sphobjinv.readthedocs.io/en/stable/syntax.html)
Proposed solution
To replace the above isort function with native code, we could use sys.stdlib_module_names in Python >=v3.10, and keep hardcoded lists of stdlib modules for versions 3.7, 3.8 and 3.9.
The text was updated successfully, but these errors were encountered:
Reclassified this issue as considerably less important (consider even wontfix): Since we created this issue we have come to rely more, not less, on isort's classification of import statements. If we are to drop isort as a dependency, it must come with additional benefits/rationale.
This issue is created to address a discussion in the comments of PR #8.
We're currently using the
place_module
function from theisort
library to assess whether an imported dependency is part of Python's stdlib.It turns out that
isort
has a static list of stdlib modules for each Python version. And on further digging in theisort
code, @jherland found out that the way these lists are compiled is based on non documented features:Proposed solution
To replace the above
isort
function with native code, we could usesys.stdlib_module_names
in Python >=v3.10, and keep hardcoded lists of stdlib modules for versions 3.7, 3.8 and 3.9.The text was updated successfully, but these errors were encountered: