Fork me on GitHub
David Vujic14:09:51

I’m experimenting with a setup in Python and what I’m trying to achieve is a Clojure-like dev experience. Evaluating code, without typing in a separate shell. Looks promising so far! Might be a blog post, but I’ll have to use it in the Real World, with Real World Code first 😄

👏 2

Nice! you can switch the REPL to example module? then call "sample" directly?

David Vujic15:09:18

I don’t think that’s possible without loading the current buffer into the shell. I guess it is because Python isn’t namespaced like Clojure.

David Vujic15:09:25

The module is loaded as example so I think one can access that one from everywhere example.message()

✔️ 2

Cool! Are you using the editor to fill the REPL buffer from the file buffer? I did some some similar work with different assumptions:

David Vujic06:09:28

Yes, I’m running elpy-shell-send commands to pass the code to the REPL buffer. I have also configured IPython to auto-reload when a module has been changed. When searching for solutions about live coding and feedback in Python, I found your repo too and will try that one out!

👀 2
David Vujic06:09:52

I’m also experimenting with this tool. I think it’s very cool with the instant feedback:

😄 2

I also fiddled with python to get some tru repl, the problem is you would have to somewhat hack the import system. Clojure code is namespaced, python has module base system?. So changes in module do not affect, importers. Nowadays, I typically have some watch agent that constantly runs my main module and i just type stuff at the bottom to eval. Its annoying, but far less annoying than hacking the imports. It is only viable with "my" stuff, as with "other" stuff I will quickly run into some internal uninitialized state.


Live-py is awesome :) I used it for a while, it's absolutely amazing to learn how a library works. I ran into limitations for larger pieces of code, though.

David Vujic06:09:50

I wrote down some thoughts, ideas and remaining questions about REPL Driven Development in Python:

💯 2

I'm wondering if some people here have used Hy for leveraging the Python ecosystem

David Vujic15:09:43

Love the header in the Hy Tutorial: Lisp-stick on a Python 😆


it's quite horrible in my experience (was years ago tho)


Checked Hy out a few months ago, and also thought they made some really odd syntax choices. Can't recall specifics, but there were multiple details where I thought opting for the Python way of doing things (rather than the Clojure way) was unnecessarily complicating.


there was libpython-clj that was promising


not sure how it is, I never tried


Yes, libpython-clj is likely the way to go for this. It is still evolving and there are Docker images combining Python, R and Julia. See here for the details:

👍 2

The latest just being minutes ago