Fork me on GitHub
#other-languages
<
2021-09-20
>
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
souenzzo15:09:41

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
teodorlu05:09:26

Cool! Are you using the editor to fill the REPL buffer from the file buffer? I did some some similar work with different assumptions: https://github.com/teodorlu/hotload

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
👀 2
David Vujic06:09:52

I’m also experimenting with this tool. I think it’s very cool with the instant feedback: https://github.com/donkirkby/live-py-plugin

😄 2
rmxm11:09:23

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.

teodorlu16:09:12

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.

2
David Vujic06:09:50

I wrote down some thoughts, ideas and remaining questions about REPL Driven Development in Python: https://davidvujic.blogspot.com/2021/09/can-we-have-that-in-python-too.html

💯 2
borkdude14:09:08

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 😆 https://docs.hylang.org/en/alpha/tutorial.html

mpenet14:09:34

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

walterl20:09:28

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.

mpenet14:09:15

there was libpython-clj that was promising

mpenet14:09:25

not sure how it is, I never tried

jsa-aerial17:09:31

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: https://clojurians.zulipchat.com/#narrow/stream/215609-libpython-clj-dev

👍 2
jsa-aerial17:09:41

The latest just being minutes ago