It's a small but constant annoyance to not be able to deep reload the varcode module (e.g. in a long running IPython session), due some issue with pyfaidx. Instead, when modifying varcode, I have to restart the IPython kernel with each update.
Perhaps there is some way to isolate the faidx module in a way that allows the varcode module to be reloaded.
>> dreload(varcode)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-10-9d47e937d853> in <module>()
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in reload(module, exclude)
339 try:
340 with replace_import_hook(deep_import_hook):
--> 341 return deep_reload_hook(module)
342 finally:
343 found_now = {}
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in deep_reload_hook(m)
309
310 try:
--> 311 newm = imp.load_module(name, fp, filename, stuff)
312 except:
313 # load_module probably removed name from modules because of
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_module(name, file, filename, details)
233 raise ValueError(msg)
234 elif type_ == PY_SOURCE:
--> 235 return load_source(name, filename, file)
236 elif type_ == PY_COMPILED:
237 return load_compiled(name, filename, file)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_source(name, pathname, file)
167 methods = _SpecMethods(spec)
168 if name in sys.modules:
--> 169 module = methods.exec(sys.modules[name])
170 else:
171 module = methods.load()
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec_module(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
/Users/tim/sinai/git/varcode/varcode/variant_collection.py in <module>()
19 from .effects import Substitution
20 from .effect_ordering import effect_priority, transcript_effect_priority_dict
---> 21 from .variant import Variant
22 from . import type_checks
23
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in deep_import_hook(name, globals, locals, fromlist, level)
250 parent, buf = get_parent(globals, level)
251
--> 252 head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
253
254 tail = head
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in load_next(mod, altmod, name, buf)
154 buf += subname
155
--> 156 result = import_submodule(mod, subname, buf)
157 if result is None and mod != altmod:
158 result = import_submodule(altmod, subname, subname)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in import_submodule(mod, subname, fullname)
199
200 try:
--> 201 m = imp.load_module(fullname, fp, filename, stuff)
202 except:
203 # load_module probably removed name from modules because of
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_module(name, file, filename, details)
233 raise ValueError(msg)
234 elif type_ == PY_SOURCE:
--> 235 return load_source(name, filename, file)
236 elif type_ == PY_COMPILED:
237 return load_compiled(name, filename, file)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_source(name, pathname, file)
167 methods = _SpecMethods(spec)
168 if name in sys.modules:
--> 169 module = methods.exec(sys.modules[name])
170 else:
171 module = methods.load()
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec_module(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
/Users/tim/sinai/git/varcode/varcode/variant.py in <module>()
16
17 from . import type_checks
---> 18 from .coding_effect import infer_coding_effect
19 from .common import group_by
20 from .nucleotides import normalize_nucleotide_string
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in deep_import_hook(name, globals, locals, fromlist, level)
250 parent, buf = get_parent(globals, level)
251
--> 252 head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
253
254 tail = head
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in load_next(mod, altmod, name, buf)
154 buf += subname
155
--> 156 result = import_submodule(mod, subname, buf)
157 if result is None and mod != altmod:
158 result = import_submodule(altmod, subname, subname)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in import_submodule(mod, subname, fullname)
199
200 try:
--> 201 m = imp.load_module(fullname, fp, filename, stuff)
202 except:
203 # load_module probably removed name from modules because of
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_module(name, file, filename, details)
233 raise ValueError(msg)
234 elif type_ == PY_SOURCE:
--> 235 return load_source(name, filename, file)
236 elif type_ == PY_COMPILED:
237 return load_compiled(name, filename, file)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_source(name, pathname, file)
167 methods = _SpecMethods(spec)
168 if name in sys.modules:
--> 169 module = methods.exec(sys.modules[name])
170 else:
171 module = methods.load()
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec_module(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
/Users/tim/sinai/git/varcode/varcode/coding_effect.py in <module>()
28 FrameShiftTruncation
29 )
---> 30 from .string_helpers import trim_shared_flanking_strings
31
32 from Bio.Seq import Seq, CodonTable
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in deep_import_hook(name, globals, locals, fromlist, level)
250 parent, buf = get_parent(globals, level)
251
--> 252 head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
253
254 tail = head
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in load_next(mod, altmod, name, buf)
154 buf += subname
155
--> 156 result = import_submodule(mod, subname, buf)
157 if result is None and mod != altmod:
158 result = import_submodule(altmod, subname, subname)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in import_submodule(mod, subname, fullname)
199
200 try:
--> 201 m = imp.load_module(fullname, fp, filename, stuff)
202 except:
203 # load_module probably removed name from modules because of
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_module(name, file, filename, details)
233 raise ValueError(msg)
234 elif type_ == PY_SOURCE:
--> 235 return load_source(name, filename, file)
236 elif type_ == PY_COMPILED:
237 return load_compiled(name, filename, file)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_source(name, pathname, file)
167 methods = _SpecMethods(spec)
168 if name in sys.modules:
--> 169 module = methods.exec(sys.modules[name])
170 else:
171 module = methods.load()
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec_module(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
/Users/tim/sinai/git/varcode/varcode/string_helpers.py in <module>()
15 from __future__ import print_function, division, absolute_import
16
---> 17 import pyfaidx
18
19 def reverse_complement(x):
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in deep_import_hook(name, globals, locals, fromlist, level)
250 parent, buf = get_parent(globals, level)
251
--> 252 head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
253
254 tail = head
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in load_next(mod, altmod, name, buf)
154 buf += subname
155
--> 156 result = import_submodule(mod, subname, buf)
157 if result is None and mod != altmod:
158 result = import_submodule(altmod, subname, subname)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in import_submodule(mod, subname, fullname)
199
200 try:
--> 201 m = imp.load_module(fullname, fp, filename, stuff)
202 except:
203 # load_module probably removed name from modules because of
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_module(name, file, filename, details)
243 return load_dynamic(name, filename, file)
244 elif type_ == PKG_DIRECTORY:
--> 245 return load_package(name, filename)
246 elif type_ == C_BUILTIN:
247 return init_builtin(name)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/imp.py in load_package(name, path)
213 methods = _SpecMethods(spec)
214 if name in sys.modules:
--> 215 return methods.exec(sys.modules[name])
216 else:
217 return methods.load()
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _exec(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in exec_module(self, module)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/pyfaidx/__init__.py in <module>()
10 import warnings
11 from six import PY2, PY3, string_types
---> 12 from six.moves import zip_longest
13 try:
14 from collections import OrderedDict
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in deep_import_hook(name, globals, locals, fromlist, level)
254 tail = head
255 while name:
--> 256 tail, name, buf = load_next(tail, tail, name, buf)
257
258 # If tail is None, both get_parent and load_next found
/Users/tim/sinai/git/datacache/venv/lib/python3.4/site-packages/IPython/lib/deepreload.py in load_next(mod, altmod, name, buf)
161
162 if result is None:
--> 163 raise ImportError("No module named %.200s" % name)
164
165 return result, next, buf
ImportError: No module named moves