3 ms·
I found creating a small Python webserver using Starlette plus a basic CLI using Click to be great for interacting and testing hardware. Python gives you an eas
by sheepybloke 3y ago
I found creating a small Python webserver using Starlette plus a basic CLI using Click to be great for interacting and testing hardware. Python gives you an easy way to integrate with your actual code on the hardware using whatever interface you need with its wide support of different protocols. Click gives you a way to create a robust CLI for interacting with your Python code, and Starlette gives you a way to create a really lightweight but extensible webserver for both simple and more complex GUIs. Then, you can even add pytest on top of that for integration tests. Overall, I'd highly recommend this setup for hardware prototyping.
- flyingcircus3 3y agoI've used click, and I've used argparse. In my view, a nonstandard library needs to be vastly superior to its standard equivalent to justify adding it as a dependency. Why is click so much better than argparse?
- sheepybloke 3y agoI think the biggest advantage to Click is the ability to namespace different commands to have a single entrypoint for your CLI and all your commands. For example, if you had a hardware test interface and a webserver, you could have something like following: ``` protocli hw-test i2c protocli webserver -p 8888 ``` It also does a great job generating the documentation, defining the commands is easy and robust, and it makes the CLI's more full.