mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 22:50:54 +00:00
Add Windows setup and reorganize dependencies by OS in contributing.rst
Moved dependencies into Linux, macOS, and Windows sections per Paul's suggestion. Fixed reST formatting (blank lines, title underlines) to resolve Sphinx warnings from ReadTheDocs CI. Tested on Windows 10 (Python 3.11.0).
This commit is contained in:
committed by
Paul Robinson
parent
a1f57920a7
commit
bb9c8235a8
@ -5,27 +5,6 @@ Thank you for your interest in contributing! We welcome all contributions no mat
|
|||||||
their size. Please read along to learn how to get started. If you get stuck, feel free
|
their size. Please read along to learn how to get started. If you get stuck, feel free
|
||||||
to ask for help in `Ethereum Python Discord server <https://discord.gg/GHryRvPB84>`_.
|
to ask for help in `Ethereum Python Discord server <https://discord.gg/GHryRvPB84>`_.
|
||||||
|
|
||||||
Dependencies
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The following dependencies are needed to build py-libp2p:
|
|
||||||
|
|
||||||
* `GNU Multiprecision Arithmetic Library <https://gmplib.org/>`_
|
|
||||||
* `CMake <https://cmake.org>`
|
|
||||||
* `freedesktop.org pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config>`
|
|
||||||
|
|
||||||
On Debian Linux you can install them using the following command:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
sudo apt-get install cmake pkg-config libgmp-dev
|
|
||||||
|
|
||||||
On MacOS, you can install them using the following command:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
brew install cmake pkgconfig gmp
|
|
||||||
|
|
||||||
Setting the stage
|
Setting the stage
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -36,11 +15,32 @@ to your development machine:
|
|||||||
|
|
||||||
git clone git@github.com:your-github-username/py-libp2p.git
|
git clone git@github.com:your-github-username/py-libp2p.git
|
||||||
|
|
||||||
Next, install the development dependencies. We recommend using a virtual
|
Next, install the development dependencies and set up the project. We recommend using a
|
||||||
environment, such as `virtualenv <https://virtualenv.pypa.io/en/stable/>`_ or
|
virtual environment, such as `virtualenv <https://virtualenv.pypa.io/en/stable/>`_ or
|
||||||
Python's built-in ``venv`` module. Instructions vary by platform:
|
Python's built-in ``venv`` module. Instructions vary by platform:
|
||||||
|
|
||||||
**Linux and macOS**
|
Linux Setup
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
"""""""""""""
|
||||||
|
|
||||||
|
On Debian Linux, you need to install the following dependencies:
|
||||||
|
|
||||||
|
- `GNU Multiprecision Arithmetic Library <https://gmplib.org/>`_
|
||||||
|
- `CMake <https://cmake.org>`_
|
||||||
|
- `freedesktop.org pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config>`_
|
||||||
|
|
||||||
|
Install them with:
|
||||||
|
|
||||||
|
.. code:: sh
|
||||||
|
|
||||||
|
sudo apt-get install cmake pkg-config libgmp-dev
|
||||||
|
|
||||||
|
Setup Steps
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
Install the development dependencies using a virtual environment:
|
||||||
|
|
||||||
.. code:: sh
|
.. code:: sh
|
||||||
|
|
||||||
@ -50,12 +50,6 @@ Python's built-in ``venv`` module. Instructions vary by platform:
|
|||||||
python3 -m pip install -e ".[dev]"
|
python3 -m pip install -e ".[dev]"
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
On macOS, you must help the build command find and link against the ``gmp`` library:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
CFLAGS="`pkg-config --cflags gmp`" LDFLAGS="`pkg-config --libs gmp`" python3 -m pip install -e ".[dev]"
|
|
||||||
|
|
||||||
An alternative using ``virtualenv``:
|
An alternative using ``virtualenv``:
|
||||||
|
|
||||||
.. code:: sh
|
.. code:: sh
|
||||||
@ -66,83 +60,139 @@ An alternative using ``virtualenv``:
|
|||||||
python -m pip install -e ".[dev]"
|
python -m pip install -e ".[dev]"
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
**Windows Development Setup**
|
macOS Setup
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
To set up ``py-libp2p`` on Windows, follow these steps:
|
Prerequisites
|
||||||
|
"""""""""""""
|
||||||
|
|
||||||
*Prerequisites*
|
On macOS, you need to install the following dependencies:
|
||||||
|
|
||||||
|
- `GNU Multiprecision Arithmetic Library <https://gmplib.org/>`_
|
||||||
|
- `CMake <https://cmake.org>`_
|
||||||
|
- `freedesktop.org pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config>`_
|
||||||
|
|
||||||
|
Install them with:
|
||||||
|
|
||||||
|
.. code:: sh
|
||||||
|
|
||||||
|
brew install cmake pkgconfig gmp
|
||||||
|
|
||||||
|
Setup Steps
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
Install the development dependencies using a virtual environment:
|
||||||
|
|
||||||
|
.. code:: sh
|
||||||
|
|
||||||
|
cd py-libp2p
|
||||||
|
python3 -m venv ./venv
|
||||||
|
. venv/bin/activate
|
||||||
|
python3 -m pip install -e ".[dev]"
|
||||||
|
pre-commit install
|
||||||
|
|
||||||
|
On macOS, help the build command find and link against the ``gmp`` library:
|
||||||
|
|
||||||
|
.. code:: sh
|
||||||
|
|
||||||
|
CFLAGS="`pkg-config --cflags gmp`" LDFLAGS="`pkg-config --libs gmp`" python3 -m pip install -e ".[dev]"
|
||||||
|
|
||||||
|
An alternative using ``virtualenv``:
|
||||||
|
|
||||||
|
.. code:: sh
|
||||||
|
|
||||||
|
cd py-libp2p
|
||||||
|
virtualenv -p python venv
|
||||||
|
. venv/bin/activate
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
pre-commit install
|
||||||
|
|
||||||
|
Windows Development Setup
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
"""""""""""""
|
||||||
|
|
||||||
1. **Python 3.11+**
|
1. **Python 3.11+**
|
||||||
- Download and install Python from `python.org <https://www.python.org/downloads/>`_ or the Microsoft Store.
|
- Download and install Python from `python.org <https://www.python.org/downloads/>`_ or the Microsoft Store.
|
||||||
- Verify installation:
|
- Verify installation:
|
||||||
.. code-block:: powershell
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
python --version
|
python --version
|
||||||
|
|
||||||
2. **Git**
|
2. **Git**
|
||||||
- Install Git using Windows Package Manager (``winget``):
|
- Install Git using Windows Package Manager (``winget``) or download from `git-scm.com <https://git-scm.com/download/win>`_.
|
||||||
.. code-block:: powershell
|
- Verify:
|
||||||
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
winget install --id Git.Git -e
|
winget install --id Git.Git -e
|
||||||
- Or download from `git-scm.com <https://git-scm.com/download/win>`_.
|
|
||||||
- Verify:
|
|
||||||
.. code-block:: powershell
|
|
||||||
|
|
||||||
git --version
|
git --version
|
||||||
|
|
||||||
3. **CMake**
|
3. **CMake**
|
||||||
- Install CMake with ``winget``:
|
- Install CMake with ``winget`` or download from `cmake.org <https://cmake.org/download/>`_.
|
||||||
.. code-block:: powershell
|
- Add CMake to your PATH during installation, then verify:
|
||||||
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
winget install --id Kitware.CMake -e
|
winget install --id Kitware.CMake -e
|
||||||
- Or download from `cmake.org <https://cmake.org/download/>`_.
|
|
||||||
- Add CMake to your PATH during installation, then verify:
|
|
||||||
.. code-block:: powershell
|
|
||||||
|
|
||||||
cmake --version
|
cmake --version
|
||||||
|
|
||||||
4. **Make (Optional)**
|
4. **Make**
|
||||||
- Option 1: Use Git Bash (included with Git) as a shell.
|
- Option 1: Use Git Bash (included with Git) as a shell.
|
||||||
- Option 2: Install ``make`` via Chocolatey:
|
- Option 2: Install ``make`` via Chocolatey (install Chocolatey first if needed: `choco.io <https://chocolatey.org/install>`_).
|
||||||
.. code-block:: powershell
|
- Verify installation:
|
||||||
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
choco install make
|
choco install make
|
||||||
- Install Chocolatey first if needed: `choco.io <https://chocolatey.org/install>`_.
|
|
||||||
- Verify:
|
|
||||||
.. code-block:: powershell
|
|
||||||
|
|
||||||
make --version
|
make --version
|
||||||
|
|
||||||
*Setup Steps*
|
|
||||||
|
Setup Steps
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
1. **Clone the Repository**
|
1. **Clone the Repository**
|
||||||
- Open PowerShell or Git Bash and run:
|
- Open PowerShell or Git Bash and run:
|
||||||
.. code-block:: powershell
|
|
||||||
|
|
||||||
git clone https://github.com/libp2p/py-libp2p.git
|
.. code:: powershell
|
||||||
|
|
||||||
|
git clone git@github.com:your-github-username/py-libp2p.git
|
||||||
cd py-libp2p
|
cd py-libp2p
|
||||||
|
|
||||||
2. **Create a Virtual Environment**
|
2. **Create a Virtual Environment**
|
||||||
- In PowerShell:
|
- In PowerShell:
|
||||||
.. code-block:: powershell
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
.\venv\Scripts\activate
|
.\venv\Scripts\activate
|
||||||
|
|
||||||
3. **Install Dependencies**
|
3. **Install Dependencies**
|
||||||
- Install the project and dev dependencies:
|
- Install the project and dev dependencies:
|
||||||
.. code-block:: powershell
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
pip install -e ".[dev]"
|
pip install -e ".[dev]"
|
||||||
|
|
||||||
4. **Verify Setup**
|
4. **Verify Setup**
|
||||||
- Run the tests to ensure everything works:
|
- Run the tests to ensure everything works:
|
||||||
.. code-block:: powershell
|
|
||||||
|
.. code:: powershell
|
||||||
|
|
||||||
pytest -v
|
pytest -v
|
||||||
|
|
||||||
*Notes*
|
- If using ``make test`` with Git Bash:
|
||||||
- Use PowerShell, Command Prompt, or Git Bash as your shell. Git Bash is recommended if ``make`` is required.
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
make test
|
||||||
|
|
||||||
|
Notes
|
||||||
|
"""""
|
||||||
|
|
||||||
|
- Use PowerShell, Command Prompt, or Git Bash as your shell.
|
||||||
- Ensure all tools (Python, Git, CMake) are in your system PATH.
|
- Ensure all tools (Python, Git, CMake) are in your system PATH.
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
@ -165,6 +215,7 @@ We can run all tests with:
|
|||||||
At this time, the interop tests are not passing. You can run just the internal tests
|
At this time, the interop tests are not passing. You can run just the internal tests
|
||||||
with ``pytest tests/core``.
|
with ``pytest tests/core``.
|
||||||
|
|
||||||
|
|
||||||
Code Style
|
Code Style
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
1
newsfragments/559.feature.rst
Normal file
1
newsfragments/559.feature.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Added Windows-specific development setup instructions to `docs/contributing.rst`.
|
||||||
Reference in New Issue
Block a user