scripts.eww¶
The Eww client is the recommended frontend for connecting to a listening Eww instance.
Before criticizing this implementation, it’s important to understand why this was done.
I consider readline support a hard requirement.
readline is currently only supported by raw_input(). readline does expose a few calls into the underlying library, but not nearly what we need to implement it ourselves without using raw_input().
There are a few solutions to this problem:
- Implement readline-like support ourselves in Python
- Call the underlying C library ourselves
- Implement proper PTY support on both ends of the connection
- Use raw_input()
Option 1 is a lot more work than it seems like. It would certainly be valuable, and an interesting library to create. The scope of work required to do it properly just for this is difficult to justify.
Option 2 would require a compilation step and complicate installation.
Option 3 would be ideal. However, implementing a cross-platform PTY over a socket in Python is difficult, error-prone, and tough to debug. It’s absolutely on the table and would let us add a ton of features, but it’s not happening right off the bat.
Which leaves us with option 4, and results in our current (difficult to test) implementation.
With that in mind, read on.
- exception scripts.eww.ConnectionClosed[source]¶
Bases: exceptions.Exception
Raised when a connection is closed.
- __weakref__¶
list of weak references to the object (if defined)
- class scripts.eww.EwwClient(host, port)[source]¶
Bases: object
Manages all client communication.
- __weakref__¶
list of weak references to the object (if defined)