Dependency Conflict: libp2p==0.4.0 requires trio>=0.26.0, which causes incompatibility with modern pytest-trio
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 624
- Forks
- 256
- Avg merge
- 1d 34m
- Merged PRs (30d)
- 47
Description
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:
- libp2p==0.4.0 has a dependency on trio>=0.26.0.
- trio>=0.26.0 has removed the trio.MultiError exception, which was a key part of its older API.
- Modern versions of pytest-trio (e.g., >=0.8.0) are designed to work with these newer versions of
trio. - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the BasicHost.run() implementation and review how it is invoked under Python 3.12 with trio >=0.26.0 and pytest-trio >=0.8.0. Reproduce the unexpected task_status argument error, then verify that the host runner works with these versions without the reported compatibility failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100