basilisp
basilisp copied to clipboard
Reloading Python dependencies
Thanks for Basilisp, it's improving my ability to debug Python code.
My team does all Python work with uv, and in my own editor (through CIDER), I invoke basilisp with the following Emacs settings:
(setq cider-basilisp-command "uv"
cider-basilisp-parameters "run basilisp nrepl-server"))
With basilisp marked as a dev dependency in my pyproject.toml:
[dependency-groups]
dev = ["basilisp"]
With this, Cider "just works". However, I've noticed that even when Python dependencies are marked as editable = true, it's not possible to "live reload" them into Basilisp without completely restarting the REPL. This is true both in the commandline REPL as well as within Cider. A normal Lispy workflow is to be able to make live edits down in some dependency, tell the REPL to reload it, and then immediate execute my higher code with the changes reflected. Would this be possible with Basilisp as well?
Thank you.
@fosskers can you say more about how you reload those dependencies? Reloading modules and packages in Python is a little tricky, so I just want to understand how you're doing it.
Hi. Here "reloading" a function in Lisp/Clojure is just a matter of recompiling the function itself. With Cider it's enough to cider-eval-defun-at-point over a function definition.
Across the Python/Clojure barrier though, yeah, I suppose I was hoping it would "just work"? Then again, experimenting with raw Python, I see that if a module has already been loaded into a Python REPL, changing the underlying source won't automatically be reflected in the REPL, even if I call import on the changed module a second time.