From 5954aacac6ab724a14458957ccc6e64137632592 Mon Sep 17 00:00:00 2001 From: Ralf Grubenmann Date: Wed, 3 Jan 2024 16:02:49 +0100 Subject: [PATCH] fix: prevent distutils warning (#3663) --- pyproject.toml | 1 + renku/__init__.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 6bfbfebeb8..6392863199 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -314,6 +314,7 @@ module = [ "ruamel", "rq", "shellingham", + "setuptools", "toil.*", "tqdm", "urllib3.*", diff --git a/renku/__init__.py b/renku/__init__.py index e2238061c2..516fde5906 100644 --- a/renku/__init__.py +++ b/renku/__init__.py @@ -23,6 +23,14 @@ from renku.version import __template_version__, __version__ +# distutils is deprecated and fully replaced by setuptools. we don't depend on either, but some of our +# dependencies do and if distutils gets imported before setuptools, we get an annoying warning. +# By forcing the import here first, we prevent that warning and ensure the setuptools version is used. +try: + import setuptools # noqa: F401 # type: ignore +except ImportError: + pass + class LoaderWrapper(importlib.abc.Loader): """Wrap an importlib loader and add the loaded module to sys.modules with an additional name."""