rewrite CLI commands to use treq or twisted.web, not httplib #2825

Open
opened 2016-09-08 19:06:34 +00:00 by warner · 0 comments
warner commented 2016-09-08 19:06:34 +00:00
Owner

For various reasons, when we first wrote the CLI side of the WAPI frontend (tools like tahoe put and tahoe ls), we decided to go low-tech, and use stdlib httplib. I think I was intending these scripts to serve as examples for folks who wanted to incorporate Tahoe client-side API usage into their own apps, so I didn't want to burden them with Twisted concepts.

But the blocking behavior of those scripts makes it a hassle to exercise them in our trial-based test framework (we have to use deferToThread() each time). And httplib is a lousy choice for an educational tool: if we rewrote them today and really wanted blocking/sync style, we'd use requests.

So I'm thinking that we should rewrite those tools with treq, the Deferred-style variant of requests (which uses twisted.web under the hood). Then we could remove the deferToThread calls from e.g. test.cli.test_cli.CLITestMixin.

For various reasons, when we first wrote the CLI side of the WAPI frontend (tools like `tahoe put` and `tahoe ls`), we decided to go low-tech, and use stdlib `httplib`. I think I was intending these scripts to serve as examples for folks who wanted to incorporate Tahoe client-side API usage into their own apps, so I didn't want to burden them with Twisted concepts. But the blocking behavior of those scripts makes it a hassle to exercise them in our trial-based test framework (we have to use `deferToThread()` each time). And `httplib` is a lousy choice for an educational tool: if we rewrote them today and really wanted blocking/sync style, we'd use `requests`. So I'm thinking that we should rewrite those tools with `treq`, the Deferred-style variant of `requests` (which uses twisted.web under the hood). Then we could remove the `deferToThread` calls from e.g. `test.cli.test_cli.CLITestMixin`.
tahoe-lafs added the
code-frontend-cli
normal
task
1.11.0
labels 2016-09-08 19:06:34 +00:00
tahoe-lafs added this to the undecided milestone 2016-09-08 19:06:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tahoe-lafs/trac-2024-07-25#2825
No description provided.