Skip to content

tomllib is considered as third-party lib in py3.11 but it is built-in now #2007

Closed
@NickVeld

Description

@NickVeld

https://docs.python.org/3/library/tomllib.html

It can be a part of an "epic" called "Support for python3.11" #1996

Behavior before:

@@ -1,8 +1,10 @@
-import tomllib
from pathlib import Path
from typing import Generator
 
+import tomllib
...

Behavior after:
The message that everything is OK

Version: 5.10.1

Activity

NickVeld

NickVeld commented on Nov 23, 2022

@NickVeld
Author

Workarounds:

pyproject.toml

[tool.isort]
extra_standard_library = ['tomllib']

setup.cfg

[isort]
extra_standard_library = tomllib

Action comments (not recommended)

import tomllib  # isort: skip
NickVeld

NickVeld commented on Nov 23, 2022

@NickVeld
Author

Maybe built-in tomllib support can be enabled by py_version=311 when it is added #2008

andersk

andersk commented on Dec 12, 2022

@andersk
Contributor

This seems to have been fixed by #2024 (not released yet) with py_version=311.

staticdev

staticdev commented on Dec 12, 2022

@staticdev
Collaborator

@andersk released, 5.11.0.

bszonye

bszonye commented on Dec 15, 2022

@bszonye

This is still broken for me in isort 5.11.2 (on Ubuntu 22.10). I suspect that's because they're distributing Python 3.11.0rc2, which has the new feature, but that version is not technically >=3.11. I ran into that just the other day with another tool. I suspect this affects anybody running a pre-release version of Python 3.11.

andersk

andersk commented on Dec 15, 2022

@andersk
Contributor

No, it’s because #2024 had bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @andersk@staticdev@bszonye@NickVeld

      Issue actions

        `tomllib` is considered as third-party lib in py3.11 but it is built-in now · Issue #2007 · PyCQA/isort