Skip to content

Support Numba JIT #730

@donkirkby

Description

@donkirkby

What I did

Tried running JIT code in live coding mode. Here's an example from the Numba introduction.

from numba import jit
import numpy as np

x = np.arange(100).reshape(10, 10)

@jit(nopython=True) # Set "nopython" mode for best performance, equivalent to @njit
def go_fast(a): # Function is compiled to machine code when called the first time
    trace = 0.0
    for i in range(a.shape[0]):   # Numba likes loops
        trace += np.tanh(a[i, i]) # Numba likes NumPy functions
    return a + trace              # Numba likes NumPy broadcasting

print(go_fast(x))

What happened

It just displayed an error about being unable to reraise an error.

numba.core.errors.UnsupportedBytecodeError: The re-raising of an exception is not yet supported.. Raised from /home/don/.config/JetBrains/PyCharm2025.2/scratches/scratch.py (11)

Workaround

Just comment out the @jit line, and you can run it in live coding mode.

What could happen

We could monkeypatch the @jit decorator, so it does nothing in live coding mode.

My environment

Describe the versions of everything you were using:

  • PyCharm 2025.2.1.1
  • Live Coding plugin 4.12.0
  • Ubuntu 22.04.5 LTS; glibc: 2.35
  • Python 3.10.12

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions