Skip to content
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

Remove dependency on distutils.version #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions memory_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,18 +937,9 @@ def mprun(self, parameter_s='', cell=None):
from io import StringIO
from memory_profiler import show_results, LineProfiler

# Local imports to avoid hard dependency.
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
from IPython.core.page import page
from IPython.utils.ipstruct import Struct
from IPython.core.error import UsageError

# Escape quote markers.
opts_def = Struct(T=[''], f=[])
Expand Down Expand Up @@ -1131,20 +1122,7 @@ def memit(self, line='', cell=None):

@classmethod
def register_magics(cls, ip):
from distutils.version import LooseVersion
import IPython
ipython_version = LooseVersion(IPython.__version__)

if ipython_version < '0.13':
try:
_register_magic = ip.define_magic
except AttributeError: # ipython 0.10
_register_magic = ip.expose_magic

_register_magic('mprun', cls.mprun.__func__)
_register_magic('memit', cls.memit.__func__)
else:
ip.register_magics(cls)
ip.register_magics(cls)


# commenting out due to failures with some versions of IPython
Expand Down