-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Remove setuptools dependency in our test suite #27355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNT Remove setuptools dependency in our test suite #27355
Conversation
@@ -217,6 +217,9 @@ def test_import_all_consistency(): | |||
for modname in submods + ["sklearn"]: | |||
if ".tests." in modname: | |||
continue | |||
# Avoid test suite depending on setuptools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the act of using pkgutil.pkgutil.walk_packages
to go through every submodule which includes _build_utils
end up importing setuptools anyways?
XREF: #26992
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that it will indeed try to import all the submodules (and hence try to import setuptools), but that ImportError
is going to be ignored. By default (onerror=None
), only ImportError
is ignored. When specifying onerror
, any kind of Exception
is ignored:
https://github.com/python/cpython/blob/1f885df2a580360c5de69cc41191f3c6bfaaeb35/Lib/pkgutil.py#L76-L86
In other words, there is no hard dependency on setuptools by using pkgutil.walk_packages
but this may still have side-effects as in #26992 if setuptools can be imported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks very much @lesteve.
This was noticed when working on Python 3.12 wheels in #27027. In Python 3.12 setuptools is not a core dependency
venv
(see this).As noted in #27027 (comment), our test suite should not depend on setuptools.
This PR:
test_tabs
which is not useful since we are using blacksklearn._build_utils.pre_build_helpers
(which is the only module depending on setuptools) to check its__all__
in test_import_all_consistency`