xdev.autojit module

Utilities to just-in-time-cythonize a module at runtime.

xdev.autojit.import_module_from_pyx(fname, dpath=None, error='raise', autojit=True, verbose=1, recompile=False, annotate=False)[source]

Attempts to import a module corresponding to a pyx file.

If the corresponding compiled module is not found, this can attempt to JIT-cythonize the pyx file.

Parameters:
  • fname (str) – The basename of the cython pyx file

  • dpath (str) – The directory containing the cython pyx file

  • error (str) – Can be “raise” or “ignore”

  • autojit (bool) – If True, we will cythonize and compile the pyx file if possible.

  • verbose (int) – verbosity level (higher is more verbose)

  • recompile (bool) – if True force recompile

Returns:

ModuleType | None – Returns the compiled and imported module if possible, otherwise None

Return type:

module