Great idea!
After a quick search, there's some plugins[0][1] that could work for my use case!
[0] https://github.com/twibiral/obsidian-execute-code [1] https://github.com/tillahoffmann/obsidian-jupyter
[0] https://github.com/twibiral/obsidian-execute-code [1] https://github.com/tillahoffmann/obsidian-jupyter