@@ -5,42 +5,83 @@ Thank you for your interest in contributing! We welcome all contributions no mat
55their size. Please read along to learn how to get started. If you get stuck, feel free
66to ask for help in `Ethereum Python Discord server <https://discord.gg/GHryRvPB84 >`_.
77
8- Dependencies
9- ^^^^^^^^^^^^
8+ Setting the stage
9+ ~~~~~~~~~~~~~~~~~
10+
11+ To get started, fork the repository to your own GitHub account, then clone it
12+ to your development machine:
13+
14+ .. code :: sh
1015
11- The following dependencies are needed to build py-libp2p:
16+ git clone git@github.com:your-github-username/py-libp2p.git
17+
18+ Next, install the development dependencies and set up the project. We recommend using a
19+ virtual environment, such as `virtualenv <https://virtualenv.pypa.io/en/stable/ >`_ or
20+ Python's built-in ``venv `` module. Instructions vary by platform:
21+
22+ Linux Setup
23+ ^^^^^^^^^^^
1224
13- * `GNU Multiprecision Arithmetic Library <https://gmplib.org/ >`_
14- * `CMake <https://cmake.org> `
15- * `freedesktop.org pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config> `
25+ Prerequisites
26+ """""""""""""
1627
17- On Debian Linux you can install them using the following command:
28+ On Debian Linux, you need to install the following dependencies:
29+
30+ - `GNU Multiprecision Arithmetic Library <https://gmplib.org/ >`_
31+ - `CMake <https://cmake.org >`_
32+ - `freedesktop.org pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config >`_
33+
34+ Install them with:
1835
1936.. code :: sh
2037
2138 sudo apt-get install cmake pkg-config libgmp-dev
2239
23- On MacOS, you can install them using the following command:
40+ Setup Steps
41+ """""""""""
42+
43+ Install the development dependencies using a virtual environment:
2444
2545.. code :: sh
2646
27- brew install cmake pkgconfig gmp
47+ cd py-libp2p
48+ python3 -m venv ./venv
49+ . venv/bin/activate
50+ python3 -m pip install -e " .[dev]"
51+ pre-commit install
2852
29- Setting the stage
30- ~~~~~~~~~~~~~~~~~
53+ An alternative using ``virtualenv ``:
3154
32- To get started, fork the repository to your own GitHub account, then clone it
33- to your development machine:
55+ .. code :: sh
56+
57+ cd py-libp2p
58+ virtualenv -p python venv
59+ . venv/bin/activate
60+ python -m pip install -e " .[dev]"
61+ pre-commit install
62+
63+ macOS Setup
64+ ^^^^^^^^^^^
65+
66+ Prerequisites
67+ """""""""""""
68+
69+ On macOS, you need to install the following dependencies:
70+
71+ - `GNU Multiprecision Arithmetic Library <https://gmplib.org/ >`_
72+ - `CMake <https://cmake.org >`_
73+ - `freedesktop.org pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config >`_
74+
75+ Install them with:
3476
3577.. code :: sh
3678
37- git clone git@github.com:your-github-username/py-libp2p.git
79+ brew install cmake pkgconfig gmp
3880
39- Next, install the development dependencies. We recommend using a virtual
40- environment, such as `virtualenv <https://virtualenv.pypa.io/en/stable/ >`_ or
41- Python's built-in ``venv `` module. Instructions vary by platform:
81+ Setup Steps
82+ """""""""""
4283
43- ** Linux and macOS **
84+ Install the development dependencies using a virtual environment:
4485
4586.. code :: sh
4687
@@ -50,11 +91,11 @@ Python's built-in ``venv`` module. Instructions vary by platform:
5091 python3 -m pip install -e " .[dev]"
5192 pre-commit install
5293
53- On macOS, you must help the build command find and link against the ``gmp `` library:
94+ On macOS, help the build command find and link against the ``gmp `` library:
5495
5596.. code :: sh
5697
57- CFLAGS=" ` pkg-config --cflags gmp` " LDFLAGS=" ` pkg-config --libs gmp` " python3 -m pip install -e " .[dev]"
98+ CFLAGS=" ` pkg-config --cflags gmp` " LDFLAGS=" ` pkg-config --libs gmp` " python3 -m pip install -e " .[dev]"
5899
59100 An alternative using ``virtualenv ``:
60101
@@ -66,83 +107,92 @@ An alternative using ``virtualenv``:
66107 python -m pip install -e " .[dev]"
67108 pre-commit install
68109
69- **Windows Development Setup **
110+ Windows Development Setup
111+ ^^^^^^^^^^^^^^^^^^^^^^^^^
70112
71- To set up ``py-libp2p `` on Windows, follow these steps:
72-
73- *Prerequisites *
113+ Prerequisites
114+ """""""""""""
74115
751161. **Python 3.11+ **
76117 - Download and install Python from `python.org <https://www.python.org/downloads/ >`_ or the Microsoft Store.
77118 - Verify installation:
78- .. code-block :: powershell
119+
120+ .. code :: powershell
79121
80122 python -- version
81123
82124 2. **Git **
83- - Install Git using Windows Package Manager (``winget ``):
84- .. code-block :: powershell
85-
86- winget install -- id Git.Git - e
87- - Or download from `git-scm.com <https://git-scm.com/download/win >`_.
125+ - Install Git using Windows Package Manager (``winget ``) or download from `git-scm.com <https://git-scm.com/download/win >`_.
88126 - Verify:
89- .. code-block :: powershell
90127
128+ .. code :: powershell
129+
130+ winget install -- id Git.Git - e
91131 git -- version
92132
93133 3. **CMake **
94- - Install CMake with ``winget ``:
95- .. code-block :: powershell
96-
97- winget install -- id Kitware.CMake - e
98- - Or download from `cmake.org <https://cmake.org/download/ >`_.
134+ - Install CMake with ``winget `` or download from `cmake.org <https://cmake.org/download/ >`_.
99135 - Add CMake to your PATH during installation, then verify:
100- .. code-block :: powershell
101136
137+ .. code :: powershell
138+
139+ winget install -- id Kitware.CMake - e
102140 cmake -- version
103141
104- 4. **Make (Optional) **
142+ 4. **Make **
105143 - Option 1: Use Git Bash (included with Git) as a shell.
106- - Option 2: Install ``make `` via Chocolatey:
107- .. code-block :: powershell
144+ - Option 2: Install ``make `` via Chocolatey (install Chocolatey first if needed: ` choco.io < https://chocolatey.org/install >`_).
145+ - Verify installation:
108146
109- choco install make
110- - Install Chocolatey first if needed: `choco.io <https://chocolatey.org/install >`_.
111- - Verify:
112- .. code-block :: powershell
147+ .. code :: powershell
113148
149+ choco install make
114150 make -- version
115151
116- *Setup Steps *
152+
153+ Setup Steps
154+ """""""""""
117155
1181561. **Clone the Repository **
119157 - Open PowerShell or Git Bash and run:
120- .. code-block :: powershell
121158
122- git clone https:// github.com / libp2p/ py- libp2p.git
159+ .. code :: powershell
160+
161+ git clone git@github.com :your- github- username/ py- libp2p.git
123162 cd py- libp2p
124163
125164 2. **Create a Virtual Environment **
126165 - In PowerShell:
127- .. code-block :: powershell
166+
167+ .. code :: powershell
128168
129169 python - m venv venv
130170 .\venv\Scripts\activate
131171
132172 3. **Install Dependencies **
133173 - Install the project and dev dependencies:
134- .. code-block :: powershell
174+
175+ .. code :: powershell
135176
136177 pip install - e " .[dev]"
137178
138179 4. **Verify Setup **
139180 - Run the tests to ensure everything works:
140- .. code-block :: powershell
181+
182+ .. code :: powershell
141183
142184 pytest - v
143185
144- *Notes *
145- - Use PowerShell, Command Prompt, or Git Bash as your shell. Git Bash is recommended if ``make `` is required.
186+ - If using ``make test `` with Git Bash:
187+
188+ .. code :: bash
189+
190+ make test
191+
192+ Notes
193+ """""
194+
195+ - Use PowerShell, Command Prompt, or Git Bash as your shell.
146196- Ensure all tools (Python, Git, CMake) are in your system PATH.
147197
148198Requirements
@@ -165,6 +215,7 @@ We can run all tests with:
165215 At this time, the interop tests are not passing. You can run just the internal tests
166216with ``pytest tests/core ``.
167217
218+
168219Code Style
169220~~~~~~~~~~
170221
0 commit comments