Skip to content

Dependency Conflict: libp2p==0.4.0 requires trio>=0.26.0, which causes incompatibility with modern pytest-trioΒ #1071

@p4ngui

Description

@p4ngui

Summary

Hello py-libp2p team,

I've encountered a significant dependency conflict when using libp2p==0.4.0 with modern versions of
pytest-trio. The core of the issue is a three-way incompatibility between libp2p, trio, and pytest-trio.

Expected behavior

Would it be possible to release a new version of py-libp2p (e.g., 0.4.1) that updates the host.run()
method to be compatible with the modern trio and pytest-trio APIs? Specifically, making it gracefully
handle the task_status keyword argument would resolve this dependency hell and make it much easier to
integrate py-libp2p into projects with up-to-date testing frameworks.

Thank you for your time and for maintaining this great library!

Actual behavior

Problem:

  1. libp2p==0.4.0 has a dependency on trio>=0.26.0.
  2. trio>=0.26.0 has removed the trio.MultiError exception, which was a key part of its older API.
  3. Modern versions of pytest-trio (e.g., >=0.8.0) are designed to work with these newer versions of
    trio.
  4. However, the way libp2p==0.4.0's host.run() method interacts with the modern pytest-trio test runner
    leads to a TypeError: BasicHost.run() got an unexpected keyword argument 'task_status'. This happens
    because pytest-trio injects a task_status argument that the older libp2p run method doesn't accept.

What I've Tried:

  • Using older pytest-trio: I tried downgrading to pytest-trio==0.7.0 to avoid the task_status issue.
    This failed because pytest-trio==0.7.0 requires an older version of trio that still has
    trio.MultiError, which conflicts with libp2p's requirement of trio>=0.26.0.
  • Code Workarounds: I attempted various workarounds in my application code (using lambda,
    functools.partial, and explicit wrapper functions) to intercept the task_status argument, but none of
    these were successful, which suggests the incompatibility runs deeper than just argument passing.

Relevant log output

Possible Solution

update trio library

Environment

Environment:
   * python: 3.12
   * libp2p: 0.4.0
   * trio: >=0.26.0
   * pytest-trio: >=0.8.0

Would you like to work on fixing this bug ?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions