I’m happy to announce the initial release of klipper-repl, a command line frontend for Klipper that uses the same socket API as Fluidd and Mainsail to provide an efficient G-Code REPL interface.
Thank you for your work on this! This looks really useful. It will be a while before I have a chance to test it but I can already think of several ways it would help me.
Thank you! Definitely let me know if you run into any install problems when you give it a try – my Klipper host uses NixOS, so the pip instructions in the readme haven’t been tested yet.
I am using CB1. I am not able to install klipper-repl.
Method 1:|
biqu@BTT-CB1:~$ cd klipper-repl/
biqu@BTT-CB1:~/klipper-repl$ pip install klipper-repl
ERROR: Could not find a version that satisfies the requirement klipper-repl
ERROR: No matching distribution found for klipper-repl
Method2:
biqu@BTT-CB1:~/klipper-repl$ pip install .
Processing /home/biqu/klipper-repl
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Collecting prompt-toolkit<4.0.0,>=3.0.38
Using cached prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)
Collecting pygments<3.0.0,>=2.15.1
Using cached Pygments-2.15.1-py3-none-any.whl (1.1 MB)
ERROR: Package ‘klipper-repl’ requires a different Python: 3.9.2 not in ‘<4.0,>=3.10’
FYI: I am accessing CB1 using sudo minicom -D /dev/ttyUSB0 -b 115200
I’m not familiar with the CB1, but method 2 is failing because the CB1’s version of python is slightly older than what klipper-repl supports. Whichever package manager the CB1’s OS uses may have a newer version available.
First I tried this command as mentioned in Readme.
biqu@BTT-CB1:~nix run github:unjordy/klipper-replpl
error: experimental Nix feature ‘nix-command’ is disabled; use ‘–extra-experimental-features nix-command’ to override
It didnt wqork, so i tried:
biqu@BTT-CB1:~$ nix run --extra-experimental-features ‘flakes nix-command’ github:unjordy/klipper-repl – /tmp/klippy_uds
/nix/store/844w1zapdic2pfq489dp9lz60s4q51j7-bash-5.2-p15/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
biqu@BTT-CB1:~/klipper-repl/result/bin$ ./klipper-repl ~/printer_data/comms/klippy.sock
/nix/store/844w1zapdic2pfq489dp9lz60s4q51j7-bash-5.2-p15/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
10:04:06 AM ## Connected to Klipper at BTT-CB1:/home/biqu/printer_data/comms/klippy.sock
^C or ^D to quit; type M112 for emergency stop
BTT-CB1:/home/biqu/printer_data/comms/klippy.sock*
dear @unjordy, thanks a lot for klipper-repl!
I’m trying to get it to run for a project, but run into some issues:
my install runs on a rpi4, skr pico (via uart). I have installed klipper and fluidd via kiauh for setting up the printer.cfg. I now installed klipper-repl via pip in a virtual-environment.
what works:
I can send a gcode command form the command line.
when running without a gcode command “klipper-repl printer_data/comms/klippy.sock” I get the following error:
(trp) trp@trp1:~ $ klipper-repl printer_data/comms/klippy.sock
09:26:48 pm ## Connected to Klipper at trp1:printer_data/comms/klippy.sock
^C or ^D to quit; type M112 for emergency stop
Traceback (most recent call last):
File "/home/trp/trp/bin/klipper-repl", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/trp/trp/lib/python3.11/site-packages/klipper_repl/cli.py", line 105, in main
asyncio.run(run(args))
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/trp/trp/lib/python3.11/site-packages/klipper_repl/cli.py", line 75, in run
finished, unfinished = await asyncio.wait([
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/tasks.py", line 415, in wait
raise TypeError("Passing coroutines is forbidden, use tasks explicitly.")
TypeError: Passing coroutines is forbidden, use tasks explicitly.
sys:1: RuntimeWarning: coroutine 'Event.wait' was never awaited
sys:1: RuntimeWarning: coroutine 'PromptSession.prompt_async' was never awaited
(trp) trp@trp1:~ $