Remotely running files on your pi-top with FLCLI

Hello, I thought it would be nice to be able to run local python files on a pi-top with minimal hassle. I went ahead and designed a CLI that interacts with further link so that you can do this. Since it’s a CLI it can also be easily integrated into most modern IDEs. If you are interested here is a link to the repo: https://github.com/aldenq/flcli. Any feedback would be much appreciated.

7 Likes

Very neat, well done! As a Further & further-link developer it’s really cool to see people building on what we’ve done. This provides a nice middle ground between the simplicity we are aiming for with Further and more complex remote development setups based on ssh.

Good work reverse engineering further-link also. Hopefully we can fully open source it in the near future to save you some trouble if you want to incorporate new features. For example we’ve recently added a system for uploading a directory of files so you can run multi-file projects with further-link.

I do have a couple of suggestions:
You’ll probably want to handle ‘stderr’ type messages as well as ‘stdout’ to see any errors produced by your code (eg runtime errors that you haven’t caught with py_compile :D). Further-link does also support receiving input for stdin if that’s something that would be useful for your programs.

Also, I think you can simplify by removing the use of the further-link.pi-top.com urls. Since you have disabled ssl hostname check, you can connect with eg https://192.168.0.1:8028/status.

4 Likes

Thanks for the feedback, i went ahead and implemented all of your ideas besides stdin as i’m not sure off hand what the best way to do non-blocking stdin is without doing some sort of multithreading. One question about further link: With the “start” m_type i was wondering what exactly the directoryName does as i was able to get away without specifying it but i am curious if that will cause other problems.

2 Likes

You can use directoryName to choose a working directory for your script to run in, to allow easy import of other files located there.

I suppose directoryPath could have been a better name as it accepts a file path - either absolute path anywhere on the system or path relative to /home/pi/further. If the directory doesn’t exist it will be created.

If you don’t set directoryName that’s no problem, your scripts will be run from the /tmp directory.

So for example, these two payloads for the start message are equivalent:

{sourceScript: "print('hi')", directoryName: "flcli"}
{sourceScript: "print('hi')", directoryName: "/home/pi/further/flcli"}
4 Likes

That seems quite useful, i’ll go ahead and add support in the CLI for that.

1 Like

thanks for the awesome information.