Skip to content

Commit 174dc7f

Browse files
authored
Merge branch 'main' into trd-enhancements
2 parents 432ce57 + 70df135 commit 174dc7f

31 files changed

+51
-17
lines changed

.github/workflows/tox.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
python: ["3.10", "3.11", "3.12", "3.13"]
21-
toxenv: [core, interop, lint, wheel, demos]
21+
toxenv: [core, demos, interop, lint, utils, wheel]
2222
include:
2323
- python: "3.10"
2424
toxenv: docs
@@ -38,6 +38,11 @@ jobs:
3838
with:
3939
python-version: ${{ matrix.python }}
4040

41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v4
43+
with:
44+
version: "latest"
45+
4146
- name: Install Nim for interop testing
4247
if: matrix.toxenv == 'interop'
4348
run: |
@@ -65,11 +70,14 @@ jobs:
6570
./scripts/setup_nim_echo.sh
6671
6772
- run: |
68-
python -m pip install --upgrade pip
69-
python -m pip install tox
73+
uv venv venv
74+
source venv/bin/activate
75+
uv pip install --upgrade pip
76+
uv pip install tox
7077
7178
- name: Run Tests or Generate Docs
7279
run: |
80+
source venv/bin/activate
7381
if [[ "${{ matrix.toxenv }}" == 'docs' ]]; then
7482
export TOXENV=docs
7583
else
@@ -87,21 +95,28 @@ jobs:
8795
strategy:
8896
matrix:
8997
python-version: ["3.11", "3.12", "3.13"]
90-
toxenv: [core, wheel]
98+
toxenv: [core, demos, utils, wheel]
9199
fail-fast: false
92100
steps:
93101
- uses: actions/checkout@v4
94102
- name: Set up Python ${{ matrix.python-version }}
95103
uses: actions/setup-python@v5
96104
with:
97105
python-version: ${{ matrix.python-version }}
106+
- name: Install uv
107+
uses: astral-sh/setup-uv@v4
108+
with:
109+
version: "latest"
98110
- name: Install dependencies
99111
run: |
100-
python -m pip install --upgrade pip
101-
python -m pip install tox
112+
uv venv venv
113+
source venv/Scripts/activate
114+
uv pip install --upgrade pip
115+
uv pip install tox
102116
- name: Test with tox
103117
shell: bash
104118
run: |
119+
source venv/Scripts/activate
105120
if [[ "${{ matrix.toxenv }}" == "wheel" ]]; then
106121
python -m tox run -e windows-wheel
107122
else

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ _(non-normative, useful for team notes, not a reference)_
138138

139139
**Communication over one connection with multiple protocols**: X and Y can communicate over the same connection using different protocols and the multiplexer will appropriately route messages for a given protocol to a particular handler function for that protocol, which allows for each host to handle different protocols with separate functions. Furthermore, we can use multiple streams for a given protocol that allow for the same protocol and same underlying connection to be used for communication about separate topics between nodes X and Y.
140140

141-
**Why use multiple streams?**: The purpose of using the same connection for multiple streams to communicate over is to avoid the overhead of having multiple connections between X and Y. In order for X and Y to differentiate between messages on different streams and different protocols, a multiplexer is used to encode the messages when a message will be sent and decode a message when a message is received. The multiplexer encodes the message by adding a header to the beginning of any message to be sent that contains the stream id (along with some other info). Then, the message is sent across the raw connection and the receiving host will use its multiplexer to decode the message, i.e. determine which stream id the message should be routed to.
141+
**Why use multiple streams?**: The purpose of using the same connection for multiple streams to communicate over is to avoid the overhead of having multiple connections between X and Y. In order for X and Y to differentiate between messages on different streams and different protocols, a multiplexer is used to encode the messages when a message will be sent and decode a message when a message is received. The multiplexer encodes the message by adding a header to the beginning of any message to be sent that contains the stream id (along with some other info). Then, the message is sent across the raw connection and the receiving host will use its multiplexer to decode the message, i.e. determine which stream id the message should be routed to.

libp2p/discovery/upnp/upnp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ipaddress
22
import logging
33

4-
import miniupnpc
4+
import miniupnpc # type: ignore[import-untyped]
55
import trio
66

77
logger = logging.getLogger("libp2p.discovery.upnp")

newsfragments/1009.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix type checker error with miniupnpc import by adding type ignore comment.

newsfragments/997.performance.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Migrated CI/CD pipeline from pip to uv for improved build performance and faster dependency resolution.
2+
3+
**Performance Improvements:**
4+
- Windows wheel tests: 60%+ faster package building
5+
- Linux lint tests: 14% average improvement
6+
- Linux interop tests: 6% average improvement
7+
- Overall CI/CD pipeline: significantly faster execution
8+
9+
**Technical Changes:**
10+
- Updated GitHub Actions workflows to use uv instead of pip
11+
- Modified tox.ini to use uv for package installation
12+
- Updated scripts to use uv commands
13+
- Maintained full compatibility with existing test environments

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ version = "0.3.0"
88
description = "libp2p: The Python implementation of the libp2p networking stack"
99
readme = "README.md"
1010
requires-python = ">=3.10, <4.0"
11-
license = { text = "MIT AND Apache-2.0" }
11+
license = "MIT AND Apache-2.0"
1212
keywords = ["libp2p", "p2p"]
1313
maintainers = [
1414
{ name = "pacrob", email = "pacrob-py-libp2p@proton.me" },
1515
{ name = "Manu Sheel Gupta", email = "manu@seeta.in" },
1616
{ name = "Dave Grantham", email = "dwg@linuxprogrammer.org" },
17+
{ name = "Luca (acul71)" },
1718
]
1819
dependencies = [
1920
"aioquic>=1.2.0",

scripts/release/test_package.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def create_venv(parent_path: Path) -> Path:
1212
venv_path = parent_path / "package-smoke-test"
1313
venv.create(venv_path, with_pip=True)
1414
subprocess.run(
15-
[venv_path / "bin" / "pip", "install", "-U", "pip", "setuptools"], check=True
15+
[venv_path / "bin" / "uv", "pip", "install", "-U", "pip", "setuptools"],
16+
check=True,
1617
)
1718
return venv_path
1819

@@ -31,7 +32,7 @@ def find_wheel(project_path: Path) -> Path:
3132

3233
def install_wheel(venv_path: Path, wheel_path: Path) -> None:
3334
subprocess.run(
34-
[venv_path / "bin" / "pip", "install", f"{wheel_path}"],
35+
[venv_path / "bin" / "uv", "pip", "install", f"{wheel_path}"],
3536
check=True,
3637
)
3738

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)