python-trio / python-trio/trio

Trio sockets should have a makefile() that returns a Trio async file object

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

Nobody has claimed this yet.

Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

What is it?

The makefile() method on Python sockets converts them to file-like objects, mapping write to send, etc. Trio’s documentation says that makefile() for Trio sockets is not implemented, because

Python’s file-like API is synchronous, so it can’t be implemented on top of an async socket,

and then goes on to describe an asynchronous version of Python’s file-like API.

Where is it useful?

In an asynchronous world, (asynchronous versions of) APIs like json.dump() become much more useful and potentially uniform across file and network I/O. However, without makefile(), they would need to exist in a write version and a send version, which would be silly.

(I’m implementing such an API right now.)

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 reviewing the Trio socket documentation describing the unimplemented makefile() method and its asynchronous file-like API. Define the scope and behavior of the returned Trio async file object, including how it relates to file and network I/O; the work is done when makefile() provides that documented asynchronous interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.