reorg test structure to match tox and CI jobs, drop bumpversion for bump-my-version and move config to pyproject.toml, fix docs building

This commit is contained in:
pacrob
2024-04-08 09:06:04 -06:00
committed by Paul Robinson
parent 1206fbef3d
commit eea065fb57
62 changed files with 319 additions and 160 deletions

View File

@ -118,7 +118,10 @@ html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
html_theme_options = {
"logo_only": True,
"display_version": False,
}
# Add any paths that contain custom themes here, relative to this directory.
@ -131,7 +134,7 @@ html_theme = "sphinx_rtd_theme"
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
html_logo = "docs/_static/libp2p_logo.png"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@ -141,7 +144,7 @@ html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]
html_static_path = ["_static"]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied

View File

@ -1,51 +1,152 @@
Contributing
============
------------
Development
-----------
py-libp2p requires Python 3.8+.
~~~~~~~~~~~
To get started, fork the repository to your own github account, then clone it to your
development machine:
```sh
git clone git@github.com:<your-github-username>/py-libp2p.git
```
.. code:: sh
git clone git@github.com:your-github-username/py-libp2p.git
then install the development dependencies. We recommend using a virtual environment,
such as [`virtualenv`](https://virtualenv.pypa.io/en/stable/)
such as `virtualenv <https://virtualenv.pypa.io/en/stable/>`_.
```sh
cd py-libp2p
virtualenv -p python venv
. venv/bin/activate
python -m pip install -e ".[dev]"
pre-commit install
```
.. code:: sh
We use [pre-commit](https://pre-commit.com/) to maintain consistent code style. Once
installed, it will run automatically with every commit. You can also run it manually
with `make lint`. If you need to make a commit that skips the `pre-commit` checks, you
can do so with `git commit --no-verify`.
cd py-libp2p
virtualenv -p python venv
. venv/bin/activate
python -m pip install -e ".[dev]"
pre-commit install
Dependencies
^^^^^^^^^^^^
On Debian Linux you will need to ensure that you have the
`GNU Multiprecision Arithmetic Library <https://gmplib.org/>`_
installed since it is a dependency of the fastecdsa package. You can install it using
the following command:
.. code:: sh
sudo apt-get install libgmp-dev
Requirements
^^^^^^^^^^^^
The protobuf description in this repository was generated by ``protoc`` at version
``25.3``.
Testing
-------
~~~~~~~
You can run the tests with `make test` or `pytest tests`. This will run the unit tests
Running that tests is a great way to explore the codebase.
You can run all the tests with ``pytest tests``.
At this time, the interop tests are not passing. You can run just the internal tests
with ``pytest tests/core``.
Code Style
~~~~~~~~~~
We use `pre-commit <https://pre-commit.com/>`_ to maintain consistent code style. Once
installed, it will run automatically with every commit. You can also run it manually
with:
.. code:: sh
make lint
If you need to make a commit that skips the pre-commit checks, you can do so with
``git commit --no-verify``.
This project uses ``mypy`` for static type checking, though it is not yet complete.
All new code should be fully typed, and we are working to add types to the existing
codebase.
Releasing
~~~~~~~~~
Releases are typically done from the ``main`` branch, except when releasing a beta (in
which case the beta is released from ``main``, and the previous stable branch is
released from said branch).
Final test before each release
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Before releasing a new version, build and test the package that will be released:
.. code:: sh
git checkout main && git pull
make package-test
History
-------
This will build the package and install it in a temporary virtual environment. Follow
the instructions to activate the venv and test whatever you think is important.
Prior to 2023, this project is graciously sponsored by the Ethereum Foundation through
[Wave 5 of their Grants Program](https://blog.ethereum.org/2019/02/21/ethereum-foundation-grants-program-wave-5/).
You can also preview the release notes:
The creators and original maintainers of this project are:
* [@zixuanzh](https://github.com/zixuanzh)
* [@alexh](https://github.com/alexh)
* [@stuckinaboot](https://github.com/stuckinaboot)
* [@robzajac](https://github.com/robzajac)
* [@carver](https://github.com/carver)
.. code:: sh
towncrier --draft
Build the release notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Before bumping the version number, build the release notes. You must include the part of
the version to bump (see below), which changes how the version number will show in the
release notes.
.. code:: sh
make notes bump=$$VERSION_PART_TO_BUMP$$
If there are any errors, be sure to re-run make notes until it works.
Push the release to github & pypi
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
After confirming that the release package looks okay, release a new version:
.. code:: sh
make release bump=$$VERSION_PART_TO_BUMP$$
This command will:
- Bump the version number as specified in ``.pyproject.toml`` and ``setup.py``.
- Create a git commit and tag for the new version.
- Build the package.
- Push the commit and tag to github.
- Push the new package files to pypi.
Which version part to bump
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``$$VERSION_PART_TO_BUMP$$`` must be one of: ``major``, ``minor``, ``patch``, ``stage``,
or ``devnum``.
The version format for this repo is ``{major}.{minor}.{patch}`` for stable, and
``{major}.{minor}.{patch}-{stage}.{devnum}`` for unstable (``stage`` can be alpha or
beta).
If you are in a beta version, ``make release bump=stage`` will switch to a stable.
To issue an unstable version when the current version is stable, specify the new version
explicitly, like ``make release bump="--new-version 4.0.0-alpha.1"``
You can see what the result of bumping any particular version part would be with
``bump-my-version show-bump``

13
docs/history.rst Normal file
View File

@ -0,0 +1,13 @@
History
-------
Prior to 2023, this project was graciously sponsored by the Ethereum Foundation through
`Wave 5 of their Grants Program <https://blog.ethereum.org/2019/02/21/ethereum-foundation-grants-program-wave-5/>`_.
The creators and original maintainers of this project are:
- `@zixuanzh <https://github.com/zixuanzh>`_
- `@alexh <https://github.com/alexh>`_
- `@stuckinaboot <https://github.com/stuckinaboot>`_
- `@robzajac <https://github.com/robzajac>`_
- `@carver <https://github.com/carver>`_

View File

@ -27,4 +27,5 @@ Contents
:caption: Community
contributing
history
code_of_conduct