image/svg+xml import hglib.client hglib package finder.find_spec('hglib', None) Finder for p in sys.path: "hglib/" /usr/…/site-packages/hglib/ loader create_module(spec) __name__ = 'hglib'__file__ = '/usr/…/hglib/__init__.py__cached__ = '…/__pycache__/…/…__.cpython3.5.pyc__path__ = ['/usr/…/hglib/']__package__ = 'hglib'__loader__ = <class '….SourceFileLoader'> exec_module(module) set sys.module['hglib']get the file content from __file__parse the treestore the pyc in __cached__run the code spec sys.modules["hglib"] sys.modules["hglib.client"] /usr/…/site-packages/hglib/ SourceFileLoader create_module(spec) __name__ = 'hglib.client'__file__ = '/usr/…/hglib/client.py__cached__ = '…/__pycache__/…/…nt.cpython3.5.pyc__path__ = None__package__ = 'hglib'__loader__ = <class '….SourceFileLoader'> exec_module(module) set sys.module['hglib.client']get the file content from __file__parse the treestore the pyc in __cached__run the code spec hglib.client module find_spec('hglib.client', None) PathFinder client/ client.pyd client.pyo client.pyc for f in sys.meta_path: FileFinder find_spec('hglib.client', path) for h in sys.path_hooks: for p in hglib.path: import mercurial.parsers /usr/…/mercurial/pure/ HgLazyLoader source_to_code(data, path) from __past__ import byte_literaliteritems → itemsetc… set_data(path, data) write byte code to diskcustom magic string spec mercurial.parsers find_spec('mercurial.parsers', None) HgPathFinder for f in sys.meta_path: o.find_spec('mercurial.pure.parsers') for p in mercurial.policy: for o in sys.meta_path: (cpython, cffi, pure) Import&Company Pierre-Yves David@Marmoute Questions?
  1. F0
  2. F1
  3. F2
  4. F3
  5. F4
  6. F5
  7. F6
  8. F7
  9. F8
  10. F8.5
  11. F9
  12. F10
  13. F11
  14. F12
  15. F13
  16. F14
  17. F14.5
  18. F15
  19. F16
  20. F17
  21. F18
  22. F19
  23. F20
  24. F21
  25. F22
  26. F23
  27. F24
  28. F25