Replies: 2 comments
-
Hi , so I was trying to setup py-libp2p on my mac and faced an error with the
This command can be used
just make sure to use the correct path to the gmp file , this can be used directly if gmp was installed using homebrew |
Beta Was this translation helpful? Give feedback.
-
@arcinston : This is very nicely done. Great, thank you for sharing the docs. @Sahilgill24 : The issue shared is a known one. Please refer to: https://docs.google.com/document/d/1zctGtMQLUEr3dYT7o6UCXn940Wztec8CfjF8eMKBmas/edit?usp=sharing . We will add these details in Py-libp2p wiki. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
relating to PR #618
We are deprecating setup.py to use the updated pyproject.toml to allow for easy configuration using any python dependency management tool (pip , uv , poetry )
Guide to setting up the repo
Using
pip
pip
:Ensure you have the latest version of
pip
:Navigate to the root directory of the
py-libp2p
repository. To install the project along with its core and development dependencies, run:-e
flag installs the project in "editable" mode. The[dev]
part installs the optional dependencies needed for development, as defined inpyproject.toml
.Using
Poetry
Poetry is a comprehensive tool for Python dependency management and packaging.
Install Poetry:
Follow the official installation instructions on the Poetry website.
Ensure Poetry's
bin
directory is in your system'sPATH
.Configure Poetry (Optional but Recommended):
To have Poetry create virtual environments within your project directory:
Install Dependencies for Development:
Navigate to the root of the
py-libp2p
repository. To install all dependencies, including those for development, run:(Or
poetry install --all-extras
if you want all optional groups).Activate Poetry's Virtual Environment:
Alternatively, prefix commands with
poetry run
.Using
uv
uv
is a fast Python package installer and resolver.Install
uv
:Refer to the official
uv
installation guide at astral.sh/uv.Ensure Virtual Environment is Active:
Activate the virtual environment created in "General Prerequisites".
uv
will use it.Install Project for Development:
Navigate to the root of the
py-libp2p
repository.Development Workflow: Linting and Type Checking
Once you have installed the dependencies using your preferred method and your virtual environment is active (or you are using
poetry run
/uv run
), you can use the followingmake
commands for common development tasks:Ruff (Linting & Formatting):
To automatically fix linting and formatting issues using Ruff:
This command is defined in the
Makefile
and runspython -m ruff check --fix
.PyRight & Mypy (Static Type Checking):
To run static type checks using PyRight (and Mypy, as per the Makefile):
This command is defined in the
Makefile
and executespre-commit run mypy-local --all-files && pre-commit run pyright-pretty --all-files
. This implies thatpre-commit
hooks are also a part of the development setup, which is good practice. Users might also want to install these hooks:This command should be run once after cloning the repository to ensure checks are run automatically before commits.
Beta Was this translation helpful? Give feedback.
All reactions