I’m doing a bot that teaches PyGame and one of the functionalities of this bot is to help users with their codes. And I need some way to compile the user’s code and return some message.
There some Jupyter API that I can use to do that, run a code from a Chat Bot?
Or somebody has other ideas that how I could do that?
It sounds like maybe what you want is to create a custom kernel, which is what interprets the code users try to execute and produces output. Either that or an IPython extension that does things like register an exception hook or prefilter for processing code users are executing.
But I’m not quite clear on what the context is, so maybe that’s not useful.
So is the idea that a learner can write some code somewhere else, then have Jupyter execute it somewhere and return the output?
For that you could use something like ThebeLab, which would give you a web form you could enter code in, execute it and then return the response.
Otherwise, you could perhaps something more interactive together, perhaps using ideas from this example of connecting to Slack from inside a notebook —
https://github.com/WillKoehrsen/Data-Analysis/blob/fbbcb8023048ee81505490dfc659655470bd855e/slack_interaction/Interacting%20with%20Slack.ipynb — perhaps combined with the kernel gateway to create your own api to some sort of slackj service?