Skip to content

BadDependencyError when assigning an inherited classmethod to a variable #1840

@Avasam

Description

@Avasam

See https://github.com/python/typeshed/pull/12991/files#diff-75dfb84f0ad6ea28f6880f12c95f276b475cd3f908f0efaaee59217a16de05a3L57-R60
Permalink: https://github.com/Avasam/typeshed/blob/063be1660a9589c1c07fb6e96af275c822d42789/stubs/setuptools/setuptools/__init__.pyi#L58-L59

Replacing

from .discovery import _Finder
find_packages = _Finder.find
find_namespace_packages = _Finder.find

With

from .discovery import PackageFinder, PEP420PackageFinder
find_packages = PackageFinder.find
find_namespace_packages = PEP420PackageFinder.find

Where those classes are defined as:

class _Finder:
    ALWAYS_EXCLUDE: ClassVar[tuple[str, ...]]
    DEFAULT_EXCLUDE: ClassVar[tuple[str, ...]]
    @classmethod
    def find(cls, where: StrPath = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ...

class PackageFinder(_Finder):
    ALWAYS_EXCLUDE: ClassVar[tuple[str, ...]]

class PEP420PackageFinder(PackageFinder): ...

Causes the following errors https://github.com/python/typeshed/actions/runs/11769652125/job/32780972631?pr=12991#step:8:1937

stubs/fanstatic/fanstatic/__init__.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/fanstatic/fanstatic/compiler.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/fanstatic/fanstatic/publisher.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/fanstatic/fanstatic/registry.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/fanstatic/fanstatic/wsgi.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/libsass/sassutils/distutils.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/setuptools/setuptools/__init__.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/setuptools/setuptools/build_meta.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/setuptools/setuptools/command/easy_install.pyi (3.12): pytype.load_pytd.BadDependencyError: Unknown module setuptools, referenced from 'setuptools.command.easy_install'

stubs/setuptools/setuptools/command/editable_wheel.pyi (3.12): pytype.load_pytd.BadDependencyError: Unknown module setuptools, referenced from 'setuptools.command.editable_wheel'

stubs/setuptools/setuptools/command/egg_info.pyi (3.12): pytype.load_pytd.BadDependencyError: Unknown module setuptools, referenced from 'setuptools.command.egg_info'

stubs/setuptools/setuptools/command/test.pyi (3.12): pytype.load_pytd.BadDependencyError: No PEP420PackageFinder.find in module setuptools.discovery, referenced from 'setuptools'

stubs/setuptools/setuptools/discovery.pyi (3.12): pytype.load_pytd.BadDependencyError: Unknown module setuptools, referenced from 'setuptools.dist'

stubs/setuptools/setuptools/dist.pyi (3.12): pytype.load_pytd.BadDependencyError: Unknown module setuptools, referenced from 'setuptools.dist'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions