mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
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:
@ -1,22 +0,0 @@
|
||||
[bumpversion]
|
||||
current_version = 0.1.5
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<stage>[^.]*)\.(?P<devnum>\d+))?
|
||||
serialize =
|
||||
{major}.{minor}.{patch}-{stage}.{devnum}
|
||||
{major}.{minor}.{patch}
|
||||
|
||||
[bumpversion:part:stage]
|
||||
optional_value = stable
|
||||
first_value = stable
|
||||
values =
|
||||
alpha
|
||||
beta
|
||||
stable
|
||||
|
||||
[bumpversion:part:devnum]
|
||||
|
||||
[bumpversion:file:setup.py]
|
||||
search = version="{current_version}",
|
||||
replace = version="{new_version}",
|
||||
@ -86,14 +86,32 @@ windows-wheel-steps:
|
||||
key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
|
||||
|
||||
docs: &docs
|
||||
docker:
|
||||
- image: common
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
|
||||
- run:
|
||||
name: install dependencies
|
||||
command: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install tox
|
||||
- run:
|
||||
name: install latexpdf dependencies
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install latexmk tex-gyre texlive-fonts-extra
|
||||
- run:
|
||||
name: run tox
|
||||
command: python -m tox run -r
|
||||
- save_cache:
|
||||
paths:
|
||||
- .tox
|
||||
- ~/.cache/pip
|
||||
- ~/.local
|
||||
key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
|
||||
resource_class: xlarge
|
||||
|
||||
interop: &interop
|
||||
docker:
|
||||
@ -103,7 +121,6 @@ interop: &interop
|
||||
name: install interop test dependencies
|
||||
command: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install latexmk tex-gyre texlive-fonts-extra
|
||||
wget https://dl.google.com/go/$GOBINPKG
|
||||
sudo tar -C /usr/local -xzf $GOBINPKG
|
||||
export GOPATH=$HOME/go
|
||||
@ -115,7 +132,7 @@ jobs:
|
||||
docs:
|
||||
<<: *docs
|
||||
docker:
|
||||
- image: cimg/python:3.8
|
||||
- image: cimg/python:3.9
|
||||
environment:
|
||||
TOXENV: docs
|
||||
|
||||
|
||||
@ -50,3 +50,11 @@ repos:
|
||||
# additional_dependencies:
|
||||
# - mypy-protobuf
|
||||
# exclude: 'tests/|tests_interop/|crypto/|identity/|pubsub/|insecure/|noise/|security/'
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: check-rst-files
|
||||
name: Check for .rst files in the top-level directory
|
||||
entry: sh -c 'ls *.rst 1>/dev/null 2>&1 && { echo "found .rst file in top-level folder"; exit 1; } || exit 0'
|
||||
language: system
|
||||
always_run: true
|
||||
pass_filenames: false
|
||||
|
||||
@ -3,7 +3,7 @@ version: 2
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.8"
|
||||
python: "3.9"
|
||||
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
@ -15,6 +15,7 @@ python:
|
||||
path: .
|
||||
extra_requirements:
|
||||
- docs
|
||||
- test
|
||||
|
||||
# Build all formats for RTD Downloads - htmlzip, pdf, epub
|
||||
formats: all
|
||||
|
||||
@ -2,6 +2,7 @@ include LICENSE-APACHE
|
||||
include LICENSE-MIT
|
||||
include README.md
|
||||
|
||||
recursive-include scripts *
|
||||
recursive-include tests *
|
||||
|
||||
global-include *.pyi
|
||||
|
||||
127
Makefile
127
Makefile
@ -5,6 +5,7 @@ CURRENT_SIGN_SETTING := $(shell git config commit.gpgSign)
|
||||
help:
|
||||
@echo "clean-build - remove build artifacts"
|
||||
@echo "clean-pyc - remove Python file artifacts"
|
||||
@echo "clean - run clean-build and clean-pyc"
|
||||
@echo "lint - fix linting issues with pre-commit"
|
||||
@echo "test - run tests quickly with the default Python"
|
||||
@echo "docs - generate docs and open in browser (linux-docs for version on linux)"
|
||||
@ -12,29 +13,6 @@ help:
|
||||
@echo "release - package and upload a release (does not run notes target)"
|
||||
@echo "dist - package"
|
||||
|
||||
FILES_TO_LINT = libp2p tests tests_interop examples setup.py
|
||||
PB = libp2p/crypto/pb/crypto.proto \
|
||||
libp2p/pubsub/pb/rpc.proto \
|
||||
libp2p/security/insecure/pb/plaintext.proto \
|
||||
libp2p/security/secio/pb/spipe.proto \
|
||||
libp2p/security/noise/pb/noise.proto \
|
||||
libp2p/identity/identify/pb/identify.proto
|
||||
PY = $(PB:.proto=_pb2.py)
|
||||
PYI = $(PB:.proto=_pb2.pyi)
|
||||
|
||||
# Set default to `protobufs`, otherwise `format` is called when typing only `make`
|
||||
all: protobufs
|
||||
|
||||
protobufs: $(PY)
|
||||
|
||||
%_pb2.py: %.proto
|
||||
protoc --python_out=. --mypy_out=. $<
|
||||
|
||||
clean-proto:
|
||||
rm -f $(PY) $(PYI)
|
||||
|
||||
clean: clean-build clean-pyc
|
||||
|
||||
clean-build:
|
||||
rm -fr build/
|
||||
rm -fr dist/
|
||||
@ -45,6 +23,8 @@ clean-pyc:
|
||||
find . -name '*~' -exec rm -f {} +
|
||||
find . -name '__pycache__' -exec rm -rf {} +
|
||||
|
||||
clean: clean-build clean-pyc
|
||||
|
||||
lint:
|
||||
@pre-commit run --all-files --show-diff-on-failure || ( \
|
||||
echo "\n\n\n * pre-commit should have fixed the errors above. Running again to make sure everything is good..." \
|
||||
@ -54,23 +34,29 @@ lint:
|
||||
test:
|
||||
pytest tests
|
||||
|
||||
build-docs:
|
||||
sphinx-apidoc -o docs/ . setup.py "*conftest*" "libp2p/tools/interop*"
|
||||
$(MAKE) -C docs clean
|
||||
$(MAKE) -C docs html
|
||||
$(MAKE) -C docs doctest
|
||||
# protobufs management
|
||||
|
||||
build-docs-ci:
|
||||
$(MAKE) -C docs latexpdf
|
||||
$(MAKE) -C docs epub
|
||||
PB = libp2p/crypto/pb/crypto.proto \
|
||||
libp2p/pubsub/pb/rpc.proto \
|
||||
libp2p/security/insecure/pb/plaintext.proto \
|
||||
libp2p/security/secio/pb/spipe.proto \
|
||||
libp2p/security/noise/pb/noise.proto \
|
||||
libp2p/identity/identify/pb/identify.proto
|
||||
PY = $(PB:.proto=_pb2.py)
|
||||
PYI = $(PB:.proto=_pb2.pyi)
|
||||
|
||||
validate-newsfragments:
|
||||
python ./newsfragments/validate_files.py
|
||||
towncrier build --draft --version preview
|
||||
## Set default to `protobufs`, otherwise `format` is called when typing only `make`
|
||||
all: protobufs
|
||||
|
||||
check-docs: build-docs validate-newsfragments
|
||||
protobufs: $(PY)
|
||||
|
||||
check-docs-ci: build-docs build-docs-ci validate-newsfragments
|
||||
%_pb2.py: %.proto
|
||||
protoc --python_out=. --mypy_out=. $<
|
||||
|
||||
clean-proto:
|
||||
rm -f $(PY) $(PYI)
|
||||
|
||||
# docs commands
|
||||
|
||||
docs: check-docs
|
||||
open docs/_build/html/index.html
|
||||
@ -78,19 +64,37 @@ docs: check-docs
|
||||
linux-docs: check-docs
|
||||
xdg-open docs/_build/html/index.html
|
||||
|
||||
package: clean
|
||||
python setup.py sdist bdist_wheel
|
||||
# docs helpers
|
||||
|
||||
validate-newsfragments:
|
||||
python ./newsfragments/validate_files.py
|
||||
towncrier build --draft --version preview
|
||||
|
||||
check-docs: build-docs validate-newsfragments
|
||||
|
||||
build-docs:
|
||||
sphinx-apidoc -o docs/ . setup.py "*conftest*" "libp2p/tools/interop*"
|
||||
$(MAKE) -C docs clean
|
||||
$(MAKE) -C docs html
|
||||
$(MAKE) -C docs doctest
|
||||
|
||||
# docs helpers for CI, which requires extra dependencies
|
||||
|
||||
check-docs-ci: build-docs build-docs-ci validate-newsfragments
|
||||
|
||||
build-docs-ci:
|
||||
$(MAKE) -C docs latexpdf
|
||||
$(MAKE) -C docs epub
|
||||
|
||||
# release commands
|
||||
|
||||
package-test: clean
|
||||
python -m build
|
||||
python scripts/release/test_package.py
|
||||
|
||||
notes:
|
||||
check-bump:
|
||||
ifndef bump
|
||||
$(error bump must be set, typically: major, minor, patch, or devnum)
|
||||
endif
|
||||
|
||||
notes: check-bump
|
||||
notes: check-bump validate-newsfragments
|
||||
# Let UPCOMING_VERSION be the version that is used for the current bump
|
||||
$(eval UPCOMING_VERSION=$(shell bumpversion $(bump) --dry-run --list | grep new_version= | sed 's/new_version=//g'))
|
||||
$(eval UPCOMING_VERSION=$(shell bump-my-version show --increment $(bump) new_version))
|
||||
# Now generate the release notes to have them included in the release commit
|
||||
towncrier build --yes --version $(UPCOMING_VERSION)
|
||||
# Before we bump the version, make sure that the towncrier-generated docs will build
|
||||
@ -98,20 +102,31 @@ notes: check-bump
|
||||
git commit -m "Compile release notes for v$(UPCOMING_VERSION)"
|
||||
|
||||
release: check-bump clean
|
||||
# require that upstream is configured for ethereum/py-libp2p
|
||||
@git remote -v | grep -E "upstream\tgit@github.com:ethereum/py-libp2p.git \(push\)|upstream\thttps://(www.)?github.com/ethereum/py-libp2p \(push\)"
|
||||
# verify that docs build correctly
|
||||
# verify that notes command ran correctly
|
||||
./newsfragments/validate_files.py is-empty
|
||||
make build-docs
|
||||
CURRENT_SIGN_SETTING=$(git config commit.gpgSign)
|
||||
git config commit.gpgSign true
|
||||
bumpversion $(bump)
|
||||
git push upstream && git push upstream --tags
|
||||
bump-my-version bump $(bump)
|
||||
python -m build
|
||||
twine upload dist/*
|
||||
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"
|
||||
git push upstream && git push upstream --tags
|
||||
twine upload dist/*
|
||||
|
||||
# release helpers
|
||||
|
||||
dist: clean
|
||||
python -m build
|
||||
ls -l dist
|
||||
check-bump:
|
||||
ifndef bump
|
||||
$(error bump must be one of: major, minor, patch, stage, or devnum)
|
||||
endif
|
||||
|
||||
check-git:
|
||||
# require that you be on a branch that's linked to upstream/main
|
||||
@if ! git status -s -b | head -1 | grep -q "\.\.upstream/main"; then \
|
||||
echo "Error: You must be on a branch that's linked to upstream/main"; \
|
||||
exit 1; \
|
||||
fi
|
||||
# require that upstream is configured for ethereum/py-libp2p
|
||||
@if ! git remote -v | grep "upstream[[:space:]]git@github.com:ethereum/py-libp2p.git (push)\|upstream[[:space:]]https://github.com/ethereum/py-libp2p (push)"; then \
|
||||
echo "Error: You must have a remote named 'upstream' that points to 'py-libp2p'"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
23
README.md
23
README.md
@ -26,28 +26,7 @@ Read more in the [documentation on ReadTheDocs](https://py-libp2p.readthedocs.io
|
||||
|
||||
Currently maintained by [@pacrob](https://github.com/pacrob) and [@dhuseby](https://github.com/dhuseby), looking for assistance!
|
||||
|
||||
Note that tests/test_libp2p/test_libp2p.py contains an end-to-end messaging test between two libp2p hosts, which is the bulk of our proof of concept.
|
||||
|
||||
### 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:
|
||||
|
||||
```sh
|
||||
sudo apt-get install libgmp-dev
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
Running `pytest` doesn't work with this project. The correct way to execute tests is to run `make test`.
|
||||
|
||||
### Release setup
|
||||
|
||||
Releases follow the same basic pattern as releases of some tangentially-related projects,
|
||||
like Trinity. See [Trinity's release instructions](https://trinity-client.readthedocs.io/en/latest/contributing.html#releasing).
|
||||
|
||||
## Requirements
|
||||
|
||||
The protobuf description in this repository was generated by `protoc` at version `25.3`.
|
||||
Note that tests/core/test_libp2p/test_libp2p.py contains an end-to-end messaging test between two libp2p hosts, which is the bulk of our proof of concept.
|
||||
|
||||
## Feature Breakdown
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
13
docs/history.rst
Normal 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>`_
|
||||
@ -27,4 +27,5 @@ Contents
|
||||
:caption: Community
|
||||
|
||||
contributing
|
||||
history
|
||||
code_of_conduct
|
||||
|
||||
1
newsfragments/454.docs.rst
Normal file
1
newsfragments/454.docs.rst
Normal file
@ -0,0 +1 @@
|
||||
Move contributing and history info from README to docs
|
||||
1
newsfragments/454.internal.rst
Normal file
1
newsfragments/454.internal.rst
Normal file
@ -0,0 +1 @@
|
||||
Fix docs CI, drop ``bumpversion`` for ``bump-my-version``, reorg tests
|
||||
@ -1,36 +1,35 @@
|
||||
[tool.autoflake]
|
||||
remove_all_unused_imports = true
|
||||
exclude = "__init__.py"
|
||||
remove_all_unused_imports = true
|
||||
|
||||
[tool.isort]
|
||||
combine_as_imports = false
|
||||
extra_standard_library = "pytest"
|
||||
force_grid_wrap = 1
|
||||
force_sort_within_sections = true
|
||||
known_third_party = "anyio,factory,lru,p2pclient,pytest,noise"
|
||||
known_first_party = "libp2p"
|
||||
known_third_party = "anyio,factory,lru,p2pclient,pytest,noise"
|
||||
multi_line_output = 3
|
||||
profile = "black"
|
||||
skip_glob= "*_pb2*.py, *.pyi"
|
||||
|
||||
[tool.mypy]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_untyped_defs = true
|
||||
disallow_any_generics = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = false
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_subclassing_any = false
|
||||
disallow_untyped_defs = true
|
||||
ignore_missing_imports = true
|
||||
incremental = false
|
||||
strict_optional = false
|
||||
strict_equality = true
|
||||
strict_optional = false
|
||||
warn_redundant_casts = true
|
||||
warn_return_any = false
|
||||
warn_unused_configs = true
|
||||
warn_unused_ignores = true
|
||||
|
||||
|
||||
[tool.pydocstyle]
|
||||
# All error codes found here:
|
||||
# http://www.pydocstyle.org/en/3.0.0/error_codes.html
|
||||
@ -65,22 +64,19 @@ add-ignore = "D200,D203,D204,D205,D212,D302,D400,D401,D412,D415"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "-v --showlocals --durations 50 --maxfail 10"
|
||||
xfail_strict = true
|
||||
log_format = "%(levelname)8s %(asctime)s %(filename)20s %(message)s"
|
||||
log_date_format = "%m-%d %H:%M:%S"
|
||||
|
||||
markers = [
|
||||
"slow: mark test as slow",
|
||||
]
|
||||
log_format = "%(levelname)8s %(asctime)s %(filename)20s %(message)s"
|
||||
markers = ["slow: mark test as slow"]
|
||||
xfail_strict = true
|
||||
|
||||
[tool.towncrier]
|
||||
# Read https://github.com/ethereum/py-libp2p/blob/main/newsfragments/README.md for instructions
|
||||
package = "libp2p"
|
||||
filename = "docs/release_notes.rst"
|
||||
directory = "newsfragments"
|
||||
underlines = ["-", "~", "^"]
|
||||
title_format = "py-libp2p v{version} ({project_date})"
|
||||
filename = "docs/release_notes.rst"
|
||||
issue_format = "`#{issue} <https://github.com/ethereum/py-libp2p/issues/{issue}>`__"
|
||||
package = "libp2p"
|
||||
title_format = "py-libp2p v{version} ({project_date})"
|
||||
underlines = ["-", "~", "^"]
|
||||
|
||||
[[tool.towncrier.type]]
|
||||
directory = "breaking"
|
||||
@ -126,3 +122,46 @@ showcontent = true
|
||||
directory = "removal"
|
||||
name = "Removals"
|
||||
showcontent = true
|
||||
|
||||
[tool.bumpversion]
|
||||
current_version = "0.1.5"
|
||||
parse = """
|
||||
(?P<major>\\d+)
|
||||
\\.(?P<minor>\\d+)
|
||||
\\.(?P<patch>\\d+)
|
||||
(-
|
||||
(?P<stage>[^.]*)
|
||||
\\.(?P<devnum>\\d+)
|
||||
)?
|
||||
"""
|
||||
serialize = [
|
||||
"{major}.{minor}.{patch}-{stage}.{devnum}",
|
||||
"{major}.{minor}.{patch}",
|
||||
]
|
||||
search = "{current_version}"
|
||||
replace = "{new_version}"
|
||||
regex = false
|
||||
ignore_missing_version = false
|
||||
tag = true
|
||||
sign_tags = true
|
||||
tag_name = "v{new_version}"
|
||||
tag_message = "Bump version: {current_version} → {new_version}"
|
||||
allow_dirty = false
|
||||
commit = true
|
||||
message = "Bump version: {current_version} → {new_version}"
|
||||
|
||||
[tool.bumpversion.parts.stage]
|
||||
optional_value = "stable"
|
||||
first_value = "stable"
|
||||
values = [
|
||||
"alpha",
|
||||
"beta",
|
||||
"stable",
|
||||
]
|
||||
|
||||
[tool.bumpversion.part.devnum]
|
||||
|
||||
[[tool.bumpversion.files]]
|
||||
filename = "setup.py"
|
||||
search = "version=\"{current_version}\""
|
||||
replace = "version=\"{new_version}\""
|
||||
|
||||
4
setup.py
4
setup.py
@ -9,7 +9,7 @@ from setuptools import (
|
||||
extras_require = {
|
||||
"dev": [
|
||||
"build>=0.9.0",
|
||||
"bumpversion>=0.5.3",
|
||||
"bump-my-version>=0.5.3",
|
||||
"ipython",
|
||||
"pre-commit>=3.4.0",
|
||||
"tox>=4.0.0",
|
||||
@ -98,7 +98,7 @@ setup(
|
||||
license="MIT/APACHE2.0",
|
||||
zip_safe=False,
|
||||
keywords="libp2p p2p",
|
||||
packages=find_packages(exclude=["tests", "tests.*"]),
|
||||
packages=find_packages(exclude=["scripts", "scripts.*", "tests", "tests.*"]),
|
||||
package_data={"libp2p": ["py.typed"]},
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
|
||||
5
tox.ini
5
tox.ini
@ -3,9 +3,9 @@ envlist=
|
||||
py{38,39,310,311,312}-core
|
||||
py{38,39,310,311,312}-lint
|
||||
py{38,39,310,311,312}-wheel
|
||||
py{38,39,310,311,312}-interop
|
||||
windows-wheel
|
||||
docs
|
||||
py{38,39,310,311,312}-interop
|
||||
|
||||
[flake8]
|
||||
exclude=venv*,.tox,docs,build,*_pb2*.py
|
||||
@ -16,7 +16,8 @@ per-file-ignores=__init__.py:F401
|
||||
[testenv]
|
||||
usedevelop=True
|
||||
commands=
|
||||
core: pytest {posargs:tests/}
|
||||
core: pytest {posargs:tests/core}
|
||||
interop: pytest {posargs:tests/interop}
|
||||
docs: make check-docs-ci
|
||||
basepython=
|
||||
docs: python
|
||||
|
||||
Reference in New Issue
Block a user