docker / docker/docker-py

create a sans-io docker client class and impliment Client with blocking requests

Open
#1,171 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

use https://github.com/mikeal/deferred to create a sans-io version of Client (SansIOClient) that requires something like:

class SimpleStream(object):
    def next(self) -> Deferred:
        ...

class IOAdapter(object):
    def request(self, **kwargs) -> Deferred:
        ...

    def stream(self, **kwargs) -> SimpleStream:
        ...

    def unwrap_deferred(self, deferred: Deferred) -> Any:
        ...

and then implement it with something like:

class BlockingSimpleStream(SimpleStream):
    def __init__(self, stream):
        self.generator = _stream_helper(stream):
    def next(self) -> Deferred:
        return deferred.succeeded(next(self.generator))

class BlockingIOAdapter(IOAdapter):
    def __init__(session: requests.Session):
        self.session = session

    def request(self, **kwargs) -> Deferred:
        return deferred.execute(self.session.request, **kwargs)

    def stream(self, **kwargs) -> BlockingSimpleStream:
        return BlockingSimpleStream(self.session.request(**kwargs, stream=True))

    def unwrap_deferred(self, d: Deferred):
        return deferred.waitForDeferred(d).getResult()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Client entry point and its requests.Session integration, then compare them with the proposed SansIOClient, SimpleStream, and IOAdapter interfaces. Done means the sans-IO client and blocking implementation exist with deferred request, streaming, and unwrapping behavior as described; no tests or filenames are mentioned in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.