libp2p / libp2p/py-libp2p

Restructuring py-libp2p to be more modular and developer-friendly

Open
#395 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
624
Forks
256
Avg merge
1d 34m
Merged PRs (30d)
47

Description

I'm proposing a plan of refactoring large parts of the current py-libp2p library to be more modular and developer-friendly through 3 ways:

  1. Restructure the network/application side to revolve around 3 basic concepts: Transport, Connection, and Protocol.
  2. Split functionality into "interfaces" (abstract classes with abstract methods), so cross-library compatibility can work without the two libraries knowing about eachother. (For example, a Protocol could verify that it's working on a secure connection (where one of the parent protocols is providing connections through SecIO, or similar) by simply testing if one of it's parents is a ISecureConnection, which denotes methods to grab the node's verified identity).
  3. Split interface from implementation, so that every part of the library that's an implementation (TCP protocol, Multiplexer protocol, SecIO protocol, etc.) implements their interface in a one-way awareness solution (implementation is aware of interface, interface is not aware of implementation)

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

No files, tests, or entry points are named. Start by mapping the current network and application structure, then review how Transport, Connection, and Protocol concepts could be separated into interfaces and implementations. Done means the proposed modular architecture is defined and its compatibility boundaries are agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, distributed-systems, networking
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.