merge template updates and refill vars

This commit is contained in:
pacrob
2024-02-19 14:44:45 -07:00
30 changed files with 773 additions and 475 deletions

View File

@ -5,11 +5,11 @@ CURRENT_SIGN_SETTING := $(shell git config commit.gpgSign)
help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8, etc"
@echo "lint-roll - auto-correct styles with isort, black, docformatter, etc"
@echo "lint - fix linting issues with pre-commit"
@echo "test - run tests quickly with the default Python"
@echo "testall - run tests on every Python version with tox"
@echo "release - package and upload a release"
@echo "docs - generate docs and open in browser (linux-docs for version on linux)"
@echo "notes - consume towncrier newsfragments/ and update release notes in docs/"
@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
@ -38,7 +38,6 @@ clean: clean-build clean-pyc
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
@ -47,37 +46,36 @@ clean-pyc:
find . -name '__pycache__' -exec rm -rf {} +
lint:
mypy -p libp2p -p examples --config-file mypy.ini
flake8 $(FILES_TO_LINT)
black --check $(FILES_TO_LINT)
isort --recursive --check-only --diff $(FILES_TO_LINT)
docformatter --pre-summary-newline --check --recursive $(FILES_TO_LINT)
tox -e lint # This is probably redundant, but just in case...
lint-roll:
isort --recursive $(FILES_TO_LINT)
black $(FILES_TO_LINT)
docformatter -ir --pre-summary-newline $(FILES_TO_LINT)
$(MAKE) 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..." \
&& pre-commit run --all-files --show-diff-on-failure \
)
test:
pytest tests
test-all:
tox
build-docs:
sphinx-apidoc -o docs/ . setup.py "*conftest*" "libp2p/tools/interop*"
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(MAKE) -C docs doctest
./newsfragments/validate_files.py
towncrier --draft --version preview
build-docs-ci:
$(MAKE) -C docs latexpdf
$(MAKE) -C docs epub
docs: build-docs
validate-newsfragments:
python ./newsfragments/validate_files.py
towncrier build --draft --version preview
check-docs: build-docs validate-newsfragments
check-docs-ci: build-docs build-docs-ci validate-newsfragments
docs: check-docs
open docs/_build/html/index.html
linux-docs: build-docs
linux-docs: check-docs
xdg-open docs/_build/html/index.html
package: clean
@ -85,17 +83,23 @@ package: clean
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
# 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'))
# Now generate the release notes to have them included in the release commit
towncrier --yes --version $(UPCOMING_VERSION)
towncrier build --yes --version $(UPCOMING_VERSION)
# Before we bump the version, make sure that the towncrier-generated docs will build
make build-docs
git commit -m "Compile release notes"
git commit -m "Compile release notes for v$(UPCOMING_VERSION)"
release: clean
# require that you be on a branch that's linked to upstream/master
git status -s -b | head -1 | grep "\.\.upstream/master"
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
./newsfragments/validate_files.py is-empty
make build-docs
@ -103,11 +107,11 @@ release: clean
git config commit.gpgSign true
bumpversion $(bump)
git push upstream && git push upstream --tags
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"
dist: clean
python setup.py sdist bdist_wheel
python -m build
ls -l dist