Skip to content

Please don't import from setuptools._distutils directly, as it can cause errors #16318

@abravalheri

Description

@abravalheri

Please don't import from setuptools._distutils directly, as this can cause problems (see pypa/setuptools#3743 for example).

mypy/mypyc/build.py

Lines 61 to 64 in 8236c93

from setuptools._distutils import (
ccompiler as _ccompiler, # type: ignore[attr-defined]
sysconfig as _sysconfig, # type: ignore[attr-defined]
)

The only supported way of accessing disutils is via the importing distutils name (provided by setuptools via a MetaPathFinder). setuptools._distutils is a private implementation detail and importing directly from it is error prone (can break the monkey patching).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions