donkirkby / donkirkby/live-py-plugin
Support Numba JIT
- Dominant language
- Python
- Stars
- 302
- Forks
- 63
- Avg merge
- 6h 50m
- Merged PRs (30d)
- 2
Description
## 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))
[Numba introduction]: https://numba.pydata.org/numba-doc/dev/user/5minguide.html#will-numba-work-for-my-code
## 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
Contributor guide
Research direction
Start by reproducing the linked Numba example in live coding mode using the reported PyCharm, plugin, Ubuntu, and Python versions. Then trace how live coding handles decorators and define the expected behavior for @jit; done means the example runs without requiring the decorator to be commented out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100