|
from distutils.version import LooseVersion |
|
import IPython |
|
ipython_version = LooseVersion(IPython.__version__) |
|
if ipython_version < '0.11': |
|
from IPython.genutils import page |
|
from IPython.ipstruct import Struct |
|
from IPython.ipapi import UsageError |
|
else: |
|
from IPython.core.page import page |
|
from IPython.utils.ipstruct import Struct |
|
from IPython.core.error import UsageError |
In Python 3.12 distutils has been removed from the standard library.
We could
- add
setuptools to the dependencies (having it required for the build-system doesn't make it required for the built package).
- write it like
try:
from IPython.core.page import page
from IPython.utils.ipstruct import Struct
from IPython.core.error import UsageError
except ImportError:
# probably IPython < 0.11
from IPython.genutils import page
from IPython.ipstruct import Struct
from IPython.ipapi import UsageError
- drop support of IPython 0.11 from 2011 and just do
from IPython.core.page import page
from IPython.utils.ipstruct import Struct
from IPython.core.error import UsageError
memory_profiler/memory_profiler.py
Lines 941 to 951 in 025929f
In Python 3.12
distutilshas been removed from the standard library.We could
setuptoolsto the dependencies (having it required for the build-system doesn't make it required for the built package).