From dc9f04c18f9a96d6e0252275bab454c793fe1e44 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 3 May 2019 14:45:31 -0700 Subject: [PATCH 01/94] Skip venv in template filler & print progress --- .project-template/fill_template_vars.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.project-template/fill_template_vars.sh b/.project-template/fill_template_vars.sh index f09e8ffe..c9cb8261 100755 --- a/.project-template/fill_template_vars.sh +++ b/.project-template/fill_template_vars.sh @@ -29,7 +29,8 @@ echo "What is a one-liner describing the project?" read SHORT_DESCRIPTION _replace() { - local find_cmd=(find "$PROJECT_ROOT" ! -perm -u=x ! -path '*/.git/*' -type f) + echo "Replacing values: $1" + local find_cmd=(find "$PROJECT_ROOT" ! -perm -u=x ! -path '*/.git/*' ! -path '*/venv*/*' -type f) if [[ $(uname) == Darwin ]]; then "${find_cmd[@]}" -exec sed -i '' "$1" {} + From 4ab4a01a360d2e6b61f4c144f5613f7c5a9acddd Mon Sep 17 00:00:00 2001 From: Nick Gheorghita Date: Thu, 12 Dec 2019 13:21:22 +0100 Subject: [PATCH 02/94] Add MANIFEST.in file --- MANIFEST.in | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..fbff9807 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,8 @@ +include LICENSE +include README.md +include requirements-docs.txt + +global-include *.pyi + +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] From c8f686f0771d18ea5fdb45db7f38f1b981f02c88 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 24 Jan 2020 11:07:11 -0800 Subject: [PATCH 03/94] Update MIT License to 2020 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index d93175ab..17bc694e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 The Ethereum Foundation +Copyright (c) 2020 The Ethereum Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From e6e69625bb32c8a595a19f750aa8e8fdd6725e2b Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 24 Jan 2020 11:21:24 -0800 Subject: [PATCH 04/94] Replace web3 reference with Some hard-coded references to web3.py slipped through. Clearly this user path is not tested very often. In eth-abi, it still said EthereumAlarmClock X) --- docs/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 32800935..aa0085b3 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -85,17 +85,17 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/web3.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/web3.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/web3" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/web3" + @echo "# mkdir -p $$HOME/.local/share/devhelp/" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/" @echo "# devhelp" epub: From 6d75c9aa8d4bd3f8e5791bdf936ee319a9abb1dd Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 24 Jan 2020 11:28:54 -0800 Subject: [PATCH 05/94] Update docs copyright to the year 2020 --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index aaf6fb6e..977f3ab1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,7 +54,7 @@ master_doc = 'index' # General information about the project. project = '' -copyright = '2019, The Ethereum Foundation' +copyright = '2020, The Ethereum Foundation' __version__ = setup_version # The version info for the project you're documenting, acts as replacement for From 4195de314249a740de65a91c6644fec921c05d10 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Thu, 23 Apr 2020 09:13:32 -0600 Subject: [PATCH 06/94] Update testing and lint deps --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 54dbd6ca..845b8ab8 100644 --- a/setup.py +++ b/setup.py @@ -7,14 +7,14 @@ from setuptools import ( extras_require = { 'test': [ - "pytest==3.3.2", + "pytest==5.4.1", "pytest-xdist", - "tox>=2.9.1,<3", + "tox==3.14.6", ], 'lint': [ - "flake8==3.4.1", + "flake8==3.7.9", "isort>=4.2.15,<5", - "mypy==0.701", + "mypy==0.770", "pydocstyle>=3.0.0,<4", ], 'doc': [ From c447735449cf0d7b633bcc10395f024f5292238f Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 11 May 2020 13:55:17 -0700 Subject: [PATCH 07/94] Better error if bump missing in make notes/release --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5e087e37..264cd190 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,12 @@ docs: build-docs linux-docs: build-docs xdg-open docs/_build/html/index.html -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 @@ -59,7 +64,7 @@ notes: make build-docs git commit -m "Compile release notes" -release: clean +release: check-bump clean # require that you be on a branch that's linked to upstream/master git status -s -b | head -1 | grep "\.\.upstream/master" # verify that docs build correctly From ea7038bd263ccc9ba981b12044e41bee14774e8f Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 1 Sep 2020 11:29:19 -0700 Subject: [PATCH 08/94] Update link to correct URL for release notes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ceb98c9..92b70bea 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ -Read more in the [documentation on ReadTheDocs](https://.readthedocs.io/). [View the change log](https://.readthedocs.io/en/latest/releases.html). +Read more in the [documentation on ReadTheDocs](https://.readthedocs.io/). [View the change log](https://.readthedocs.io/en/latest/release_notes.html). ## Quickstart From d74a5e2bd8383dafe2f981df37e2f012736d9d24 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Wed, 2 Sep 2020 15:54:34 -0700 Subject: [PATCH 09/94] Latest mypy refuses package with file path --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 953e83ab..07b2179c 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ whitelist_externals=make basepython=python extras=lint commands= - mypy -p {toxinidir}/ --config-file {toxinidir}/mypy.ini + mypy -p --config-file {toxinidir}/mypy.ini flake8 {toxinidir}/ {toxinidir}/tests isort --recursive --check-only --diff {toxinidir}/ {toxinidir}/tests pydocstyle {toxinidir}/ {toxinidir}/tests From 27d0c7f0e56d023587baf6bac81ac2531d7f2517 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 24 Sep 2020 08:46:51 -0700 Subject: [PATCH 10/94] Customize section title, because default is bad It has weird capitalization rules, in particular. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index a9724ba6..b03fe29e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ package = "" filename = "docs/release_notes.rst" directory = "newsfragments" underlines = ["-", "~", "^"] +title_format = " v{version} ({project_date})" issue_format = "`#{issue} /issues/{issue}>`__" [[tool.towncrier.type]] From be1c3242048035106bc137ed2558424c5f4d860b Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 24 Sep 2020 08:58:58 -0700 Subject: [PATCH 11/94] Add some Makefile doc strings --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 264cd190..68ed4174 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,12 @@ help: @echo "clean-build - remove build artifacts" @echo "clean-pyc - remove Python file artifacts" @echo "lint - check style with flake8" + @echo "lint-roll - automatically fix problems with isort, flake8, etc" @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" clean: clean-build clean-pyc From 4d0358f67b56335d395aee4d49abd5276811a6b5 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 24 Sep 2020 08:59:09 -0700 Subject: [PATCH 12/94] Be sure to remove py3 cache files --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 68ed4174..d38ac9d9 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ clean-pyc: find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} + find . -name '*~' -exec rm -f {} + + find . -name '__pycache__' -exec rm -rf {} + lint: tox -elint From 57f829250d5704e12f9bbd347fcaf565f7c596fa Mon Sep 17 00:00:00 2001 From: Tiffany McKenzie <25855566+tmckenzie51@users.noreply.github.com> Date: Mon, 7 Dec 2020 11:18:39 -0500 Subject: [PATCH 13/94] update .gitignore --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0e057278..b43bb7b3 100644 --- a/.gitignore +++ b/.gitignore @@ -97,9 +97,10 @@ logs # IntelliJ /out/ +.idea* -# mpeltonen/sbt-idea plugin -.idea_modules/ +#pip wheel metadata +pip-wheel-metadata # JIRA plugin atlassian-ide-plugin.xml From f962541b66cf5febf78c76b237203e9cad1f03c9 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 19 Jan 2021 15:30:31 -0800 Subject: [PATCH 14/94] Export type annotations to importing projects --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 845b8ab8..3e3cdf05 100644 --- a/setup.py +++ b/setup.py @@ -64,6 +64,7 @@ setup( zip_safe=False, keywords='ethereum', packages=find_packages(exclude=["tests", "tests.*"]), + package_data={'': ['py.typed']}, classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', From 8434801bfc740f35ceeb27e76af1c3d2ce0db1b8 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 19 Jan 2021 15:45:12 -0800 Subject: [PATCH 15/94] Upgrade pydocstyle to v5 Fixes https://github.com/ethereum/ethereum-python-project-template/issues/52 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 845b8ab8..40edee8b 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ extras_require = { "flake8==3.7.9", "isort>=4.2.15,<5", "mypy==0.770", - "pydocstyle>=3.0.0,<4", + "pydocstyle>=5.0.0,<6", ], 'doc': [ "Sphinx>=1.6.5,<2", From 9d0cbd4a9fca511fab6e8f8ee49edc8c750bf4c3 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 19 Jan 2021 15:51:46 -0800 Subject: [PATCH 16/94] Add pip-wheel-metadata & .pytest_cache to ignore Fixes https://github.com/ethereum/ethereum-python-project-template/issues/51 --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b43bb7b3..0ec1cd37 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ develop-eggs .installed.cfg lib lib64 +pip-wheel-metadata venv* # Installer logs @@ -55,6 +56,7 @@ chains # tox/pytest cache .cache +.pytest_cache # Test output logs logs From f4f5c051f59122e1889ddb68c6e4720b1243eb94 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 19 Jan 2021 15:55:52 -0800 Subject: [PATCH 17/94] Clean up IntelliJ .gitignore a bit --- .gitignore | 49 ++++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 0ec1cd37..011ac1c8 100644 --- a/.gitignore +++ b/.gitignore @@ -60,31 +60,6 @@ chains # Test output logs logs -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/workspace.xml -.idea/tasks.xml -.idea/dictionaries -.idea/vcs.xml -.idea/jsLibraryMappings.xml - -# Sensitive or high-churn files: -.idea/dataSources.ids -.idea/dataSources.xml -.idea/dataSources.local.xml -.idea/sqlDataSources.xml -.idea/dynamic.xml -.idea/uiDesigner.xml - -# Gradle: -.idea/gradle.xml -.idea/libraries - -# Mongo Explorer plugin: -.idea/mongoSettings.xml # VIM temp files *.sw[op] @@ -92,24 +67,32 @@ logs # mypy .mypy_cache +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# For a more precise, explicit template, see: +# https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +## General +.idea/* +.idea_modules/* + ## File-based project format: *.iws +## IntelliJ +out/ + ## Plugin-specific files: -# IntelliJ -/out/ -.idea* +### mpeltonen/sbt-idea plugin +.idea_modules/ -#pip wheel metadata -pip-wheel-metadata - -# JIRA plugin +### JIRA plugin atlassian-ide-plugin.xml -# Crashlytics plugin (for Android Studio and IntelliJ) +### Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties +# END JetBrains section From 8c7f30b0b7276bc33e10d8fe57e3e34d1c5b8f18 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 19 Jan 2021 16:14:16 -0800 Subject: [PATCH 18/94] Add supported OS's Fixes https://github.com/ethereum/ethereum-python-project-template/issues/37 --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 40edee8b..a78d2afa 100644 --- a/setup.py +++ b/setup.py @@ -69,6 +69,8 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', + 'Operating System :: MacOS', + 'Operating System :: POSIX', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', From b7baeca0cd92dda123f34931a695e30556b4b270 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 19 Jan 2021 16:15:22 -0800 Subject: [PATCH 19/94] Pin sphinx-rtd-theme to =1.6.5,<2", - "sphinx_rtd_theme>=0.1.9", + "sphinx_rtd_theme>=0.1.9,<1", "towncrier>=19.2.0, <20", ], 'dev': [ From 1410bcb22028fc92b9dec180cc88571742eac2c2 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 21 Jan 2021 11:35:29 -0800 Subject: [PATCH 20/94] Fix the type annotations export, adding py.typed Fixes https://github.com/ethereum/ethereum-python-project-template/issues/30 --- .project-template/fill_template_vars.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.project-template/fill_template_vars.sh b/.project-template/fill_template_vars.sh index c9cb8261..250f5512 100755 --- a/.project-template/fill_template_vars.sh +++ b/.project-template/fill_template_vars.sh @@ -47,3 +47,4 @@ _replace "s//$SHORT_DESCRIPTION/g" mkdir -p "$PROJECT_ROOT/$MODULE_NAME" touch "$PROJECT_ROOT/$MODULE_NAME/__init__.py" +touch "$PROJECT_ROOT/$MODULE_NAME/py.typed" From 765b2e441461217a8fada93d51ecf6969cdcda75 Mon Sep 17 00:00:00 2001 From: kclowes Date: Fri, 19 Nov 2021 13:43:20 -0700 Subject: [PATCH 21/94] Add python3.8 support --- .circleci/config.yml | 6 ++++++ setup.py | 1 + tox.ini | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fa7691e6..0027cef1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,6 +60,12 @@ jobs: - image: circleci/python:3.7 environment: TOXENV: py37-core + py38-core: + <<: *common + docker: + - image: circleci/python:3.8 + environment: + TOXENV: py38-core pypy3-core: <<: *common docker: diff --git a/setup.py b/setup.py index 2b8c7201..65d7904a 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ setup( 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: PyPy', ], ) diff --git a/tox.ini b/tox.ini index 07b2179c..33b16f2b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - py{36,37,py3}-core + py{36,37,38,py3}-core lint docs @@ -28,6 +28,7 @@ basepython = docs: python py36: python3.6 py37: python3.7 + py37: python3.8 pypy3: pypy3 extras= test From fcb5577fa1e20ebe489e26e3a1e588fe87ba1211 Mon Sep 17 00:00:00 2001 From: kclowes Date: Fri, 19 Nov 2021 13:43:36 -0700 Subject: [PATCH 22/94] Add python 3.9 support --- .circleci/config.yml | 6 ++++++ setup.py | 1 + tox.ini | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0027cef1..35ab4b8a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,6 +66,12 @@ jobs: - image: circleci/python:3.8 environment: TOXENV: py38-core + py39-core: + <<: *common + docker: + - image: circleci/python:3.9 + environment: + TOXENV: py39-core pypy3-core: <<: *common docker: diff --git a/setup.py b/setup.py index 65d7904a..14567643 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,7 @@ setup( 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: PyPy', ], ) diff --git a/tox.ini b/tox.ini index 33b16f2b..049e8e3a 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,8 @@ basepython = docs: python py36: python3.6 py37: python3.7 - py37: python3.8 + py38: python3.8 + py39: python3.9 pypy3: pypy3 extras= test From d21d58250bc5547993a0e2ec5ab88c3de06a473c Mon Sep 17 00:00:00 2001 From: kclowes Date: Fri, 19 Nov 2021 13:48:19 -0700 Subject: [PATCH 23/94] Add python 3.10 support --- .circleci/config.yml | 6 ++++++ setup.py | 1 + tox.ini | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35ab4b8a..167ae520 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,6 +72,12 @@ jobs: - image: circleci/python:3.9 environment: TOXENV: py39-core + py310-core: + <<: *common + docker: + - image: circleci/python:3.10 + environment: + TOXENV: py310-core pypy3-core: <<: *common docker: diff --git a/setup.py b/setup.py index 14567643..79241342 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ setup( 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: Implementation :: PyPy', ], ) diff --git a/tox.ini b/tox.ini index 049e8e3a..3148e02b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - py{36,37,38,py3}-core + py{36,37,38,39,310,py3}-core lint docs @@ -30,6 +30,7 @@ basepython = py37: python3.7 py38: python3.8 py39: python3.9 + py310: python3.10 pypy3: pypy3 extras= test From 0649062150d7894dd74b00f589f62c7823e3a1ae Mon Sep 17 00:00:00 2001 From: kclowes Date: Fri, 19 Nov 2021 13:51:55 -0700 Subject: [PATCH 24/94] Update pytest to support python 3.10, pin pytest-xdist, bump eth-utils to >=2,<3 --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 79241342..38e0d78b 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,8 @@ from setuptools import ( extras_require = { 'test': [ - "pytest==5.4.1", - "pytest-xdist", + "pytest>=6.2.5,<7", + "pytest-xdist>=2.4.0,<3", "tox==3.14.6", ], 'lint': [ @@ -55,7 +55,7 @@ setup( url='https://github.com/ethereum/', include_package_data=True, install_requires=[ - "eth-utils>=1,<2", + "eth-utils>=2,<3", ], python_requires='>=3.6, <4', extras_require=extras_require, From c6f13bfd943282c452e29dafbde595186010ee53 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Wed, 18 May 2022 12:19:24 -0700 Subject: [PATCH 25/94] Show full explanation for pydocstyle failures --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 3148e02b..edd1dcde 100644 --- a/tox.ini +++ b/tox.ini @@ -44,4 +44,4 @@ commands= mypy -p --config-file {toxinidir}/mypy.ini flake8 {toxinidir}/ {toxinidir}/tests isort --recursive --check-only --diff {toxinidir}/ {toxinidir}/tests - pydocstyle {toxinidir}/ {toxinidir}/tests + pydocstyle --explain {toxinidir}/ {toxinidir}/tests From d3a5a3e9e5ccaac942115ef95bdb87db1644d118 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 20 May 2022 10:18:36 -0700 Subject: [PATCH 26/94] Exclude huge and unnecessary venv*/ from dist See an example issue here: https://github.com/ethereum/eth-account/issues/150 --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index fbff9807..0d9ffe93 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,3 +6,4 @@ global-include *.pyi recursive-exclude * __pycache__ recursive-exclude * *.py[co] +recursive-exclude * venv* From 2e22e2d0b64850ff03356a9d52c06e79c23ef65f Mon Sep 17 00:00:00 2001 From: kclowes Date: Fri, 20 May 2022 14:12:01 -0600 Subject: [PATCH 27/94] Add breaking change type to newsfragment (#61) * Add breaking change type to newsfragment * Move breaking-change -> breaking --- newsfragments/README.md | 1 + newsfragments/validate_files.py | 1 + pyproject.toml | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/newsfragments/README.md b/newsfragments/README.md index 09a10ddc..bcb0412a 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -15,6 +15,7 @@ Each file should be named like `..rst`, where * `internal` * `removal` * `misc` +* `breaking` So for example: `123.feature.rst`, `456.bugfix.rst` diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index c0e9b289..0a13ec2a 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -8,6 +8,7 @@ import pathlib import sys ALLOWED_EXTENSIONS = { + '.breaking.rst', '.bugfix.rst', '.doc.rst', '.feature.rst', diff --git a/pyproject.toml b/pyproject.toml index b03fe29e..31433140 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,3 +41,8 @@ showcontent = true directory = "misc" name = "Miscellaneous changes" showcontent = false + +[[tool.towncrier.type]] +directory = "breaking" +name = "Breaking changes" +showcontent = true From e2e1f9d079093737402e31b4f8b65e2be47d22de Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 26 May 2022 14:01:42 -0700 Subject: [PATCH 28/94] Use prune instead of recursive-exclude for venv* Frankly not sure why recursive-exclude doesn't work here, but prune does, and that's good enough for me now. It's also probably preferable to only exclude venv* at the root, anyway. --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 0d9ffe93..bb1b0f3e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,4 +6,4 @@ global-include *.pyi recursive-exclude * __pycache__ recursive-exclude * *.py[co] -recursive-exclude * venv* +prune venv* From 5e100467599407e2aeff854f7624b34c0efff511 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Wed, 1 Jun 2022 13:05:34 -0700 Subject: [PATCH 29/94] Use updated CircleCI images See https://discuss.circleci.com/t/legacy-convenience-image-deprecation/41034 --- .circleci/config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 167ae520..9664ee14 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,43 +39,43 @@ jobs: docs: <<: *common docker: - - image: circleci/python:3.6 + - image: cimg/python:3.6 environment: TOXENV: docs lint: <<: *common docker: - - image: circleci/python:3.6 + - image: cimg/python:3.6 environment: TOXENV: lint py36-core: <<: *common docker: - - image: circleci/python:3.6 + - image: cimg/python:3.6 environment: TOXENV: py36-core py37-core: <<: *common docker: - - image: circleci/python:3.7 + - image: cimg/python:3.7 environment: TOXENV: py37-core py38-core: <<: *common docker: - - image: circleci/python:3.8 + - image: cimg/python:3.8 environment: TOXENV: py38-core py39-core: <<: *common docker: - - image: circleci/python:3.9 + - image: cimg/python:3.9 environment: TOXENV: py39-core py310-core: <<: *common docker: - - image: circleci/python:3.10 + - image: cimg/python:3.10 environment: TOXENV: py310-core pypy3-core: From cb112ef9c12e16d2caaf71f7f0c067663499fddf Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 2 Jun 2022 15:36:24 -0700 Subject: [PATCH 30/94] Upgrade towncrier to fix the duplicate title bug --- Makefile | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d38ac9d9..bc398812 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ build-docs: $(MAKE) -C docs html $(MAKE) -C docs doctest ./newsfragments/validate_files.py - towncrier --draft --version preview + towncrier build --draft --version preview docs: build-docs open docs/_build/html/index.html @@ -63,7 +63,7 @@ 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" diff --git a/setup.py b/setup.py index 38e0d78b..6f0abaf1 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ extras_require = { 'doc': [ "Sphinx>=1.6.5,<2", "sphinx_rtd_theme>=0.1.9,<1", - "towncrier>=19.2.0, <20", + "towncrier>=21,<22", ], 'dev': [ "bumpversion>=0.5.3,<1", From 160c0feb056ece2b3d1f2f92d0991c3180bf5de3 Mon Sep 17 00:00:00 2001 From: kclowes Date: Wed, 22 Jun 2022 13:55:56 -0600 Subject: [PATCH 31/94] Add a validate docs command (#64) --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index bc398812..03e193ba 100644 --- a/Makefile +++ b/Makefile @@ -45,10 +45,12 @@ build-docs: $(MAKE) -C docs clean $(MAKE) -C docs html $(MAKE) -C docs doctest - ./newsfragments/validate_files.py - towncrier build --draft --version preview -docs: build-docs +validate-docs: + python ./newsfragments/validate_files.py + towncrier --draft --version preview + +docs: build-docs validate-docs open docs/_build/html/index.html linux-docs: build-docs From 007725e84d2913c1faace60fec9df1c677f7a3be Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Wed, 31 Aug 2022 14:31:13 -0700 Subject: [PATCH 32/94] Don't push .tox file to tar.gz release It can get big with installed libraries. On a relatively small release of eth-portal, this one change cut the .tar.gz release size from 574Kb to 14Kb. --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index bb1b0f3e..e870a411 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,4 +6,5 @@ global-include *.pyi recursive-exclude * __pycache__ recursive-exclude * *.py[co] +prune .tox prune venv* From 99af2f4d53ec9da9abe3a5bfa46d37d32f5c7885 Mon Sep 17 00:00:00 2001 From: kclowes Date: Mon, 19 Sep 2022 14:35:39 -0600 Subject: [PATCH 33/94] Misc Updates (#65) * Tweaks to release process * Drop python 3.6 --- .bumpversion.cfg | 8 +- .circleci/config.yml | 14 ++-- Makefile | 9 ++- docs/conf.py | 169 ++++++++++++++++++++++------------------ newsfragments/README.md | 2 +- pytest.ini | 1 - setup.py | 66 ++++++++-------- tox.ini | 6 +- 8 files changed, 144 insertions(+), 131 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index eefe4ad9..f683001f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,14 +3,14 @@ current_version = 0.1.0-alpha.0 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-(?P[^.]*)\.(?P\d+))? -serialize = +serialize = {major}.{minor}.{patch}-{stage}.{devnum} {major}.{minor}.{patch} [bumpversion:part:stage] optional_value = stable first_value = stable -values = +values = alpha beta stable @@ -18,6 +18,6 @@ values = [bumpversion:part:devnum] [bumpversion:file:setup.py] -search = version='{current_version}', -replace = version='{new_version}', +search = version="{current_version}", +replace = version="{new_version}", diff --git a/.circleci/config.yml b/.circleci/config.yml index 9664ee14..b67caf4e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,21 +39,15 @@ jobs: docs: <<: *common docker: - - image: cimg/python:3.6 + - image: cimg/python:3.7 environment: TOXENV: docs lint: <<: *common docker: - - image: cimg/python:3.6 + - image: cimg/python:3.7 environment: TOXENV: lint - py36-core: - <<: *common - docker: - - image: cimg/python:3.6 - environment: - TOXENV: py36-core py37-core: <<: *common docker: @@ -90,6 +84,8 @@ workflows: jobs: - docs - lint - - py36-core - py37-core + - py38-core + - py39-core + - py310-core - pypy3-core diff --git a/Makefile b/Makefile index 03e193ba..541c166d 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ lint: lint-roll: isort --recursive tests + black {toxinidir}/ {toxinidir}/tests setup.py $(MAKE) lint test: @@ -48,12 +49,14 @@ build-docs: validate-docs: python ./newsfragments/validate_files.py - towncrier --draft --version preview + towncrier build --draft --version preview -docs: build-docs validate-docs +check-docs: build-docs validate-docs + +docs: check-docs open docs/_build/html/index.html -linux-docs: build-docs +linux-docs: check-docs xdg-open docs/_build/html/index.html check-bump: diff --git a/docs/conf.py b/docs/conf.py index 977f3ab1..8264b456 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,46 +15,46 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) import os -DIR = os.path.dirname('__file__') -with open (os.path.join(DIR, '../setup.py'), 'r') as f: +DIR = os.path.dirname("__file__") +with open(os.path.join(DIR, "../setup.py"), "r") as f: for line in f: - if 'version=' in line: - setup_version = line.split('\'')[1] + if "version=" in line: + setup_version = line.split('"')[1] break # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.doctest', - 'sphinx.ext.intersphinx', + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = '' -copyright = '2020, The Ethereum Foundation' +project = "" +copyright = "2020, The Ethereum Foundation" __version__ = setup_version # The version info for the project you're documenting, acts as replacement for @@ -62,176 +62,179 @@ __version__ = setup_version # built documents. # # The short X.Y version. -version = '.'.join(__version__.split('.')[:2]) +version = ".".join(__version__.split(".")[:2]) # The full version, including alpha/beta/rc tags. release = __version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [ - '_build', - 'modules.rst', + "_build", + "modules.rst", ] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +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 = {} # Add any paths that contain custom themes here, relative to this directory. # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # 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 # pixels large. -#html_favicon = None +# html_favicon = None # 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 # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'doc' +htmlhelp_basename = "doc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', '.tex', ' Documentation', - 'The Ethereum Foundation', 'manual'), + ( + "index", + ".tex", + " Documentation", + "The Ethereum Foundation", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- @@ -239,12 +242,17 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', '', ' Documentation', - ['The Ethereum Foundation'], 1) + ( + "index", + "", + " Documentation", + ["The Ethereum Foundation"], + 1, + ) ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -253,34 +261,41 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', '', ' Documentation', - 'The Ethereum Foundation', '', '', - 'Miscellaneous'), + ( + "index", + "", + " Documentation", + "The Ethereum Foundation", + "", + "", + "Miscellaneous", + ), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False # -- Intersphinx configuration ------------------------------------------------ intersphinx_mapping = { - 'python': ('https://docs.python.org/3.6', None), + "python": ("https://docs.python.org/3.10", None), } # -- Doctest configuration ---------------------------------------- import doctest -doctest_default_flags = (0 +doctest_default_flags = ( + 0 | doctest.DONT_ACCEPT_TRUE_FOR_1 | doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL diff --git a/newsfragments/README.md b/newsfragments/README.md index bcb0412a..f98aef6e 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -24,5 +24,5 @@ then open up the PR first and use the PR number for the newsfragment. Note that the `towncrier` tool will automatically reflow your text, so don't try to do any fancy formatting. Run - `towncrier --draft` to get a preview of what the release notes entry + `towncrier build --draft` to get a preview of what the release notes entry will look like in the final release notes. diff --git a/pytest.ini b/pytest.ini index f5fdc0ec..ae90934f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,5 @@ [pytest] addopts= -v --showlocals --durations 10 -python_paths= . xfail_strict=true [pytest-watch] diff --git a/setup.py b/setup.py index 6f0abaf1..e319e3e0 100644 --- a/setup.py +++ b/setup.py @@ -6,23 +6,24 @@ from setuptools import ( ) extras_require = { - 'test': [ + "test": [ "pytest>=6.2.5,<7", "pytest-xdist>=2.4.0,<3", "tox==3.14.6", ], - 'lint': [ + "lint": [ "flake8==3.7.9", "isort>=4.2.15,<5", "mypy==0.770", "pydocstyle>=5.0.0,<6", + "black>=22,<23", ], - 'doc': [ + "doc": [ "Sphinx>=1.6.5,<2", "sphinx_rtd_theme>=0.1.9,<1", "towncrier>=21,<22", ], - 'dev': [ + "dev": [ "bumpversion>=0.5.3,<1", "pytest-watch>=4.1.0,<5", "wheel", @@ -31,53 +32,52 @@ extras_require = { ], } -extras_require['dev'] = ( - extras_require['dev'] + # noqa: W504 - extras_require['test'] + # noqa: W504 - extras_require['lint'] + # noqa: W504 - extras_require['doc'] +extras_require["dev"] = ( + extras_require["dev"] + + extras_require["test"] + + extras_require["lint"] + + extras_require["doc"] ) -with open('./README.md') as readme: +with open("./README.md") as readme: long_description = readme.read() setup( - name='', + name="", # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme - version='0.1.0-alpha.0', + version="0.1.0-alpha.0", description=""": """, long_description=long_description, - long_description_content_type='text/markdown', - author='The Ethereum Foundation', - author_email='snakecharmers@ethereum.org', - url='https://github.com/ethereum/', + long_description_content_type="text/markdown", + author="The Ethereum Foundation", + author_email="snakecharmers@ethereum.org", + url="https://github.com/ethereum/", include_package_data=True, install_requires=[ "eth-utils>=2,<3", ], - python_requires='>=3.6, <4', + python_requires=">=3.7, <4", extras_require=extras_require, - py_modules=[''], + py_modules=[""], license="MIT", zip_safe=False, - keywords='ethereum', + keywords="ethereum", packages=find_packages(exclude=["tests", "tests.*"]), - package_data={'': ['py.typed']}, + package_data={"": ["py.typed"]}, classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Operating System :: MacOS', - 'Operating System :: POSIX', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: PyPy', + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: MacOS", + "Operating System :: POSIX", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: PyPy", ], ) diff --git a/tox.ini b/tox.ini index edd1dcde..afe023cf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - py{36,37,38,39,310,py3}-core + py{37,38,39,310,py3}-core lint docs @@ -23,10 +23,9 @@ ignore= usedevelop=True commands= core: pytest {posargs:tests/core} - docs: make build-docs + docs: make check-docs basepython = docs: python - py36: python3.6 py37: python3.7 py38: python3.8 py39: python3.9 @@ -45,3 +44,4 @@ commands= flake8 {toxinidir}/ {toxinidir}/tests isort --recursive --check-only --diff {toxinidir}/ {toxinidir}/tests pydocstyle --explain {toxinidir}/ {toxinidir}/tests + black --check {toxinidir}/ {toxinidir}/tests setup.py From e785138a21bd8486653e09dd74e2dba1269a235d Mon Sep 17 00:00:00 2001 From: kclowes Date: Mon, 19 Sep 2022 14:55:43 -0600 Subject: [PATCH 34/94] Use updated tox command in CI (#67) --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b67caf4e..4ce05a43 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ common: &common command: pip install --user tox - run: name: run tox - command: ~/.local/bin/tox -r + command: python -m tox -r - save_cache: paths: - .hypothesis From 8a4cb1d938c36cac47e60af313d012e2f0fd8065 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 22 Sep 2022 13:38:20 -0700 Subject: [PATCH 35/94] Upgrade isort to v5 for black support --- Makefile | 2 +- setup.py | 2 +- tox.ini | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 541c166d..231b2b20 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ lint: tox -elint lint-roll: - isort --recursive tests + isort tests black {toxinidir}/ {toxinidir}/tests setup.py $(MAKE) lint diff --git a/setup.py b/setup.py index e319e3e0..1c8088af 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ extras_require = { ], "lint": [ "flake8==3.7.9", - "isort>=4.2.15,<5", + "isort>=5.10.1,<6", "mypy==0.770", "pydocstyle>=5.0.0,<6", "black>=22,<23", diff --git a/tox.ini b/tox.ini index afe023cf..d1dc3e66 100644 --- a/tox.ini +++ b/tox.ini @@ -7,12 +7,9 @@ envlist= [isort] combine_as_imports=True force_sort_within_sections=True -include_trailing_comma=True known_third_party=hypothesis,pytest known_first_party= -line_length=21 -multi_line_output=3 -use_parentheses=True +profile=black [flake8] max-line-length= 100 @@ -42,6 +39,6 @@ extras=lint commands= mypy -p --config-file {toxinidir}/mypy.ini flake8 {toxinidir}/ {toxinidir}/tests - isort --recursive --check-only --diff {toxinidir}/ {toxinidir}/tests + isort --check-only --diff {toxinidir}/ {toxinidir}/tests pydocstyle --explain {toxinidir}/ {toxinidir}/tests black --check {toxinidir}/ {toxinidir}/tests setup.py From 94eacb9c30cb84085038f1eb2991623f459114a7 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 22 Sep 2022 13:38:32 -0700 Subject: [PATCH 36/94] A couple extra tweaks for black support --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d1dc3e66..0e5a8a1d 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ profile=black [flake8] max-line-length= 100 exclude= venv*,.tox,docs,build -ignore= +extend-ignore= E203 [testenv] usedevelop=True @@ -36,6 +36,7 @@ whitelist_externals=make [testenv:lint] basepython=python extras=lint +whitelist_externals=black commands= mypy -p --config-file {toxinidir}/mypy.ini flake8 {toxinidir}/ {toxinidir}/tests From 4bd024028b4f6e4c7bd69d610d84201b666660fa Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 22 Sep 2022 13:47:14 -0700 Subject: [PATCH 37/94] Fix a copy-paste mistake from #65 toxinidir won't mean anything in a Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 231b2b20..abf94549 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ lint: lint-roll: isort tests - black {toxinidir}/ {toxinidir}/tests setup.py + black tests setup.py $(MAKE) lint test: From 7b0bc76f6ff430b7530324dc17f1895ebc38c70c Mon Sep 17 00:00:00 2001 From: kclowes Date: Wed, 9 Nov 2022 11:11:28 -0700 Subject: [PATCH 38/94] Add Python 3.11, add more black checks, remove upper pins (#69) --- .circleci/config.yml | 7 +++++++ setup.py | 21 +++++++++++---------- tox.ini | 5 +++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ce05a43..db95741c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,6 +72,12 @@ jobs: - image: cimg/python:3.10 environment: TOXENV: py310-core + py311-core: + <<: *common + docker: + - image: cimg/python:3.11 + environment: + TOXENV: py311-core pypy3-core: <<: *common docker: @@ -88,4 +94,5 @@ workflows: - py38-core - py39-core - py310-core + - py311-core - pypy3-core diff --git a/setup.py b/setup.py index 1c8088af..9dfbf788 100644 --- a/setup.py +++ b/setup.py @@ -7,25 +7,25 @@ from setuptools import ( extras_require = { "test": [ - "pytest>=6.2.5,<7", + "pytest>=6.2.5", "pytest-xdist>=2.4.0,<3", "tox==3.14.6", ], "lint": [ "flake8==3.7.9", - "isort>=5.10.1,<6", + "isort>=5.10.1", "mypy==0.770", - "pydocstyle>=5.0.0,<6", - "black>=22,<23", + "pydocstyle>=5.0.0", + "black>=22", ], "doc": [ - "Sphinx>=1.6.5,<2", - "sphinx_rtd_theme>=0.1.9,<1", - "towncrier>=21,<22", + "Sphinx>=1.6.5", + "sphinx_rtd_theme>=0.1.9", + "towncrier>=21", ], "dev": [ - "bumpversion>=0.5.3,<1", - "pytest-watch>=4.1.0,<5", + "bumpversion>=0.5.3", + "pytest-watch>=4.1.0", "wheel", "twine", "ipython", @@ -56,7 +56,7 @@ setup( url="https://github.com/ethereum/", include_package_data=True, install_requires=[ - "eth-utils>=2,<3", + "eth-utils>=2", ], python_requires=">=3.7, <4", extras_require=extras_require, @@ -78,6 +78,7 @@ setup( "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: PyPy", ], ) diff --git a/tox.ini b/tox.ini index 0e5a8a1d..00ca4463 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - py{37,38,39,310,py3}-core + py{37,38,39,310,311,py3}-core lint docs @@ -27,6 +27,7 @@ basepython = py38: python3.8 py39: python3.9 py310: python3.10 + py311: python3.11 pypy3: pypy3 extras= test @@ -42,4 +43,4 @@ commands= flake8 {toxinidir}/ {toxinidir}/tests isort --check-only --diff {toxinidir}/ {toxinidir}/tests pydocstyle --explain {toxinidir}/ {toxinidir}/tests - black --check {toxinidir}/ {toxinidir}/tests setup.py + black --check {toxinidir}/ {toxinidir}/docs {toxinidir}/tests {toxinidir}/setup.py From 3ff1c9cf5d6d1867bc1216e586c65f787e15c0e3 Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 21 Nov 2022 17:25:08 -0700 Subject: [PATCH 39/94] Minor refactoring / cleanup - Clean up github PR template to remove double links to the newsfragment README.md - Clean up some typos and make some minor refactors. --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++------- newsfragments/README.md | 4 ++-- newsfragments/validate_files.py | 28 +++++++++++++++------------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 21d4db59..54da5516 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,18 +1,14 @@ -## What was wrong? +### What was wrong? -Issue # +Related to issue # -## How was it fixed? - -Summary of approach. +### How was it fixed? ### To-Do [//]: # (Stay ahead of things, add list items here!) - [ ] Clean up commit history -[//]: # (For important changes that should go into the release notes please add a newsfragment file as explained here: https://github.com/ethereum//blob/master/newsfragments/README.md) - [//]: # (See: https://.readthedocs.io/en/latest/contributing.html#pull-requests) - [ ] Add entry to the [release notes](https://github.com/ethereum//blob/master/newsfragments/README.md) diff --git a/newsfragments/README.md b/newsfragments/README.md index f98aef6e..e4740e4b 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -6,7 +6,7 @@ commit message and PR description, which are a description of the change as relevant to people working on the code itself.) Each file should be named like `..rst`, where -`` is an issue numbers, and `` is one of: +`` is an issue number, and `` is one of: * `feature` * `bugfix` @@ -24,5 +24,5 @@ then open up the PR first and use the PR number for the newsfragment. Note that the `towncrier` tool will automatically reflow your text, so don't try to do any fancy formatting. Run - `towncrier build --draft` to get a preview of what the release notes entry +`towncrier build --draft` to get a preview of what the release notes entry will look like in the final release notes. diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index 0a13ec2a..684c7987 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -8,19 +8,19 @@ import pathlib import sys ALLOWED_EXTENSIONS = { - '.breaking.rst', - '.bugfix.rst', - '.doc.rst', - '.feature.rst', - '.internal.rst', - '.misc.rst', - '.performance.rst', - '.removal.rst', + ".breaking.rst", + ".bugfix.rst", + ".doc.rst", + ".feature.rst", + ".internal.rst", + ".misc.rst", + ".performance.rst", + ".removal.rst", } ALLOWED_FILES = { - 'validate_files.py', - 'README.md', + "validate_files.py", + "README.md", } THIS_DIR = pathlib.Path(__file__).parent @@ -28,7 +28,7 @@ THIS_DIR = pathlib.Path(__file__).parent num_args = len(sys.argv) - 1 assert num_args in {0, 1} if num_args == 1: - assert sys.argv[1] in ('is-empty', ) + assert sys.argv[1] in ("is-empty",) for fragment_file in THIS_DIR.iterdir(): @@ -38,7 +38,9 @@ for fragment_file in THIS_DIR.iterdir(): full_extension = "".join(fragment_file.suffixes) if full_extension not in ALLOWED_EXTENSIONS: raise Exception(f"Unexpected file: {fragment_file}") - elif sys.argv[1] == 'is-empty': + elif sys.argv[1] == "is-empty": raise Exception(f"Unexpected file: {fragment_file}") else: - raise RuntimeError("Strange: arguments {sys.argv} were validated, but not found") + raise RuntimeError( + f"Strange: arguments {sys.argv} were validated, but not found" + ) From 7c85f95a4dfb0e6bbf425b1d22dd69c6c27cf98e Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 21 Nov 2022 17:27:18 -0700 Subject: [PATCH 40/94] Do not invoke ``setup.py`` directly - It is not recommended to invoke ``setup.py`` directly, instead opting for ``python -m build`` for the commands in this commit (see: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html) - Add newsfragment for #70 --- Makefile | 6 +++--- newsfragments/70.internal.rst | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 newsfragments/70.internal.rst diff --git a/Makefile b/Makefile index 541c166d..9ec20499 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ clean-pyc: find . -name '__pycache__' -exec rm -rf {} + lint: - tox -elint + tox -e lint lint-roll: isort --recursive tests @@ -83,11 +83,11 @@ release: check-bump 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 diff --git a/newsfragments/70.internal.rst b/newsfragments/70.internal.rst new file mode 100644 index 00000000..2e2fd5f9 --- /dev/null +++ b/newsfragments/70.internal.rst @@ -0,0 +1 @@ +Do not invoke ``setup.py`` directly. Minor cleanup and refactors in newsfragment ``README.md`` and newsfragment validation. Minot cleanup in ``Makefile``. From af2dfa6560c9737fe202ac30a0b3511949406689 Mon Sep 17 00:00:00 2001 From: kclowes Date: Thu, 8 Dec 2022 15:19:05 -0700 Subject: [PATCH 41/94] Fix auto project template errors for MacOS (#71) --- .project-template/fill_template_vars.sh | 2 +- .project-template/refill_template_vars.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.project-template/fill_template_vars.sh b/.project-template/fill_template_vars.sh index 250f5512..157c89d3 100755 --- a/.project-template/fill_template_vars.sh +++ b/.project-template/fill_template_vars.sh @@ -33,7 +33,7 @@ _replace() { local find_cmd=(find "$PROJECT_ROOT" ! -perm -u=x ! -path '*/.git/*' ! -path '*/venv*/*' -type f) if [[ $(uname) == Darwin ]]; then - "${find_cmd[@]}" -exec sed -i '' "$1" {} + + LC_ALL=C "${find_cmd[@]}" -exec sed -i '' "$1" {} + else "${find_cmd[@]}" -exec sed -i "$1" {} + fi diff --git a/.project-template/refill_template_vars.sh b/.project-template/refill_template_vars.sh index 6e7943fb..70832d3d 100755 --- a/.project-template/refill_template_vars.sh +++ b/.project-template/refill_template_vars.sh @@ -1,2 +1,2 @@ -TEMPLATE_DIR=$(dirname $(readlink -f "$0")) +TEMPLATE_DIR=$(dirname "$0") <"$TEMPLATE_DIR/template_vars.txt" "$TEMPLATE_DIR/fill_template_vars.sh" From 642ae9627cd28fc9ba8c0c745375a0becbc202eb Mon Sep 17 00:00:00 2001 From: kclowes Date: Fri, 9 Dec 2022 11:25:55 -0700 Subject: [PATCH 42/94] Update isort CLI commands (#72) --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 00ca4463..23729cfc 100644 --- a/tox.ini +++ b/tox.ini @@ -6,9 +6,11 @@ envlist= [isort] combine_as_imports=True +force_grid_wrap=1 force_sort_within_sections=True known_third_party=hypothesis,pytest known_first_party= +multi_line_output=3 profile=black [flake8] From fe19f5a77a5fbba712da052ef3d25f187257ed3c Mon Sep 17 00:00:00 2001 From: pacrob Date: Mon, 3 Apr 2023 14:01:03 -0600 Subject: [PATCH 43/94] bump docs dependencies --- .readthedocs.yml | 5 +++++ docs/conf.py | 1 + newsfragments/70.internal.rst | 1 - setup.py | 6 +++--- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .readthedocs.yml delete mode 100644 newsfragments/70.internal.rst diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..ed4fab3c --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,5 @@ +version: 2 + +python: + install: + - requirements: requirements-docs.txt \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 8264b456..df931f1a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,7 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", + "sphinx_rtd_theme", ] # Add any paths that contain templates here, relative to this directory. diff --git a/newsfragments/70.internal.rst b/newsfragments/70.internal.rst deleted file mode 100644 index 2e2fd5f9..00000000 --- a/newsfragments/70.internal.rst +++ /dev/null @@ -1 +0,0 @@ -Do not invoke ``setup.py`` directly. Minor cleanup and refactors in newsfragment ``README.md`` and newsfragment validation. Minot cleanup in ``Makefile``. diff --git a/setup.py b/setup.py index 9dfbf788..04028b11 100644 --- a/setup.py +++ b/setup.py @@ -19,9 +19,9 @@ extras_require = { "black>=22", ], "doc": [ - "Sphinx>=1.6.5", - "sphinx_rtd_theme>=0.1.9", - "towncrier>=21", + "sphinx>=5.0.0", + "sphinx_rtd_theme>=1.0.0", + "towncrier>=21,<22", ], "dev": [ "bumpversion>=0.5.3", From 89e5d8ef9c637c9ac8fbefa11230b3beeb4a2e54 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 5 Apr 2023 18:00:29 -0600 Subject: [PATCH 44/94] new github issue and pr templates (#75) * new issue and pr templates --- .github/ISSUE_TEMPLATE.md | 38 ------------ .github/ISSUE_TEMPLATE/bug_report.yml | 70 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 ++ .github/ISSUE_TEMPLATE/feature_request.yml | 11 ++++ .github/PULL_REQUEST_TEMPLATE.md | 17 ------ .github/pull_request_template.md | 17 ++++++ 6 files changed, 103 insertions(+), 55 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 5ff4880e..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,38 +0,0 @@ - _If this is a bug report, please fill in the following sections. -If this is a feature request, delete and describe what you would like with examples._ - -## What was wrong? - -### Code that produced the error - -```py -CODE_TO_REPRODUCE -``` - -### Full error output - -```sh -ERROR_HERE -``` - -### Expected Result - -_This section may be deleted if the expectation is "don't crash"._ - -```sh -EXPECTED_RESULT -``` - -### Environment - -```sh -# run this: -$ python -m eth_utils - -# then copy the output here: -OUTPUT_HERE -``` - -## How can it be fixed? - -Fill this section in if you know how this could or should be fixed. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..5f1ddfd8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,70 @@ +name: Bug Report +description: File a bug report +labels: ["bug"] +body: + - type: markdown + attributes: + value: "## What was wrong" + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us what you expected to happen + validations: + required: true + - type: textarea + id: code-that-caused + attributes: + label: Code that produced the error + description: Formats to Python, no backticks needed + render: python + validations: + required: false + - type: textarea + id: error-output + attributes: + label: Full error output + description: Formats to shell, no backticks needed + render: shell + validations: + required: false + - type: markdown + attributes: + value: "## Potential Solutions" + - type: textarea + id: how-to-fix + attributes: + label: Fill this section in if you know how this could or should be fixed + description: Include any relevant examples or reference material + validations: + required: false + - type: input + id: lib-version + attributes: + label: Version + description: Which version of are you using? + placeholder: x.x.x + validations: + required: false + - type: input + id: py-version + attributes: + label: Python Version + description: Which version of Python are you using? + placeholder: x.x.x + validations: + required: false + - type: input + id: os + attributes: + label: Operating System + description: Which operating system are you using? + placeholder: osx/linux/win + validations: + required: false + - type: textarea + id: pip-freeze + attributes: + label: Output from pip-freeze + description: Run `pip-freeze` and paste the output below + render: shell diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..9853c794 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Questions about using ? + url: https://discord.gg/GHryRvPB84 + about: You can ask and answer usage questions on the Ethereum Python Community Discord diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..041c8fd1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,11 @@ +name: Feature Request +description: Request a new feature +labels: ["feature_request"] +body: + - type: textarea + id: feature-description + attributes: + label: What feature should we add? + description: Include any relevant examples or reference material + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 54da5516..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,17 +0,0 @@ -### What was wrong? - -Related to issue # - -### How was it fixed? - -### To-Do - -[//]: # (Stay ahead of things, add list items here!) -- [ ] Clean up commit history - -[//]: # (See: https://.readthedocs.io/en/latest/contributing.html#pull-requests) -- [ ] Add entry to the [release notes](https://github.com/ethereum//blob/master/newsfragments/README.md) - -#### Cute Animal Picture - -![put a cute animal picture link inside the parentheses]() diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..93fb355e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,17 @@ +### What was wrong? + +Related to Issue # +Closes Issue # + +### How was it fixed? + +### Todo: +- [ ] Clean up commit history + +- [ ] Add or update documentation related to these changes + +- [ ] Add entry to the [release notes](https://github.com/ethereum/web3.py/blob/master/newsfragments/README.md) + +#### Cute Animal Picture + +![Put a link to a cute animal picture inside the parenthesis-->]() \ No newline at end of file From 180777d7db608b8db4a271c5502d0568107d8931 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:22:12 -0600 Subject: [PATCH 45/94] convert bash scripts to py (#77) * convert bash scripts to py --- .project-template/fill_template_vars.py | 68 +++++++++++++++++++++++ .project-template/fill_template_vars.sh | 50 ----------------- .project-template/refill_template_vars.py | 39 +++++++++++++ .project-template/refill_template_vars.sh | 2 - 4 files changed, 107 insertions(+), 52 deletions(-) create mode 100644 .project-template/fill_template_vars.py delete mode 100755 .project-template/fill_template_vars.sh create mode 100644 .project-template/refill_template_vars.py delete mode 100755 .project-template/refill_template_vars.sh diff --git a/.project-template/fill_template_vars.py b/.project-template/fill_template_vars.py new file mode 100644 index 00000000..8d4bc35f --- /dev/null +++ b/.project-template/fill_template_vars.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +import os +import sys +import re +from pathlib import Path + + +def _find_files(project_root): + path_exclude_pattern = r"\.git($|\/)|venv|_build" + file_exclude_pattern = r"fill_template_vars\.py|\.swp$" + filepaths = [] + for dir_path, _dir_names, file_names in os.walk(project_root): + if not re.search(path_exclude_pattern, dir_path): + for file in file_names: + if not re.search(file_exclude_pattern, file): + filepaths.append(str(Path(dir_path, file))) + + return filepaths + + +def _replace(pattern, replacement, project_root): + print(f"Replacing values: {pattern}") + for file in _find_files(project_root): + with open(file) as f: + content = f.read() + content = re.sub(pattern, replacement, content) + with open(file, "w") as f: + f.write(content) + + +def main(): + project_root = Path(os.path.realpath(sys.argv[0])).parent.parent + + module_name = input("What is your python module name? ") + + pypi_input = input(f"What is your pypi package name? (default: {module_name}) ") + pypi_name = pypi_input or module_name + + repo_input = input(f"What is your github project name? (default: {pypi_name}) ") + repo_name = repo_input or pypi_name + + rtd_input = input( + f"What is your readthedocs.org project name? (default: {pypi_name}) " + ) + rtd_name = rtd_input or pypi_name + + project_input = input( + f"What is your project name (ex: at the top of the README)? (default: {repo_name}) " + ) + project_name = project_input or repo_name + + short_description = input("What is a one-liner describing the project? ") + + _replace("", module_name, project_root) + _replace("", pypi_name, project_root) + _replace("", repo_name, project_root) + _replace("", rtd_name, project_root) + _replace("", project_name, project_root) + _replace("", short_description, project_root) + + os.makedirs(project_root / module_name, exist_ok=True) + Path(project_root / module_name / "__init__.py").touch() + Path(project_root / module_name / "py.typed").touch() + + +if __name__ == "__main__": + main() diff --git a/.project-template/fill_template_vars.sh b/.project-template/fill_template_vars.sh deleted file mode 100755 index 157c89d3..00000000 --- a/.project-template/fill_template_vars.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset -set -o pipefail - -PROJECT_ROOT=$(dirname $(dirname $(python -c 'import os, sys; sys.stdout.write(os.path.realpath(sys.argv[1]))' "$0"))) - -echo "What is your python module name?" -read MODULE_NAME - -echo "What is your pypi package name? (default: $MODULE_NAME)" -read PYPI_INPUT -PYPI_NAME=${PYPI_INPUT:-$MODULE_NAME} - -echo "What is your github project name? (default: $PYPI_NAME)" -read REPO_INPUT -REPO_NAME=${REPO_INPUT:-$PYPI_NAME} - -echo "What is your readthedocs.org project name? (default: $PYPI_NAME)" -read RTD_INPUT -RTD_NAME=${RTD_INPUT:-$PYPI_NAME} - -echo "What is your project name (ex: at the top of the README)? (default: $REPO_NAME)" -read PROJECT_INPUT -PROJECT_NAME=${PROJECT_INPUT:-$REPO_NAME} - -echo "What is a one-liner describing the project?" -read SHORT_DESCRIPTION - -_replace() { - echo "Replacing values: $1" - local find_cmd=(find "$PROJECT_ROOT" ! -perm -u=x ! -path '*/.git/*' ! -path '*/venv*/*' -type f) - - if [[ $(uname) == Darwin ]]; then - LC_ALL=C "${find_cmd[@]}" -exec sed -i '' "$1" {} + - else - "${find_cmd[@]}" -exec sed -i "$1" {} + - fi -} -_replace "s//$MODULE_NAME/g" -_replace "s//$PYPI_NAME/g" -_replace "s//$REPO_NAME/g" -_replace "s//$RTD_NAME/g" -_replace "s//$PROJECT_NAME/g" -_replace "s//$SHORT_DESCRIPTION/g" - -mkdir -p "$PROJECT_ROOT/$MODULE_NAME" -touch "$PROJECT_ROOT/$MODULE_NAME/__init__.py" -touch "$PROJECT_ROOT/$MODULE_NAME/py.typed" diff --git a/.project-template/refill_template_vars.py b/.project-template/refill_template_vars.py new file mode 100644 index 00000000..03ab7c0c --- /dev/null +++ b/.project-template/refill_template_vars.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +import os +import sys +from pathlib import Path +import subprocess + + +def main(): + template_dir = Path(os.path.dirname(sys.argv[0])) + template_vars_file = template_dir / "template_vars.txt" + fill_template_vars_script = template_dir / "fill_template_vars.py" + + with open(template_vars_file, "r") as input_file: + content_lines = input_file.readlines() + + process = subprocess.Popen( + [sys.executable, str(fill_template_vars_script)], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + ) + + for line in content_lines: + process.stdin.write(line) + process.stdin.flush() + + stdout, stderr = process.communicate() + + if process.returncode != 0: + print(f"Error occurred: {stderr}") + sys.exit(1) + + print(stdout) + + +if __name__ == "__main__": + main() diff --git a/.project-template/refill_template_vars.sh b/.project-template/refill_template_vars.sh deleted file mode 100755 index 70832d3d..00000000 --- a/.project-template/refill_template_vars.sh +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE_DIR=$(dirname "$0") -<"$TEMPLATE_DIR/template_vars.txt" "$TEMPLATE_DIR/fill_template_vars.sh" From ffd6ad8b9fe4fce1ddd38d3212dca0b14b89a79e Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Mon, 10 Apr 2023 11:10:15 -0600 Subject: [PATCH 46/94] Various template default updates (#74) * bump versions in dependencies and ci builds * move tox to [dev] per issue #34 * move RTD deps pointer into .readthedocs.yml * unpin flake8 add flake8-bugbear to lint deps --- .circleci/config.yml | 43 ++++++++++++++++++++++++++++++++----------- .readthedocs.yml | 5 ++++- requirements-docs.txt | 1 - setup.py | 12 ++++++------ tox.ini | 22 +++++++++++++++------- 5 files changed, 57 insertions(+), 26 deletions(-) delete mode 100644 requirements-docs.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index db95741c..237a3f62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,60 +39,81 @@ jobs: docs: <<: *common docker: - - image: cimg/python:3.7 + - image: cimg/python:3.8 environment: TOXENV: docs - lint: + py37-lint: <<: *common docker: - image: cimg/python:3.7 environment: - TOXENV: lint + TOXENV: py37-lint py37-core: <<: *common docker: - image: cimg/python:3.7 environment: TOXENV: py37-core + py38-lint: + <<: *common + docker: + - image: cimg/python:3.8 + environment: + TOXENV: py38-lint py38-core: <<: *common docker: - image: cimg/python:3.8 environment: TOXENV: py38-core + py39-lint: + <<: *common + docker: + - image: cimg/python:3.9 + environment: + TOXENV: py39-lint py39-core: <<: *common docker: - image: cimg/python:3.9 environment: TOXENV: py39-core + py310-lint: + <<: *common + docker: + - image: cimg/python:3.10 + environment: + TOXENV: py310-lint py310-core: <<: *common docker: - image: cimg/python:3.10 environment: TOXENV: py310-core + py311-lint: + <<: *common + docker: + - image: cimg/python:3.11 + environment: + TOXENV: py311-lint py311-core: <<: *common docker: - image: cimg/python:3.11 environment: TOXENV: py311-core - pypy3-core: - <<: *common - docker: - - image: pypy - environment: - TOXENV: pypy3-core workflows: version: 2 test: jobs: - docs - - lint + - py37-lint + - py38-lint + - py39-lint + - py310-lint + - py311-lint - py37-core - py38-core - py39-core - py310-core - py311-core - - pypy3-core diff --git a/.readthedocs.yml b/.readthedocs.yml index ed4fab3c..959cf717 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -2,4 +2,7 @@ version: 2 python: install: - - requirements: requirements-docs.txt \ No newline at end of file + - method: pip + path: . + extra_requirements: + - doc diff --git a/requirements-docs.txt b/requirements-docs.txt deleted file mode 100644 index 1b49b744..00000000 --- a/requirements-docs.txt +++ /dev/null @@ -1 +0,0 @@ -[doc] diff --git a/setup.py b/setup.py index 04028b11..33f94256 100644 --- a/setup.py +++ b/setup.py @@ -7,14 +7,14 @@ from setuptools import ( extras_require = { "test": [ - "pytest>=6.2.5", - "pytest-xdist>=2.4.0,<3", - "tox==3.14.6", + "pytest>=7.0.0", + "pytest-xdist>=2.4.0", ], "lint": [ - "flake8==3.7.9", + "flake8>=5.0.0", + "flake8-bugbear>=22.0.0", "isort>=5.10.1", - "mypy==0.770", + "mypy==0.971", "pydocstyle>=5.0.0", "black>=22", ], @@ -26,6 +26,7 @@ extras_require = { "dev": [ "bumpversion>=0.5.3", "pytest-watch>=4.1.0", + "tox>=3.18.0", "wheel", "twine", "ipython", @@ -79,6 +80,5 @@ setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: Implementation :: PyPy", ], ) diff --git a/tox.ini b/tox.ini index 23729cfc..64147d4f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist= - py{37,38,39,310,311,py3}-core - lint + py{37,38,39,310,311}-core + py{37,38,39,310,311}-lint docs [isort] @@ -14,7 +14,7 @@ multi_line_output=3 profile=black [flake8] -max-line-length= 100 +max-line-length= 88 exclude= venv*,.tox,docs,build extend-ignore= E203 @@ -30,19 +30,27 @@ basepython = py39: python3.9 py310: python3.10 py311: python3.11 - pypy3: pypy3 extras= test docs: doc -whitelist_externals=make +allowlist_externals=make -[testenv:lint] +[common-lint] basepython=python extras=lint -whitelist_externals=black +allowlist_externals=black commands= mypy -p --config-file {toxinidir}/mypy.ini flake8 {toxinidir}/ {toxinidir}/tests isort --check-only --diff {toxinidir}/ {toxinidir}/tests pydocstyle --explain {toxinidir}/ {toxinidir}/tests black --check {toxinidir}/ {toxinidir}/docs {toxinidir}/tests {toxinidir}/setup.py + +[testenv:lint] +basepython: python +extras: {[common-lint]extras} +commands: {[common-lint]commands} + +[testenv:py{37,38,39,310,311}-lint] +extras: {[common-lint]extras} +commands: {[common-lint]commands} From 91d93efdd09189d841a733ce0329f234c73a908c Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Mon, 10 Apr 2023 11:11:35 -0600 Subject: [PATCH 47/94] remove outdated sections of README (#76) * remove gitter, testing setup, and pandoc sections, add quotes to dev install --- README.md | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/README.md b/README.md index 92b70bea..a3bc2c7c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # -[![Join the chat at https://gitter.im/ethereum/](https://badges.gitter.im/ethereum/.svg)](https://gitter.im/ethereum/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://circleci.com/gh/ethereum/.svg?style=shield)](https://circleci.com/gh/ethereum/) [![PyPI version](https://badge.fury.io/py/.svg)](https://badge.fury.io/py/) [![Python versions](https://img.shields.io/pypi/pyversions/.svg)](https://pypi.python.org/pypi/) @@ -37,43 +36,11 @@ git clone git@github.com:ethereum/.git cd virtualenv -p python3 venv . venv/bin/activate -pip install -e .[dev] -``` - -### Testing Setup - -During development, you might like to have tests run on every file save. - -Show flake8 errors on file change: - -```sh -# Test flake8 -when-changed -v -s -r -1 / tests/ -c "clear; flake8 tests && echo 'flake8 success' || echo 'error'" -``` - -Run multi-process tests in one command, but without color: - -```sh -# in the project root: -pytest --numprocesses=4 --looponfail --maxfail=1 -# the same thing, succinctly: -pytest -n 4 -f --maxfail=1 -``` - -Run in one thread, with color and desktop notifications: - -```sh -cd venv -ptw --onfail "notify-send -t 5000 'Test failure âš âš âš âš âš ' 'python 3 test on failed'" ../tests ../ +pip install -e ".[dev]" ``` ### Release setup -For Debian-like systems: -``` -apt install pandoc -``` - To release a new version: ```sh From 68d37fa50ff45980823c2259178d1339520870d8 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Mon, 10 Apr 2023 14:02:45 -0600 Subject: [PATCH 48/94] repin flake8 and misc updates (#79) * repin flake8, bump tox to >=4.0.0 as that's where whitelist was deprecated, misc updates --- .circleci/config.yml | 1 + .project-template/fill_template_vars.py | 2 +- MANIFEST.in | 1 - setup.py | 6 +++--- tox.ini | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 237a3f62..eb10bbe3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,6 +102,7 @@ jobs: - image: cimg/python:3.11 environment: TOXENV: py311-core + workflows: version: 2 test: diff --git a/.project-template/fill_template_vars.py b/.project-template/fill_template_vars.py index 8d4bc35f..bbbe2f7f 100644 --- a/.project-template/fill_template_vars.py +++ b/.project-template/fill_template_vars.py @@ -7,7 +7,7 @@ from pathlib import Path def _find_files(project_root): - path_exclude_pattern = r"\.git($|\/)|venv|_build" + path_exclude_pattern = r"\.git($|\/)|venv|_build|\.tox" file_exclude_pattern = r"fill_template_vars\.py|\.swp$" filepaths = [] for dir_path, _dir_names, file_names in os.walk(project_root): diff --git a/MANIFEST.in b/MANIFEST.in index e870a411..22c6165d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,5 @@ include LICENSE include README.md -include requirements-docs.txt global-include *.pyi diff --git a/setup.py b/setup.py index 33f94256..a18d9bc4 100644 --- a/setup.py +++ b/setup.py @@ -11,8 +11,8 @@ extras_require = { "pytest-xdist>=2.4.0", ], "lint": [ - "flake8>=5.0.0", - "flake8-bugbear>=22.0.0", + "flake8==6.0.0", + "flake8-bugbear==23.3.23", "isort>=5.10.1", "mypy==0.971", "pydocstyle>=5.0.0", @@ -26,7 +26,7 @@ extras_require = { "dev": [ "bumpversion>=0.5.3", "pytest-watch>=4.1.0", - "tox>=3.18.0", + "tox>=4.0.0", "wheel", "twine", "ipython", diff --git a/tox.ini b/tox.ini index 64147d4f..e5255baa 100644 --- a/tox.ini +++ b/tox.ini @@ -14,16 +14,16 @@ multi_line_output=3 profile=black [flake8] -max-line-length= 88 -exclude= venv*,.tox,docs,build -extend-ignore= E203 +max-line-length=88 +exclude=venv*,.tox,docs,build +extend-ignore=E203 [testenv] usedevelop=True commands= core: pytest {posargs:tests/core} docs: make check-docs -basepython = +basepython= docs: python py37: python3.7 py38: python3.8 From 431db897535642e3b4f1616e3cb393171ae1c063 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 12 Apr 2023 15:35:34 -0600 Subject: [PATCH 49/94] template cleanup following initial merge with py-evm (#80) * template cleanup following initial merge with py-evm * add flake8 pin comment * correct license years * add pin note to mypy --- .circleci/config.yml | 4 ++-- .project-template/fill_template_vars.py | 15 +++++++++------ LICENSE | 2 +- README.md | 3 ++- docs/_static/.suppress-sphinx-build-warning | 0 newsfragments/validate_files.py | 1 - pytest.ini | 5 ++++- setup.py | 8 ++++---- tests/core/conftest.py | 0 tests/core/test_import.py | 2 -- 10 files changed, 22 insertions(+), 18 deletions(-) delete mode 100644 docs/_static/.suppress-sphinx-build-warning delete mode 100644 tests/core/conftest.py diff --git a/.circleci/config.yml b/.circleci/config.yml index eb10bbe3..b4b822ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,7 +19,7 @@ common: &common when: on_fail - restore_cache: keys: - - cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} + - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - run: name: install dependencies command: pip install --user tox @@ -33,7 +33,7 @@ common: &common - ~/.cache/pip - ~/.local - ./eggs - key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} + key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} jobs: docs: diff --git a/.project-template/fill_template_vars.py b/.project-template/fill_template_vars.py index bbbe2f7f..52ceb02b 100644 --- a/.project-template/fill_template_vars.py +++ b/.project-template/fill_template_vars.py @@ -7,7 +7,7 @@ from pathlib import Path def _find_files(project_root): - path_exclude_pattern = r"\.git($|\/)|venv|_build|\.tox" + path_exclude_pattern = r"\.git($|\/)|venv|_build" file_exclude_pattern = r"fill_template_vars\.py|\.swp$" filepaths = [] for dir_path, _dir_names, file_names in os.walk(project_root): @@ -22,11 +22,14 @@ def _find_files(project_root): def _replace(pattern, replacement, project_root): print(f"Replacing values: {pattern}") for file in _find_files(project_root): - with open(file) as f: - content = f.read() - content = re.sub(pattern, replacement, content) - with open(file, "w") as f: - f.write(content) + try: + with open(file) as f: + content = f.read() + content = re.sub(pattern, replacement, content) + with open(file, "w") as f: + f.write(content) + except UnicodeDecodeError: + pass def main(): diff --git a/LICENSE b/LICENSE index 17bc694e..b76b24d4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 The Ethereum Foundation +Copyright (c) 2019-2023 The Ethereum Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a3bc2c7c..86b1e410 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # +[![Join the conversation on Discord](https://img.shields.io/discord/809793915578089484?color=blue&label=chat&logo=discord&logoColor=white)](https://discord.gg/GHryRvPB84) [![Build Status](https://circleci.com/gh/ethereum/.svg?style=shield)](https://circleci.com/gh/ethereum/) [![PyPI version](https://badge.fury.io/py/.svg)](https://badge.fury.io/py/) [![Python versions](https://img.shields.io/pypi/pyversions/.svg)](https://pypi.python.org/pypi/) -[![Docs build](https://readthedocs.org/projects//badge/?version=latest)](http://.readthedocs.io/en/latest/?badge=latest) +[![Docs build](https://readthedocs.org/projects//badge/?version=latest)](https://.readthedocs.io/en/latest/?badge=latest) diff --git a/docs/_static/.suppress-sphinx-build-warning b/docs/_static/.suppress-sphinx-build-warning deleted file mode 100644 index e69de29b..00000000 diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index 684c7987..c4bd29f6 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -3,7 +3,6 @@ # Towncrier silently ignores files that do not match the expected ending. # We use this script to ensure we catch these as errors in CI. -import os import pathlib import sys diff --git a/pytest.ini b/pytest.ini index ae90934f..95a6b2d6 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,9 @@ [pytest] -addopts= -v --showlocals --durations 10 +addopts= -v --showlocals --durations 10 xfail_strict=true +log_format = %(levelname)8s %(asctime)s %(filename)20s %(message)s +log_date_format = %m-%d %H:%M:%S +timeout = 300 [pytest-watch] runner= pytest --failed-first --maxfail=1 --no-success-flaky-report diff --git a/setup.py b/setup.py index a18d9bc4..c359d0be 100644 --- a/setup.py +++ b/setup.py @@ -11,11 +11,11 @@ extras_require = { "pytest-xdist>=2.4.0", ], "lint": [ - "flake8==6.0.0", - "flake8-bugbear==23.3.23", + "flake8==6.0.0", # flake8 claims semver but adds new warnings at minor releases, leave it pinned. + "flake8-bugbear==23.3.23", # flake8-bugbear does not follow semver, leave it pinned. "isort>=5.10.1", - "mypy==0.971", - "pydocstyle>=5.0.0", + "mypy==0.971", # mypy does not follow semver, leave it pinned. + "pydocstyle>=6.0.0", "black>=22", ], "doc": [ diff --git a/tests/core/conftest.py b/tests/core/conftest.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/core/test_import.py b/tests/core/test_import.py index f146ae79..07b2a18e 100644 --- a/tests/core/test_import.py +++ b/tests/core/test_import.py @@ -1,4 +1,2 @@ - - def test_import(): import # noqa: F401 From 3314247037b6e686f372aae98ff0f32cffb5b48a Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Thu, 13 Apr 2023 12:47:12 -0600 Subject: [PATCH 50/94] apply template updates found following merge with eth-typing (#81) * apply template updates found following merge with eth-typing * add build as a dev dependency * remove timeout from pytest.ini, it doesn't do anything without pytest-timeout as a dep --- .github/pull_request_template.md | 4 ++-- docs/conf.py | 2 +- pyproject.toml | 2 +- pytest.ini | 3 +-- setup.py | 5 ++--- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 93fb355e..b3298852 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ ### What was wrong? Related to Issue # -Closes Issue # +Closes # ### How was it fixed? @@ -10,7 +10,7 @@ Closes Issue # - [ ] Add or update documentation related to these changes -- [ ] Add entry to the [release notes](https://github.com/ethereum/web3.py/blob/master/newsfragments/README.md) +- [ ] Add entry to the [release notes](https://github.com/ethereum//blob/master/newsfragments/README.md) #### Cute Animal Picture diff --git a/docs/conf.py b/docs/conf.py index df931f1a..6469208c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,7 +55,7 @@ master_doc = "index" # General information about the project. project = "" -copyright = "2020, The Ethereum Foundation" +copyright = "2019-2023, The Ethereum Foundation" __version__ = setup_version # The version info for the project you're documenting, acts as replacement for diff --git a/pyproject.toml b/pyproject.toml index 31433140..73483504 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.towncrier] -# Read https://github.com/ethereum//newsfragments/README.md for instructions +# Read https://github.com/ethereum//blob/master/newsfragments/README.md for instructions package = "" filename = "docs/release_notes.rst" directory = "newsfragments" diff --git a/pytest.ini b/pytest.ini index 95a6b2d6..fd5ea7cb 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,9 +1,8 @@ [pytest] -addopts= -v --showlocals --durations 10 +addopts= -v --showlocals --durations 10 xfail_strict=true log_format = %(levelname)8s %(asctime)s %(filename)20s %(message)s log_date_format = %m-%d %H:%M:%S -timeout = 300 [pytest-watch] runner= pytest --failed-first --maxfail=1 --no-success-flaky-report diff --git a/setup.py b/setup.py index c359d0be..e4d82fac 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,7 @@ extras_require = { "bumpversion>=0.5.3", "pytest-watch>=4.1.0", "tox>=4.0.0", + "build>=0.9.0", "wheel", "twine", "ipython", @@ -59,7 +60,7 @@ setup( install_requires=[ "eth-utils>=2", ], - python_requires=">=3.7, <4", + python_requires=">=3.7.2, <4", extras_require=extras_require, py_modules=[""], license="MIT", @@ -72,8 +73,6 @@ setup( "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", - "Operating System :: MacOS", - "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", From 484b6b55cd09757c9721fcaa50e6c39d8cee34af Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 19 Apr 2023 14:00:40 -0600 Subject: [PATCH 51/94] Template updates post ssz and ethabi (#82) * add updates found when merging template with py-ssz and eth-abi * add wheel and wheel-windows to ci and reorg --- .circleci/config.yml | 142 +++++++++++++++++++++++--------- .gitignore | 9 +- docs/conf.py | 2 +- newsfragments/README.md | 15 ++-- newsfragments/validate_files.py | 1 + pyproject.toml | 27 +++--- setup.py | 4 +- tox.ini | 31 +++++++ 8 files changed, 170 insertions(+), 61 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b4b822ad..0eb6f4ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2.0 +version: 2.1 # heavily inspired by https://raw.githubusercontent.com/pinax/pinax-wiki/6bd2a99ab6f702e300d708532a6d1d9aa638b9f8/.circleci/config.yml @@ -22,7 +22,7 @@ common: &common - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - run: name: install dependencies - command: pip install --user tox + command: python -m pip install --user tox - run: name: run tox command: python -m tox -r @@ -35,6 +35,30 @@ common: &common - ./eggs key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} +orbs: + win: circleci/windows@5.0.0 + +windows_steps: &windows_steps + executor: + name: win/default + shell: bash.exe + working_directory: C:\Users\circleci\project\ + 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 --user tox + - run: + name: run tox + command: python -m tox -r + - save_cache: + paths: + - .tox + key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} + jobs: docs: <<: *common @@ -42,60 +66,31 @@ jobs: - image: cimg/python:3.8 environment: TOXENV: docs - py37-lint: - <<: *common - docker: - - image: cimg/python:3.7 - environment: - TOXENV: py37-lint + py37-core: <<: *common docker: - image: cimg/python:3.7 environment: TOXENV: py37-core - py38-lint: - <<: *common - docker: - - image: cimg/python:3.8 - environment: - TOXENV: py38-lint py38-core: <<: *common docker: - image: cimg/python:3.8 environment: TOXENV: py38-core - py39-lint: - <<: *common - docker: - - image: cimg/python:3.9 - environment: - TOXENV: py39-lint py39-core: <<: *common docker: - image: cimg/python:3.9 environment: TOXENV: py39-core - py310-lint: - <<: *common - docker: - - image: cimg/python:3.10 - environment: - TOXENV: py310-lint py310-core: <<: *common docker: - image: cimg/python:3.10 environment: TOXENV: py310-core - py311-lint: - <<: *common - docker: - - image: cimg/python:3.11 - environment: - TOXENV: py311-lint py311-core: <<: *common docker: @@ -103,18 +98,91 @@ jobs: environment: TOXENV: py311-core + py37-lint: + <<: *common + docker: + - image: cimg/python:3.7 + environment: + TOXENV: py37-lint + py38-lint: + <<: *common + docker: + - image: cimg/python:3.8 + environment: + TOXENV: py38-lint + py39-lint: + <<: *common + docker: + - image: cimg/python:3.9 + environment: + TOXENV: py39-lint + py310-lint: + <<: *common + docker: + - image: cimg/python:3.10 + environment: + TOXENV: py310-lint + py311-lint: + <<: *common + docker: + - image: cimg/python:3.11 + environment: + TOXENV: py311-lint + + py37-wheel: + <<: *common + docker: + - image: cimg/python:3.7 + environment: + TOXENV: py37-wheel + py38-wheel: + <<: *common + docker: + - image: cimg/python:3.8 + environment: + TOXENV: py38-wheel + py39-wheel: + <<: *common + docker: + - image: cimg/python:3.9 + environment: + TOXENV: py39-wheel + py310-wheel: + <<: *common + docker: + - image: cimg/python:3.10 + environment: + TOXENV: py310-wheel + py311-wheel: + <<: *common + docker: + - image: cimg/python:3.11 + environment: + TOXENV: py311-wheel + + py311-wheel-windows: + <<: *windows_steps + environment: + TOXENV: py311-wheel-windows + workflows: version: 2 test: jobs: - docs - - py37-lint - - py38-lint - - py39-lint - - py310-lint - - py311-lint - py37-core - py38-core - py39-core - py310-core - py311-core + - py37-lint + - py38-lint + - py39-lint + - py310-lint + - py311-lint + - py37-wheel + - py38-wheel + - py39-wheel + - py310-wheel + - py311-wheel + - py311-wheel-windows diff --git a/.gitignore b/.gitignore index 011ac1c8..e0e2be56 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,12 @@ logs # mypy .mypy_cache +# macOS +.DS_Store + +# pyenv +.python-version + # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # For a more precise, explicit template, see: # https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 @@ -83,9 +89,6 @@ out/ ## Plugin-specific files: -### mpeltonen/sbt-idea plugin -.idea_modules/ - ### JIRA plugin atlassian-ide-plugin.xml diff --git a/docs/conf.py b/docs/conf.py index 6469208c..db3f3492 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -141,7 +141,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 diff --git a/newsfragments/README.md b/newsfragments/README.md index e4740e4b..0e9b74a2 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -8,14 +8,15 @@ relevant to people working on the code itself.) Each file should be named like `..rst`, where `` is an issue number, and `` is one of: -* `feature` -* `bugfix` -* `performance` -* `doc` -* `internal` -* `removal` -* `misc` * `breaking` +* `bugfix` +* `deprecation`, +* `doc` +* `feature` +* `internal` +* `misc` +* `performance` +* `removal` So for example: `123.feature.rst`, `456.bugfix.rst` diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index c4bd29f6..edd5e050 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -9,6 +9,7 @@ import sys ALLOWED_EXTENSIONS = { ".breaking.rst", ".bugfix.rst", + ".deprecation.rst", ".doc.rst", ".feature.rst", ".internal.rst", diff --git a/pyproject.toml b/pyproject.toml index 73483504..64f8b8af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,12 @@ package = "" filename = "docs/release_notes.rst" directory = "newsfragments" underlines = ["-", "~", "^"] -title_format = " v{version} ({project_date})" +title_format = " v{version} ({project_date})" issue_format = "`#{issue} /issues/{issue}>`__" [[tool.towncrier.type]] -directory = "feature" -name = "Features" +directory = "breaking" +name = "Breaking Changes" showcontent = true [[tool.towncrier.type]] @@ -18,8 +18,8 @@ name = "Bugfixes" showcontent = true [[tool.towncrier.type]] -directory = "performance" -name = "Performance improvements" +directory = "deprecation" +name = "Deprecations" showcontent = true [[tool.towncrier.type]] @@ -28,21 +28,26 @@ name = "Improved Documentation" showcontent = true [[tool.towncrier.type]] -directory = "removal" -name = "Deprecations and Removals" +directory = "feature" +name = "Features" showcontent = true [[tool.towncrier.type]] directory = "internal" -name = "Internal Changes - for Contributors" +name = "Internal Changes - for Contributors" showcontent = true [[tool.towncrier.type]] directory = "misc" -name = "Miscellaneous changes" +name = "Miscellaneous Changes" showcontent = false [[tool.towncrier.type]] -directory = "breaking" -name = "Breaking changes" +directory = "performance" +name = "Performance Improvements" +showcontent = true + +[[tool.towncrier.type]] +directory = "removal" +name = "Removals" showcontent = true diff --git a/setup.py b/setup.py index e4d82fac..00994c25 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ extras_require = { "isort>=5.10.1", "mypy==0.971", # mypy does not follow semver, leave it pinned. "pydocstyle>=6.0.0", - "black>=22", + "black>=23", ], "doc": [ "sphinx>=5.0.0", @@ -60,7 +60,7 @@ setup( install_requires=[ "eth-utils>=2", ], - python_requires=">=3.7.2, <4", + python_requires=">=3.7, <4", extras_require=extras_require, py_modules=[""], license="MIT", diff --git a/tox.ini b/tox.ini index e5255baa..35503e26 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,8 @@ envlist= py{37,38,39,310,311}-core py{37,38,39,310,311}-lint + py{37,38,39,310,311}-wheel + py311-wheel-windows docs [isort] @@ -54,3 +56,32 @@ commands: {[common-lint]commands} [testenv:py{37,38,39,310,311}-lint] extras: {[common-lint]extras} commands: {[common-lint]commands} + +[testenv:py{37,38,39,310,311}-wheel] +deps= + wheel + build[virtualenv] +allowlist_externals= + /bin/rm + /bin/bash +commands= + python -m pip install --upgrade pip + /bin/rm -rf build dist + python -m build + /bin/bash -c 'python -m pip install --upgrade "$(ls dist/-*-py3-none-any.whl)" --progress-bar off' + python -c "import " +skip_install=true + +[testenv:py311-wheel-windows] +deps= + wheel + build[virtualenv] +allowlist_externals= + bash.exe +commands= + python -m pip install --upgrade pip + bash.exe -c "rm -rf build dist" + python -m build + bash.exe -c 'python -m pip install --upgrade "$(ls dist/-*-py3-none-any.whl)" --progress-bar off' + python -c "import " +skip_install=true From 28dbedcbfad5b03f50505e0d990c4d63dba27c36 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:21:09 -0600 Subject: [PATCH 52/94] upgrade pip and remove --user from tox install during ci (#85) --- .circleci/config.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0eb6f4ae..b00ff6b8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,9 @@ common: &common - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - run: name: install dependencies - command: python -m pip install --user tox + command: | + python -m pip install --upgrade pip + python -m pip install tox - run: name: run tox command: python -m tox -r @@ -50,7 +52,9 @@ windows_steps: &windows_steps - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - run: name: install dependencies - command: python -m pip install --user tox + command: | + python -m pip install --upgrade pip + python -m pip install tox - run: name: run tox command: python -m tox -r From da9b95f37c2b9c33582e430d0e7b4d858dec2212 Mon Sep 17 00:00:00 2001 From: Marc Garreau <3621728+wolovim@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:45:59 -0600 Subject: [PATCH 53/94] introduce contributing doc + main branch convention (#84) --- Makefile | 4 +- README.md | 11 +- docs/contributing.rst | 161 ++++++++++++++++++++++++ docs/fragments/virtualenv_explainer.rst | 25 ++++ docs/index.rst | 6 + pyproject.toml | 2 +- 6 files changed, 200 insertions(+), 9 deletions(-) create mode 100644 docs/contributing.rst create mode 100644 docs/fragments/virtualenv_explainer.rst diff --git a/Makefile b/Makefile index a8af4eba..5f731893 100644 --- a/Makefile +++ b/Makefile @@ -74,8 +74,8 @@ notes: check-bump git commit -m "Compile release notes" release: check-bump clean - # require that you be on a branch that's linked to upstream/master - git status -s -b | head -1 | grep "\.\.upstream/master" + # require that you be on a branch that's linked to upstream/main + git status -s -b | head -1 | grep "\.\.upstream/main" # verify that docs build correctly ./newsfragments/validate_files.py is-empty make build-docs diff --git a/README.md b/README.md index 86b1e410..7d126455 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![PyPI version](https://badge.fury.io/py/.svg)](https://badge.fury.io/py/) [![Python versions](https://img.shields.io/pypi/pyversions/.svg)](https://pypi.python.org/pypi/) [![Docs build](https://readthedocs.org/projects//badge/?version=latest)](https://.readthedocs.io/en/latest/?badge=latest) - @@ -23,10 +22,10 @@ If you would like to hack on , please check out the [Snake Charmers Tactical Manual](https://github.com/ethereum/snake-charmers-tactical-manual) for information on how we do: -- Testing -- Pull Requests -- Code Style -- Documentation +- Testing +- Pull Requests +- Code Style +- Documentation ### Development Environment Setup @@ -55,7 +54,7 @@ The version format for this repo is `{major}.{minor}.{patch}` for stable, and To issue the next version in line, specify which part to bump, like `make release bump=minor` or `make release bump=devnum`. This is typically done from the -master branch, except when releasing a beta (in which case the beta is released from master, +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). If you are in a beta version, `make release bump=stage` will switch to a stable. diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 00000000..926b87ce --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1,161 @@ +Contributing +------------ + +Thank you for your interest in contributing! We welcome all contributions no matter their size. Please read along to learn how to get started. + + +Setting the stage +~~~~~~~~~~~~~~~~~ + +First, we need to clone the repository: + +.. code:: sh + + $ git clone https://github.com/ethereum/.git + + +.. include:: /fragments/virtualenv_explainer.rst + +After we have activated our virtual environment, we need to install all dependencies that are needed to run, develop, and test. +This is as easy as navigating to the directory and running: + +.. code:: sh + + pip install -e ".[dev]" + + +Running the tests +~~~~~~~~~~~~~~~~~ + +A great way to explore the code base is to run the tests. + +We can run all tests with: + +.. code:: sh + + pytest tests + +However, you may just want to run a subset instead, like: + +.. code:: sh + + pytest tests/core/padding-utils/test_padding.py + + +We can also install ``tox`` to run the full test suite which also covers things like testing the code against different Python versions, linting etc. + +It is important to understand that each Pull Request must pass the full test suite as part of the CI check, hence it is often convenient to have ``tox`` installed locally as well. + + +Code Style +~~~~~~~~~~ + +When multiple people are working on the same body of code, it is important that they write code that conforms to a similar style. It often doesn't matter as much which style, but rather that they conform to one style. + +To ensure your contribution conforms to the style being used in this project, we encourage you to read our `style guide `_. + + +Type Hints +~~~~~~~~~~ + +This codebase uses `type hints `_. Type hints make it easy to prevent certain types of bugs, enable richer tooling, and enhance the documentation, making the code easier to follow. + +All new code is required to land with type hints, with the exception of test code that is not expected to use type hints. + +All parameters, as well as the return type of defs, are expected to be typed, with the exception of ``self`` and ``cls`` as seen in the following example. + +.. code:: python + + def __init__(self, wrapped_db: DatabaseAPI) -> None: + self.wrapped_db = wrapped_db + self.reset() + + +Documentation +~~~~~~~~~~~~~ + +Good documentation will lead to quicker adoption and happier users. Please check out our guide +on `how to create documentation for the Python Ethereum ecosystem `_. + + +Pull Requests +~~~~~~~~~~~~~ + +It's a good idea to make pull requests early on. A pull request represents the +start of a discussion, and doesn't necessarily need to be the final, finished +submission. + +GitHub's documentation for working on pull requests is `available here `_. + +Once you've made a pull request, take a look at the Circle CI build status in the +GitHub interface and make sure all tests are passing. In general pull requests that +do not pass the CI build yet won't get reviewed unless explicitly requested. + +If the pull request introduces changes that should be reflected in the release notes, +please add a `newsfragment` file as explained +`here /blob/main/newsfragments/README.md>`_. + +If possible, the change to the release notes file should be included in the commit that introduces the +feature or bugfix. + + +Releasing +~~~~~~~~~ + + +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 + + + # Preview the upcoming release notes + 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$$ + + +Which version part to bump +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +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). + +During a release, specify which part to bump, like +``make release bump=minor`` or ``make release bump=devnum``. + +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 devnum"`` diff --git a/docs/fragments/virtualenv_explainer.rst b/docs/fragments/virtualenv_explainer.rst new file mode 100644 index 00000000..ecc6d4c6 --- /dev/null +++ b/docs/fragments/virtualenv_explainer.rst @@ -0,0 +1,25 @@ +**Optional:** Often, the best way to guarantee a clean Python 3 environment is with +`virtualenv `_. If we don't have ``virtualenv`` installed +already, we first need to install it via pip. + +.. code:: sh + + pip install virtualenv + +Then, we can initialize a new virtual environment ``venv``, like: + +.. code:: sh + + virtualenv -p python3 venv + +This creates a new directory ``venv`` where packages are installed isolated from any other global +packages. + +To activate the virtual directory we have to *source* it + +.. code:: sh + + . venv/bin/activate + + # and when leaving this context: + deactivate diff --git a/docs/index.rst b/docs/index.rst index 89815efa..4f1f0b31 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,6 +11,12 @@ Contents release_notes + +.. toctree:: + :maxdepth: 1 + :caption: Community + + contributing Indices and tables diff --git a/pyproject.toml b/pyproject.toml index 64f8b8af..aa7ddcd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.towncrier] -# Read https://github.com/ethereum//blob/master/newsfragments/README.md for instructions +# Read https://github.com/ethereum//blob/main/newsfragments/README.md for instructions package = "" filename = "docs/release_notes.rst" directory = "newsfragments" From cc24e7e468d652f59ac9f484f9600460f6b8a295 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Tue, 25 Apr 2023 15:20:55 -0600 Subject: [PATCH 54/94] update tox calls to use run, update all pip calls to use python -m (#86) --- .circleci/config.yml | 4 ++-- .github/ISSUE_TEMPLATE/bug_report.yml | 6 ++++-- Makefile | 4 ++-- README.md | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b00ff6b8..791a433d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,7 @@ common: &common python -m pip install tox - run: name: run tox - command: python -m tox -r + command: python -m tox run -r - save_cache: paths: - .hypothesis @@ -57,7 +57,7 @@ windows_steps: &windows_steps python -m pip install tox - run: name: run tox - command: python -m tox -r + command: python -m tox run -r - save_cache: paths: - .tox diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5f1ddfd8..a0c80c07 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -65,6 +65,8 @@ body: - type: textarea id: pip-freeze attributes: - label: Output from pip-freeze - description: Run `pip-freeze` and paste the output below + label: Output from `pip freeze` + description: Run `python -m pip freeze` and paste the output below render: shell + validations: + required: false diff --git a/Makefile b/Makefile index 5f731893..b674c553 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ clean-pyc: find . -name '__pycache__' -exec rm -rf {} + lint: - tox -e lint + tox run -e lint lint-roll: isort tests @@ -39,7 +39,7 @@ test: pytest tests test-all: - tox + tox run build-docs: sphinx-apidoc -o docs/ . setup.py "*conftest*" diff --git a/README.md b/README.md index 7d126455..b3be7487 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Read more in the [documentation on ReadTheDocs](https://.readthedocs.i ## Quickstart ```sh -pip install +python -m pip install ``` ## Developer Setup @@ -36,7 +36,7 @@ git clone git@github.com:ethereum/.git cd virtualenv -p python3 venv . venv/bin/activate -pip install -e ".[dev]" +python -m pip install -e ".[dev]" ``` ### Release setup From 1f5fc7208bbd7d86a35ef466cf58d5129d4852f9 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Thu, 27 Apr 2023 14:02:54 -0600 Subject: [PATCH 55/94] Remove testall (#88) * remove testall because it doesnt work --- .github/pull_request_template.md | 2 +- Makefile | 4 ---- newsfragments/README.md | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b3298852..2ff2e071 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -10,7 +10,7 @@ Closes # - [ ] Add or update documentation related to these changes -- [ ] Add entry to the [release notes](https://github.com/ethereum//blob/master/newsfragments/README.md) +- [ ] Add entry to the [release notes](https://github.com/ethereum//blob/main/newsfragments/README.md) #### Cute Animal Picture diff --git a/Makefile b/Makefile index b674c553..67a75732 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ help: @echo "lint - check style with flake8" @echo "lint-roll - automatically fix problems with isort, flake8, etc" @echo "test - run tests quickly with the default Python" - @echo "testall - run tests on every Python version with tox" @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)" @@ -38,9 +37,6 @@ lint-roll: test: pytest tests -test-all: - tox run - build-docs: sphinx-apidoc -o docs/ . setup.py "*conftest*" $(MAKE) -C docs clean diff --git a/newsfragments/README.md b/newsfragments/README.md index 0e9b74a2..93ae2c0a 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -26,4 +26,4 @@ then open up the PR first and use the PR number for the newsfragment. Note that the `towncrier` tool will automatically reflow your text, so don't try to do any fancy formatting. Run `towncrier build --draft` to get a preview of what the release notes entry - will look like in the final release notes. +will look like in the final release notes. From 2a1c8f83b49c97c57838098fef30f3b59baf755a Mon Sep 17 00:00:00 2001 From: pacrob Date: Mon, 1 May 2023 16:25:14 -0600 Subject: [PATCH 56/94] minor formatting updates, remove contributing docs --- README.md | 8 +- docs/contributing.rst | 161 ------------------------ docs/fragments/virtualenv_explainer.rst | 25 ---- docs/index.rst | 6 - newsfragments/README.md | 2 +- 5 files changed, 5 insertions(+), 197 deletions(-) delete mode 100644 docs/contributing.rst delete mode 100644 docs/fragments/virtualenv_explainer.rst diff --git a/README.md b/README.md index b3be7487..5acd94db 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ If you would like to hack on , please check out the [Snake Charmers Tactical Manual](https://github.com/ethereum/snake-charmers-tactical-manual) for information on how we do: -- Testing -- Pull Requests -- Code Style -- Documentation +- Testing +- Pull Requests +- Code Style +- Documentation ### Development Environment Setup diff --git a/docs/contributing.rst b/docs/contributing.rst deleted file mode 100644 index 926b87ce..00000000 --- a/docs/contributing.rst +++ /dev/null @@ -1,161 +0,0 @@ -Contributing ------------- - -Thank you for your interest in contributing! We welcome all contributions no matter their size. Please read along to learn how to get started. - - -Setting the stage -~~~~~~~~~~~~~~~~~ - -First, we need to clone the repository: - -.. code:: sh - - $ git clone https://github.com/ethereum/.git - - -.. include:: /fragments/virtualenv_explainer.rst - -After we have activated our virtual environment, we need to install all dependencies that are needed to run, develop, and test. -This is as easy as navigating to the directory and running: - -.. code:: sh - - pip install -e ".[dev]" - - -Running the tests -~~~~~~~~~~~~~~~~~ - -A great way to explore the code base is to run the tests. - -We can run all tests with: - -.. code:: sh - - pytest tests - -However, you may just want to run a subset instead, like: - -.. code:: sh - - pytest tests/core/padding-utils/test_padding.py - - -We can also install ``tox`` to run the full test suite which also covers things like testing the code against different Python versions, linting etc. - -It is important to understand that each Pull Request must pass the full test suite as part of the CI check, hence it is often convenient to have ``tox`` installed locally as well. - - -Code Style -~~~~~~~~~~ - -When multiple people are working on the same body of code, it is important that they write code that conforms to a similar style. It often doesn't matter as much which style, but rather that they conform to one style. - -To ensure your contribution conforms to the style being used in this project, we encourage you to read our `style guide `_. - - -Type Hints -~~~~~~~~~~ - -This codebase uses `type hints `_. Type hints make it easy to prevent certain types of bugs, enable richer tooling, and enhance the documentation, making the code easier to follow. - -All new code is required to land with type hints, with the exception of test code that is not expected to use type hints. - -All parameters, as well as the return type of defs, are expected to be typed, with the exception of ``self`` and ``cls`` as seen in the following example. - -.. code:: python - - def __init__(self, wrapped_db: DatabaseAPI) -> None: - self.wrapped_db = wrapped_db - self.reset() - - -Documentation -~~~~~~~~~~~~~ - -Good documentation will lead to quicker adoption and happier users. Please check out our guide -on `how to create documentation for the Python Ethereum ecosystem `_. - - -Pull Requests -~~~~~~~~~~~~~ - -It's a good idea to make pull requests early on. A pull request represents the -start of a discussion, and doesn't necessarily need to be the final, finished -submission. - -GitHub's documentation for working on pull requests is `available here `_. - -Once you've made a pull request, take a look at the Circle CI build status in the -GitHub interface and make sure all tests are passing. In general pull requests that -do not pass the CI build yet won't get reviewed unless explicitly requested. - -If the pull request introduces changes that should be reflected in the release notes, -please add a `newsfragment` file as explained -`here /blob/main/newsfragments/README.md>`_. - -If possible, the change to the release notes file should be included in the commit that introduces the -feature or bugfix. - - -Releasing -~~~~~~~~~ - - -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 - - - # Preview the upcoming release notes - 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$$ - - -Which version part to bump -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -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). - -During a release, specify which part to bump, like -``make release bump=minor`` or ``make release bump=devnum``. - -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 devnum"`` diff --git a/docs/fragments/virtualenv_explainer.rst b/docs/fragments/virtualenv_explainer.rst deleted file mode 100644 index ecc6d4c6..00000000 --- a/docs/fragments/virtualenv_explainer.rst +++ /dev/null @@ -1,25 +0,0 @@ -**Optional:** Often, the best way to guarantee a clean Python 3 environment is with -`virtualenv `_. If we don't have ``virtualenv`` installed -already, we first need to install it via pip. - -.. code:: sh - - pip install virtualenv - -Then, we can initialize a new virtual environment ``venv``, like: - -.. code:: sh - - virtualenv -p python3 venv - -This creates a new directory ``venv`` where packages are installed isolated from any other global -packages. - -To activate the virtual directory we have to *source* it - -.. code:: sh - - . venv/bin/activate - - # and when leaving this context: - deactivate diff --git a/docs/index.rst b/docs/index.rst index 4f1f0b31..472a482a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,12 +12,6 @@ Contents release_notes -.. toctree:: - :maxdepth: 1 - :caption: Community - - contributing - Indices and tables ------------------ diff --git a/newsfragments/README.md b/newsfragments/README.md index 93ae2c0a..2ef923e8 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -10,7 +10,7 @@ Each file should be named like `..rst`, where * `breaking` * `bugfix` -* `deprecation`, +* `deprecation` * `doc` * `feature` * `internal` From f802bd04398df7f915916dabbc1ba2b129796be0 Mon Sep 17 00:00:00 2001 From: pacrob Date: Wed, 3 May 2023 10:53:12 -0600 Subject: [PATCH 57/94] bump sphinx version and set py version rtd uses to 3.8 --- .readthedocs.yml | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 959cf717..bb96642a 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,5 +1,13 @@ version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.8" + +sphinx: + configuration: docs/conf.py + python: install: - method: pip diff --git a/setup.py b/setup.py index 00994c25..dc1a39f1 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ extras_require = { "black>=23", ], "doc": [ - "sphinx>=5.0.0", + "sphinx>=6.0.0", "sphinx_rtd_theme>=1.0.0", "towncrier>=21,<22", ], From 23a192f62c6ad5bff2beb54284652c215971dfa6 Mon Sep 17 00:00:00 2001 From: pacrob Date: Wed, 3 May 2023 14:05:29 -0600 Subject: [PATCH 58/94] change references to doc to all be docs --- .readthedocs.yml | 2 +- docs/conf.py | 2 +- newsfragments/README.md | 2 +- newsfragments/validate_files.py | 2 +- pyproject.toml | 2 +- setup.py | 4 ++-- tox.ini | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index bb96642a..50b9b384 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -13,4 +13,4 @@ python: - method: pip path: . extra_requirements: - - doc + - docs diff --git a/docs/conf.py b/docs/conf.py index db3f3492..1d0560df 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -190,7 +190,7 @@ html_theme = "sphinx_rtd_theme" # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = "doc" +htmlhelp_basename = "docs" # -- Options for LaTeX output --------------------------------------------- diff --git a/newsfragments/README.md b/newsfragments/README.md index 2ef923e8..7c8981fa 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -11,7 +11,7 @@ Each file should be named like `..rst`, where * `breaking` * `bugfix` * `deprecation` -* `doc` +* `docs` * `feature` * `internal` * `misc` diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index edd5e050..bc68bfe5 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -10,7 +10,7 @@ ALLOWED_EXTENSIONS = { ".breaking.rst", ".bugfix.rst", ".deprecation.rst", - ".doc.rst", + ".docs.rst", ".feature.rst", ".internal.rst", ".misc.rst", diff --git a/pyproject.toml b/pyproject.toml index aa7ddcd0..d94ebfd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ name = "Deprecations" showcontent = true [[tool.towncrier.type]] -directory = "doc" +directory = "docs" name = "Improved Documentation" showcontent = true diff --git a/setup.py b/setup.py index dc1a39f1..859008ec 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ extras_require = { "pydocstyle>=6.0.0", "black>=23", ], - "doc": [ + "docs": [ "sphinx>=6.0.0", "sphinx_rtd_theme>=1.0.0", "towncrier>=21,<22", @@ -38,7 +38,7 @@ extras_require["dev"] = ( extras_require["dev"] + extras_require["test"] + extras_require["lint"] - + extras_require["doc"] + + extras_require["docs"] ) diff --git a/tox.ini b/tox.ini index 35503e26..b1dae72a 100644 --- a/tox.ini +++ b/tox.ini @@ -34,7 +34,7 @@ basepython= py311: python3.11 extras= test - docs: doc + docs allowlist_externals=make [common-lint] From 86b5d52149e561080c2c5629e68a9810f8552090 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Fri, 12 May 2023 14:47:15 -0600 Subject: [PATCH 59/94] Update .gitignore spelling error --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e0e2be56..0d725c74 100644 --- a/.gitignore +++ b/.gitignore @@ -51,7 +51,7 @@ docs/*._utils.* # Blockchain chains -# Hypothese Property base testing +# Hypothesis Property base testing .hypothesis # tox/pytest cache From 42be4de76cba63fddccd95fb0f4c5289b777b403 Mon Sep 17 00:00:00 2001 From: pacrob Date: Thu, 25 May 2023 14:33:14 -0600 Subject: [PATCH 60/94] fix typos in ci config and Makefile --- .circleci/config.yml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 791a433d..0f1436c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ common: &common command: ./.circleci/merge_pr.sh when: on_fail - run: - name: merge pull request base (3nd try) + name: merge pull request base (3rd try) command: ./.circleci/merge_pr.sh when: on_fail - restore_cache: diff --git a/Makefile b/Makefile index 67a75732..06d85b7c 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ 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" - @echo "lint-roll - automatically fix problems with isort, flake8, etc" + @echo "lint - check style with mypy, flake8, isort, pydocstyle, and black" + @echo "lint-roll - automatically fix problems with flake8 and black" @echo "test - run tests quickly with the default Python" @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/" From 024f9dbd54735d7d00b0c537bb9976bcb08c813d Mon Sep 17 00:00:00 2001 From: kclowes Date: Wed, 14 Jun 2023 07:59:07 -0600 Subject: [PATCH 61/94] Add tests to distribution by default (#97) --- MANIFEST.in | 2 ++ Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 22c6165d..a122460c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,8 @@ include LICENSE include README.md +recursive-include tests * + global-include *.pyi recursive-exclude * __pycache__ diff --git a/Makefile b/Makefile index 06d85b7c..f91dd720 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ notes: check-bump make build-docs git commit -m "Compile release notes" -release: check-bump clean +release: check-bump test clean # require that you be on a branch that's linked to upstream/main git status -s -b | head -1 | grep "\.\.upstream/main" # verify that docs build correctly From 37841d57ed4d8fa89973414d68a5e4e738812100 Mon Sep 17 00:00:00 2001 From: Stuart Reed Date: Tue, 13 Jun 2023 09:46:18 -0600 Subject: [PATCH 62/94] Update release command to check remote for upstream --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f91dd720..60ed00e4 100644 --- a/Makefile +++ b/Makefile @@ -69,9 +69,9 @@ notes: check-bump make build-docs git commit -m "Compile release notes" -release: check-bump test clean - # require that you be on a branch that's linked to upstream/main - git status -s -b | head -1 | grep "\.\.upstream/main" +release: check-bump clean + # require that upstream is configured for ethereum/ + git remote -v | grep "upstream\tgit@github.com:ethereum/.git (push)\|upstream\thttps://github.com/ethereum/ (push)" # verify that docs build correctly ./newsfragments/validate_files.py is-empty make build-docs From 8a57adf9503919c9f273d742ce257042211ae082 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:29:30 -0600 Subject: [PATCH 63/94] Update .gitignore add `.venv*` to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0d725c74..7d6b0b06 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ lib lib64 pip-wheel-metadata venv* +.venv* # Installer logs pip-log.txt From 4245675648f6e0937e5865c31fc2176344af3a80 Mon Sep 17 00:00:00 2001 From: pacrob Date: Thu, 14 Sep 2023 12:11:55 -0600 Subject: [PATCH 64/94] ignore flake8 F401 errors in __init__.py files --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index b1dae72a..cdb3560c 100644 --- a/tox.ini +++ b/tox.ini @@ -16,9 +16,10 @@ multi_line_output=3 profile=black [flake8] -max-line-length=88 exclude=venv*,.tox,docs,build extend-ignore=E203 +max-line-length=88 +per-file-ignores=__init__.py:F401 [testenv] usedevelop=True From 26005569ce71ab26ce1e847ea2122a860bbb9b2d Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:40:01 -0600 Subject: [PATCH 65/94] Update .gitignore add `.build` to be ignored --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7d6b0b06..f9dcb54c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ *.egg-info dist build +.build eggs .eggs parts From 23d8fb5bf77a62d6472b29758f1b8424bfab7aa6 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:40:49 -0600 Subject: [PATCH 66/94] Update .readthedocs.yml fix indent, add sphinx fail_on_warning --- .readthedocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 50b9b384..593793c2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,7 +6,8 @@ build: python: "3.8" sphinx: - configuration: docs/conf.py + configuration: docs/conf.py + fail_on_warning: true python: install: From efcb97c348892b7e85a6300226e26e41bcceb4b9 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:13:56 -0600 Subject: [PATCH 67/94] Update .gitignore gitignore local vs-code settings --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f9dcb54c..5127a4df 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,9 @@ logs # pyenv .python-version +# vs-code +.vscode + # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # For a more precise, explicit template, see: # https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 From 7099bbaaa48504ec9609d3b34648f0177dbccba8 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:32:07 -0600 Subject: [PATCH 68/94] Add pre commit (#103) * add pre-commit * run pre-commit * skip lint on README.md as it breaks template filling --- .bumpversion.cfg | 1 - .circleci/config.yml | 9 ++--- .../{bug_report.yml => bug_report.yaml} | 0 .../{config.yml => config.yaml} | 0 ...ature_request.yml => feature_request.yaml} | 0 .github/pull_request_template.md | 9 +++-- .pre-commit-config.yaml | 37 ++++++++++++++++++ .readthedocs.yml => .readthedocs.yaml | 0 Makefile | 10 +---- README.md | 7 +++- docs/index.rst | 2 +- newsfragments/README.md | 18 ++++----- newsfragments/validate_files.py | 1 - setup.py | 38 +++++++------------ tox.ini | 17 +++------ 15 files changed, 82 insertions(+), 67 deletions(-) rename .github/ISSUE_TEMPLATE/{bug_report.yml => bug_report.yaml} (100%) rename .github/ISSUE_TEMPLATE/{config.yml => config.yaml} (100%) rename .github/ISSUE_TEMPLATE/{feature_request.yml => feature_request.yaml} (100%) create mode 100644 .pre-commit-config.yaml rename .readthedocs.yml => .readthedocs.yaml (100%) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f683001f..39ae22d4 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -20,4 +20,3 @@ values = [bumpversion:file:setup.py] search = version="{current_version}", replace = version="{new_version}", - diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f1436c0..bbc90296 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,6 +25,9 @@ common: &common command: | python -m pip install --upgrade pip python -m pip install tox + - run: + name: install pre-commit + command: python -m pip install --progress-bar=off pre-commit - run: name: run tox command: python -m tox run -r @@ -102,12 +105,6 @@ jobs: environment: TOXENV: py311-core - py37-lint: - <<: *common - docker: - - image: cimg/python:3.7 - environment: - TOXENV: py37-lint py38-lint: <<: *common docker: diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.yml rename to .github/ISSUE_TEMPLATE/bug_report.yaml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.yml rename to .github/ISSUE_TEMPLATE/config.yaml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.yml rename to .github/ISSUE_TEMPLATE/feature_request.yaml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2ff2e071..3691f6b9 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,12 +6,13 @@ Closes # ### How was it fixed? ### Todo: -- [ ] Clean up commit history -- [ ] Add or update documentation related to these changes +- \[ \] Clean up commit history -- [ ] Add entry to the [release notes](https://github.com/ethereum//blob/main/newsfragments/README.md) +- \[ \] Add or update documentation related to these changes + +- \[ \] Add entry to the [release notes](https://github.com/ethereum/%3CREPO_NAME%3E/blob/main/newsfragments/README.md) #### Cute Animal Picture -![Put a link to a cute animal picture inside the parenthesis-->]() \ No newline at end of file +![Put a link to a cute animal picture inside the parenthesis-->](<>) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..58f9e1d8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,37 @@ +exclude: '.project-template|docs/conf.py' +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-yaml + - id: check-toml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black +- repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + additional_dependencies: + - flake8-bugbear==23.9.16 + exclude: setup.py +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort +- repo: https://github.com/pycqa/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle +- repo: https://github.com/executablebooks/mdformat + rev: 0.7.17 + hooks: + - id: mdformat +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.5.1 + hooks: + - id: mypy + exclude: tests/ diff --git a/.readthedocs.yml b/.readthedocs.yaml similarity index 100% rename from .readthedocs.yml rename to .readthedocs.yaml diff --git a/Makefile b/Makefile index 60ed00e4..28d7fa46 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +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 "lint - check style with mypy, flake8, isort, pydocstyle, and black" - @echo "lint-roll - automatically fix problems with flake8 and black" + @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)" @echo "notes - consume towncrier newsfragments/ and update release notes in docs/" @@ -27,12 +26,7 @@ clean-pyc: find . -name '__pycache__' -exec rm -rf {} + lint: - tox run -e lint - -lint-roll: - isort tests - black tests setup.py - $(MAKE) lint + pre-commit run --all-files --show-diff-on-failure test: pytest tests diff --git a/README.md b/README.md index 5acd94db..fa56f2e3 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,13 @@ for information on how we do: - Testing - Pull Requests -- Code Style - Documentation +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`. + ### Development Environment Setup You can set up your dev environment with: @@ -37,6 +41,7 @@ cd virtualenv -p python3 venv . venv/bin/activate python -m pip install -e ".[dev]" +pre-commit install ``` ### Release setup diff --git a/docs/index.rst b/docs/index.rst index 472a482a..89815efa 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,7 @@ Contents release_notes - + Indices and tables ------------------ diff --git a/newsfragments/README.md b/newsfragments/README.md index 7c8981fa..177d6492 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -8,15 +8,15 @@ relevant to people working on the code itself.) Each file should be named like `..rst`, where `` is an issue number, and `` is one of: -* `breaking` -* `bugfix` -* `deprecation` -* `docs` -* `feature` -* `internal` -* `misc` -* `performance` -* `removal` +- `breaking` +- `bugfix` +- `deprecation` +- `docs` +- `feature` +- `internal` +- `misc` +- `performance` +- `removal` So for example: `123.feature.rst`, `456.bugfix.rst` diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index bc68bfe5..02b0e3ef 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -31,7 +31,6 @@ if num_args == 1: assert sys.argv[1] in ("is-empty",) for fragment_file in THIS_DIR.iterdir(): - if fragment_file.name in ALLOWED_FILES: continue elif num_args == 0: diff --git a/setup.py b/setup.py index 859008ec..5efcc3cd 100644 --- a/setup.py +++ b/setup.py @@ -1,44 +1,34 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import ( - setup, find_packages, + setup, ) extras_require = { - "test": [ - "pytest>=7.0.0", - "pytest-xdist>=2.4.0", - ], - "lint": [ - "flake8==6.0.0", # flake8 claims semver but adds new warnings at minor releases, leave it pinned. - "flake8-bugbear==23.3.23", # flake8-bugbear does not follow semver, leave it pinned. - "isort>=5.10.1", - "mypy==0.971", # mypy does not follow semver, leave it pinned. - "pydocstyle>=6.0.0", - "black>=23", + "dev": [ + "build>=0.9.0", + "bumpversion>=0.5.3", + "ipython", + "pre-commit>=3.4.0", + "pytest-watch>=4.1.0", + "tox>=4.0.0", + "twine", + "wheel", ], "docs": [ "sphinx>=6.0.0", "sphinx_rtd_theme>=1.0.0", "towncrier>=21,<22", ], - "dev": [ - "bumpversion>=0.5.3", - "pytest-watch>=4.1.0", - "tox>=4.0.0", - "build>=0.9.0", - "wheel", - "twine", - "ipython", + "test": [ + "pytest>=7.0.0", + "pytest-xdist>=2.4.0", ], } extras_require["dev"] = ( - extras_require["dev"] - + extras_require["test"] - + extras_require["lint"] - + extras_require["docs"] + extras_require["dev"] + extras_require["docs"] + extras_require["test"] ) diff --git a/tox.ini b/tox.ini index cdb3560c..cf23aa2e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist= py{37,38,39,310,311}-core - py{37,38,39,310,311}-lint + py{38,39,310,311}-lint py{37,38,39,310,311}-wheel py311-wheel-windows docs @@ -36,26 +36,19 @@ basepython= extras= test docs -allowlist_externals=make +allowlist_externals=make,pre-commit [common-lint] basepython=python -extras=lint -allowlist_externals=black +deps=pre-commit commands= - mypy -p --config-file {toxinidir}/mypy.ini - flake8 {toxinidir}/ {toxinidir}/tests - isort --check-only --diff {toxinidir}/ {toxinidir}/tests - pydocstyle --explain {toxinidir}/ {toxinidir}/tests - black --check {toxinidir}/ {toxinidir}/docs {toxinidir}/tests {toxinidir}/setup.py + pre-commit run --all-files --show-diff-on-failure [testenv:lint] basepython: python -extras: {[common-lint]extras} commands: {[common-lint]commands} -[testenv:py{37,38,39,310,311}-lint] -extras: {[common-lint]extras} +[testenv:py{38,39,310,311}-lint] commands: {[common-lint]commands} [testenv:py{37,38,39,310,311}-wheel] From 2ed5fba28d19109150175cd37394ab1e745d6633 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:51:01 -0600 Subject: [PATCH 69/94] Update pull_request_template.md fix linting broke template formatting --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3691f6b9..3f52eebd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,7 +11,7 @@ Closes # - \[ \] Add or update documentation related to these changes -- \[ \] Add entry to the [release notes](https://github.com/ethereum/%3CREPO_NAME%3E/blob/main/newsfragments/README.md) +- \[ \] Add entry to the [release notes](https://github.com/ethereum//blob/main/newsfragments/README.md) #### Cute Animal Picture From 0065691db7c072eb818f125e7595afb59db205f9 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:55:19 -0600 Subject: [PATCH 70/94] Update Makefile missing doublequote --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 28d7fa46..74f1640c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +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 "lint - fix linting issues with pre-commit + @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)" @echo "notes - consume towncrier newsfragments/ and update release notes in docs/" From 82425694f63c6eb610e10451cb1c93317dbb6eeb Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:36:57 -0600 Subject: [PATCH 71/94] drop py37 support (#104) --- .circleci/config.yml | 15 --------------- setup.py | 3 +-- tox.ini | 7 +++---- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bbc90296..2a438f57 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,12 +74,6 @@ jobs: environment: TOXENV: docs - py37-core: - <<: *common - docker: - - image: cimg/python:3.7 - environment: - TOXENV: py37-core py38-core: <<: *common docker: @@ -130,12 +124,6 @@ jobs: environment: TOXENV: py311-lint - py37-wheel: - <<: *common - docker: - - image: cimg/python:3.7 - environment: - TOXENV: py37-wheel py38-wheel: <<: *common docker: @@ -171,17 +159,14 @@ workflows: test: jobs: - docs - - py37-core - py38-core - py39-core - py310-core - py311-core - - py37-lint - py38-lint - py39-lint - py310-lint - py311-lint - - py37-wheel - py38-wheel - py39-wheel - py310-wheel diff --git a/setup.py b/setup.py index 5efcc3cd..ad552d5d 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ setup( install_requires=[ "eth-utils>=2", ], - python_requires=">=3.7, <4", + python_requires=">=3.8, <4", extras_require=extras_require, py_modules=[""], license="MIT", @@ -64,7 +64,6 @@ setup( "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", diff --git a/tox.ini b/tox.ini index cf23aa2e..df00ee6d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist= - py{37,38,39,310,311}-core + py{38,39,310,311}-core py{38,39,310,311}-lint - py{37,38,39,310,311}-wheel + py{38,39,310,311}-wheel py311-wheel-windows docs @@ -28,7 +28,6 @@ commands= docs: make check-docs basepython= docs: python - py37: python3.7 py38: python3.8 py39: python3.9 py310: python3.10 @@ -51,7 +50,7 @@ commands: {[common-lint]commands} [testenv:py{38,39,310,311}-lint] commands: {[common-lint]commands} -[testenv:py{37,38,39,310,311}-wheel] +[testenv:py{38,39,310,311}-wheel] deps= wheel build[virtualenv] From 146a3a9b020b87ccbbf44b783c254a84be1b34b2 Mon Sep 17 00:00:00 2001 From: pacrob Date: Wed, 11 Oct 2023 10:11:13 -0600 Subject: [PATCH 72/94] drop egg references --- .circleci/config.yml | 1 - Makefile | 1 - 2 files changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a438f57..5dcf0010 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,6 @@ common: &common - .tox - ~/.cache/pip - ~/.local - - ./eggs key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} orbs: diff --git a/Makefile b/Makefile index 74f1640c..9deaab82 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,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 {} + From c3c29ddf43ed091d7e3bd92841503d3a15f564ee Mon Sep 17 00:00:00 2001 From: pacrob Date: Wed, 11 Oct 2023 08:31:24 -0600 Subject: [PATCH 73/94] bump pre-commit to 4.5 and add github-flavored markdown linting extension --- .github/pull_request_template.md | 6 +++--- .pre-commit-config.yaml | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3f52eebd..18c01e24 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,11 +7,11 @@ Closes # ### Todo: -- \[ \] Clean up commit history +- [ ] Clean up commit history -- \[ \] Add or update documentation related to these changes +- [ ] Add or update documentation related to these changes -- \[ \] Add entry to the [release notes](https://github.com/ethereum//blob/main/newsfragments/README.md) +- [ ] Add entry to the [release notes](https://github.com/ethereum//blob/main/newsfragments/README.md) #### Cute Animal Picture diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58f9e1d8..3ad4843d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: '.project-template|docs/conf.py' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.5.0 hooks: - id: check-yaml - id: check-toml @@ -30,6 +30,8 @@ repos: rev: 0.7.17 hooks: - id: mdformat + additional_dependencies: + - mdformat-gfm - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.5.1 hooks: From 86440ee879a96dfc9410010ae3fad829c21277fa Mon Sep 17 00:00:00 2001 From: pacrob Date: Thu, 12 Oct 2023 08:57:17 -0600 Subject: [PATCH 74/94] add autoflake to lint and move config to pyproject.toml --- .pre-commit-config.yaml | 6 ++++ .pydocstyle.ini | 30 ------------------ Makefile | 5 ++- mypy.ini | 16 ---------- pyproject.toml | 68 +++++++++++++++++++++++++++++++++++++++++ pytest.ini | 8 ----- tox.ini | 9 ------ 7 files changed, 78 insertions(+), 64 deletions(-) delete mode 100644 .pydocstyle.ini delete mode 100644 mypy.ini delete mode 100644 pytest.ini diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ad4843d..d2fae1c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,10 @@ repos: additional_dependencies: - flake8-bugbear==23.9.16 exclude: setup.py +- repo: https://github.com/PyCQA/autoflake + rev: v2.2.1 + hooks: + - id: autoflake - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: @@ -26,6 +30,8 @@ repos: rev: 6.3.0 hooks: - id: pydocstyle + additional_dependencies: + - tomli # required until >= python311 - repo: https://github.com/executablebooks/mdformat rev: 0.7.17 hooks: diff --git a/.pydocstyle.ini b/.pydocstyle.ini deleted file mode 100644 index 0d40aa88..00000000 --- a/.pydocstyle.ini +++ /dev/null @@ -1,30 +0,0 @@ -[pydocstyle] -; All error codes found here: -; http://www.pydocstyle.org/en/3.0.0/error_codes.html -; -; Ignored: -; D1 - Missing docstring error codes -; -; Selected: -; D2 - Whitespace error codes -; D3 - Quote error codes -; D4 - Content related error codes -select=D2,D3,D4 - -; Extra ignores: -; D200 - One-line docstring should fit on one line with quotes -; D203 - 1 blank line required before class docstring -; D204 - 1 blank line required after class docstring -; D205 - 1 blank line required between summary line and description -; D212 - Multi-line docstring summary should start at the first line -; D302 - Use u""" for Unicode docstrings -; D400 - First line should end with a period -; D401 - First line should be in imperative mood -; D412 - No blank lines allowed between a section header and its content -add-ignore=D200,D203,D204,D205,D212,D302,D400,D401,D412 - -; Explanation: -; D400 - Enabling this error code seems to make it a requirement that the first -; sentence in a docstring is not split across two lines. It also makes it a -; requirement that no docstring can have a multi-sentence description without a -; summary line. Neither one of those requirements seem appropriate. diff --git a/Makefile b/Makefile index 9deaab82..fd94b2ce 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,10 @@ clean-pyc: find . -name '__pycache__' -exec rm -rf {} + lint: - pre-commit run --all-files --show-diff-on-failure + @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 diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 1fcbd14c..00000000 --- a/mypy.ini +++ /dev/null @@ -1,16 +0,0 @@ -[mypy] - -check_untyped_defs = True -disallow_incomplete_defs = True -disallow_untyped_defs = True -disallow_any_generics = True -disallow_untyped_calls = True -disallow_untyped_decorators = True -disallow_subclassing_any = True -ignore_missing_imports = True -strict_optional = True -strict_equality = True -warn_redundant_casts = True -warn_return_any = True -warn_unused_configs = True -warn_unused_ignores = True diff --git a/pyproject.toml b/pyproject.toml index d94ebfd9..5abd4c29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,71 @@ +[tool.autoflake] +remove_all_unused_imports = "True" +exclude = "__init__.py" + +[tool.isort] +combine_as_imports = "True" +extra_standard_library = "pytest" +force_grid_wrap = 1 +force_sort_within_sections = "True" +known_third_party = "hypothesis,pytest" +known_first_party = "" +multi_line_output = 3 +profile = "black" + +[tool.mypy] +check_untyped_defs = "True" +disallow_incomplete_defs = "True" +disallow_untyped_defs = "True" +disallow_any_generics = "True" +disallow_untyped_calls = "True" +disallow_untyped_decorators = "True" +disallow_subclassing_any = "True" +ignore_missing_imports = "True" +strict_optional = "True" +strict_equality = "True" +warn_redundant_casts = "True" +warn_return_any = "True" +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 +# +# Ignored: +# D1 - Missing docstring error codes +# +# Selected: +# D2 - Whitespace error codes +# D3 - Quote error codes +# D4 - Content related error codes +select = "D2,D3,D4" + +# Extra ignores: +# D200 - One-line docstring should fit on one line with quotes +# D203 - 1 blank line required before class docstring +# D204 - 1 blank line required after class docstring +# D205 - 1 blank line required between summary line and description +# D212 - Multi-line docstring summary should start at the first line +# D302 - Use u""" for Unicode docstrings +# D400 - First line should end with a period +# D401 - First line should be in imperative mood +# D412 - No blank lines allowed between a section header and its content +add-ignore = "D200,D203,D204,D205,D212,D302,D400,D401,D412,D415" + +# Explanation: +# D400 - Enabling this error code seems to make it a requirement that the first +# sentence in a docstring is not split across two lines. It also makes it a +# requirement that no docstring can have a multi-sentence description without a +# summary line. Neither one of those requirements seem appropriate. + +[tool.pytest.ini_options] +addopts = "-v --showlocals --durations 10" +xfail_strict = "True" +log_format = "%(levelname)8s %(asctime)s %(filename)20s %(message)s" +log_date_format = "%m-%d %H:%M:%S" + [tool.towncrier] # Read https://github.com/ethereum//blob/main/newsfragments/README.md for instructions package = "" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index fd5ea7cb..00000000 --- a/pytest.ini +++ /dev/null @@ -1,8 +0,0 @@ -[pytest] -addopts= -v --showlocals --durations 10 -xfail_strict=true -log_format = %(levelname)8s %(asctime)s %(filename)20s %(message)s -log_date_format = %m-%d %H:%M:%S - -[pytest-watch] -runner= pytest --failed-first --maxfail=1 --no-success-flaky-report diff --git a/tox.ini b/tox.ini index df00ee6d..2742f06a 100644 --- a/tox.ini +++ b/tox.ini @@ -6,15 +6,6 @@ envlist= py311-wheel-windows docs -[isort] -combine_as_imports=True -force_grid_wrap=1 -force_sort_within_sections=True -known_third_party=hypothesis,pytest -known_first_party= -multi_line_output=3 -profile=black - [flake8] exclude=venv*,.tox,docs,build extend-ignore=E203 From 662b35d09a8e33bd5bd4cbc611142fd06b0d1956 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:14:28 -0600 Subject: [PATCH 75/94] Update pyproject.toml Add description of pydocstyle D415 rule --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 5abd4c29..8c23be36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ select = "D2,D3,D4" # D400 - First line should end with a period # D401 - First line should be in imperative mood # D412 - No blank lines allowed between a section header and its content +# D415 - First line should end with a period, question mark, or exclamation point add-ignore = "D200,D203,D204,D205,D212,D302,D400,D401,D412,D415" # Explanation: From 8d5d92ddd8fe0cb45f648fd7fa276c16987b5d82 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:54:07 -0600 Subject: [PATCH 76/94] Update setup.py drop pytest-watch from dev dependencies --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index ad552d5d..193ed7be 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,6 @@ extras_require = { "bumpversion>=0.5.3", "ipython", "pre-commit>=3.4.0", - "pytest-watch>=4.1.0", "tox>=4.0.0", "twine", "wheel", From 885bef7b5e7792af12fbe8f365e6410035f07fc5 Mon Sep 17 00:00:00 2001 From: pacrob Date: Fri, 27 Oct 2023 12:13:12 -0600 Subject: [PATCH 77/94] condense tox lint envs as linting now a pre-commit call, not tox --- tox.ini | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tox.ini b/tox.ini index 2742f06a..f52da5f8 100644 --- a/tox.ini +++ b/tox.ini @@ -28,19 +28,11 @@ extras= docs allowlist_externals=make,pre-commit -[common-lint] -basepython=python +[testenv:py{38,39,310,311}-lint] deps=pre-commit commands= pre-commit run --all-files --show-diff-on-failure -[testenv:lint] -basepython: python -commands: {[common-lint]commands} - -[testenv:py{38,39,310,311}-lint] -commands: {[common-lint]commands} - [testenv:py{38,39,310,311}-wheel] deps= wheel From 3c654831215dafd772e220d314b3c9221417f461 Mon Sep 17 00:00:00 2001 From: fselmo Date: Tue, 7 Nov 2023 12:07:54 -0700 Subject: [PATCH 78/94] update the grep command for upstream branch check - Sometimes 'www.' is used in the url for https --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fd94b2ce..29815fad 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,9 @@ notes: check-bump release: check-bump clean # require that upstream is configured for ethereum/ - git remote -v | grep "upstream\tgit@github.com:ethereum/.git (push)\|upstream\thttps://github.com/ethereum/ (push)" + @git remote -v | grep \ + -e "upstream\tgit@github.com:ethereum/.git (push)" \ + -Ee "upstream\thttps://(www.)?github.com/ethereum/ \(push\)" # verify that docs build correctly ./newsfragments/validate_files.py is-empty make build-docs From 7f75b270a530924a91c776f32c708c9a82881771 Mon Sep 17 00:00:00 2001 From: fselmo Date: Tue, 7 Nov 2023 12:13:48 -0700 Subject: [PATCH 79/94] Use upcoming version in make notes commit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 29815fad..6afbaf3a 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ notes: check-bump 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: check-bump clean # require that upstream is configured for ethereum/ From 4d17820fca41d23d1e69cfd21282cd6e89f03231 Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 27 Nov 2023 13:02:31 -0700 Subject: [PATCH 80/94] Further generalize the grep command for remote check --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6afbaf3a..c5956da1 100644 --- a/Makefile +++ b/Makefile @@ -67,9 +67,7 @@ notes: check-bump release: check-bump clean # require that upstream is configured for ethereum/ - @git remote -v | grep \ - -e "upstream\tgit@github.com:ethereum/.git (push)" \ - -Ee "upstream\thttps://(www.)?github.com/ethereum/ \(push\)" + @git remote -v | grep -E "upstream\tgit@github.com:ethereum/.git \(push\)|upstream\thttps://(www.)?github.com/ethereum/ \(push\)" # verify that docs build correctly ./newsfragments/validate_files.py is-empty make build-docs From 67c0fb4f7b2e72be5161942af68b27a11a7b0e9d Mon Sep 17 00:00:00 2001 From: Stuart Reed Date: Mon, 27 Nov 2023 15:51:31 -0700 Subject: [PATCH 81/94] Ignore all __pycache__ directories (#114) * Ignore all __pycache__ directories * Newsfragment * Revert Newsfragment --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5127a4df..57eac529 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,9 @@ chains .cache .pytest_cache +# pycache +__pycache__/ + # Test output logs logs From 0b0593880dbcebbfd6ae496b08e63f01ad814418 Mon Sep 17 00:00:00 2001 From: pacrob Date: Tue, 28 Nov 2023 09:21:12 -0700 Subject: [PATCH 82/94] add formats key to RTD to make downloadable docs available --- .readthedocs.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 593793c2..e55e07e4 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -15,3 +15,6 @@ python: path: . extra_requirements: - docs + +# Build all formats for RTD Downloads - htmlzip, pdf, epub +formats: all From d1395aaad2b26dffc61aec7ee821c597784ae816 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:01:08 -0700 Subject: [PATCH 83/94] add .bumpversion.cfg to pre-commit ignore Causes problems with releasing when pre-commit changes the file after bumpversion updates it --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2fae1c9..789b16cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -exclude: '.project-template|docs/conf.py' +exclude: '.project-template|docs/conf.py|.bumpversion.cfg' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 From 621cd56059b73ea60f315ebef437a998d15481be Mon Sep 17 00:00:00 2001 From: pacrob Date: Thu, 7 Dec 2023 14:39:09 -0700 Subject: [PATCH 84/94] add pyupgrade to pre-commit hooks --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 789b16cd..d1aa72ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,3 +43,8 @@ repos: hooks: - id: mypy exclude: tests/ +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: [--py38-plus] From cb3f556315ba864450c975b88058f08da0a9c399 Mon Sep 17 00:00:00 2001 From: pacrob Date: Sat, 9 Dec 2023 12:12:52 -0700 Subject: [PATCH 85/94] move pyupgrade before black --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d1aa72ce..82b01b7c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,11 @@ repos: - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: [--py38-plus] - repo: https://github.com/psf/black rev: 23.9.1 hooks: @@ -43,8 +48,3 @@ repos: hooks: - id: mypy exclude: tests/ -- repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 - hooks: - - id: pyupgrade - args: [--py38-plus] From 30e3c1de20dedffc78d799017bfddd7d29ab6cef Mon Sep 17 00:00:00 2001 From: pacrob Date: Wed, 3 Jan 2024 11:11:09 -0700 Subject: [PATCH 86/94] toml bools should be lowercase w/o quotes --- pyproject.toml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c23be36..f244df2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,32 +1,32 @@ [tool.autoflake] -remove_all_unused_imports = "True" +remove_all_unused_imports = true exclude = "__init__.py" [tool.isort] -combine_as_imports = "True" +combine_as_imports = true extra_standard_library = "pytest" force_grid_wrap = 1 -force_sort_within_sections = "True" +force_sort_within_sections = true known_third_party = "hypothesis,pytest" known_first_party = "" multi_line_output = 3 profile = "black" [tool.mypy] -check_untyped_defs = "True" -disallow_incomplete_defs = "True" -disallow_untyped_defs = "True" -disallow_any_generics = "True" -disallow_untyped_calls = "True" -disallow_untyped_decorators = "True" -disallow_subclassing_any = "True" -ignore_missing_imports = "True" -strict_optional = "True" -strict_equality = "True" -warn_redundant_casts = "True" -warn_return_any = "True" -warn_unused_configs = "True" -warn_unused_ignores = "True" +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_subclassing_any = true +ignore_missing_imports = true +strict_optional = true +strict_equality = true +warn_redundant_casts = true +warn_return_any = true +warn_unused_configs = true +warn_unused_ignores = true [tool.pydocstyle] @@ -63,7 +63,7 @@ add-ignore = "D200,D203,D204,D205,D212,D302,D400,D401,D412,D415" [tool.pytest.ini_options] addopts = "-v --showlocals --durations 10" -xfail_strict = "True" +xfail_strict = true log_format = "%(levelname)8s %(asctime)s %(filename)20s %(message)s" log_date_format = "%m-%d %H:%M:%S" From e342fe762491aa61a4f21be0683fe507f0ee89ba Mon Sep 17 00:00:00 2001 From: pacrob Date: Mon, 8 Jan 2024 16:18:53 -0700 Subject: [PATCH 87/94] add version to import test --- tests/core/test_import.py | 2 -- tests/core/test_import_and_version.py | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 tests/core/test_import.py create mode 100644 tests/core/test_import_and_version.py diff --git a/tests/core/test_import.py b/tests/core/test_import.py deleted file mode 100644 index 07b2a18e..00000000 --- a/tests/core/test_import.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_import(): - import # noqa: F401 diff --git a/tests/core/test_import_and_version.py b/tests/core/test_import_and_version.py new file mode 100644 index 00000000..37b44197 --- /dev/null +++ b/tests/core/test_import_and_version.py @@ -0,0 +1,4 @@ +def test_import(): + import + version = .__version__ + assert isinstance(version, str) From 4ac9e871667803eb84ab23dd01cc0dd3502bc997 Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:35:27 -0700 Subject: [PATCH 88/94] Update test_import_and_version.py clean up test_import_and_version --- tests/core/test_import_and_version.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/core/test_import_and_version.py b/tests/core/test_import_and_version.py index 37b44197..17e01b84 100644 --- a/tests/core/test_import_and_version.py +++ b/tests/core/test_import_and_version.py @@ -1,4 +1,3 @@ -def test_import(): +def test_import_and_version(): import - version = .__version__ - assert isinstance(version, str) + assert isinstance(.__version__, str) From 608a0a954bdb1e51186bf46e9a3a485889d5637a Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:36:12 -0700 Subject: [PATCH 89/94] Update test_import_and_version.py clean up test_import_and_version --- tests/core/test_import_and_version.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/core/test_import_and_version.py b/tests/core/test_import_and_version.py index 17e01b84..6a2f8ea5 100644 --- a/tests/core/test_import_and_version.py +++ b/tests/core/test_import_and_version.py @@ -1,3 +1,4 @@ def test_import_and_version(): import + assert isinstance(.__version__, str) From 3fed49fb497ca322a747564634f5888b3bbea71d Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:50:29 -0700 Subject: [PATCH 90/94] Update config.yml Drop the `install pre-commit` step here, as it is installed for all linting ci via the tox env deps --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5dcf0010..25d1d7b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,9 +25,6 @@ common: &common command: | python -m pip install --upgrade pip python -m pip install tox - - run: - name: install pre-commit - command: python -m pip install --progress-bar=off pre-commit - run: name: run tox command: python -m tox run -r From 8ffe3b8900139eeb2602fd44249835fe77f1f68a Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:03:07 -0700 Subject: [PATCH 91/94] Update tox.ini Add `pre-commit install` here since it was removed from ci config --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index f52da5f8..75c4d54a 100644 --- a/tox.ini +++ b/tox.ini @@ -31,6 +31,7 @@ allowlist_externals=make,pre-commit [testenv:py{38,39,310,311}-lint] deps=pre-commit commands= + pre-commit install pre-commit run --all-files --show-diff-on-failure [testenv:py{38,39,310,311}-wheel] From b853f5ccdf0fc45b2168ffaffc52adccbe098ac1 Mon Sep 17 00:00:00 2001 From: pacrob <5199899+pacrob@users.noreply.github.com> Date: Fri, 26 Jan 2024 11:14:40 -0700 Subject: [PATCH 92/94] add py312 support --- .circleci/config.yml | 21 +++++++++++++++++++++ setup.py | 1 + tox.ini | 11 ++++++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 25d1d7b3..113f401d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,6 +94,12 @@ jobs: - image: cimg/python:3.11 environment: TOXENV: py311-core + py312-core: + <<: *common + docker: + - image: cimg/python:3.12 + environment: + TOXENV: py312-core py38-lint: <<: *common @@ -119,6 +125,12 @@ jobs: - image: cimg/python:3.11 environment: TOXENV: py311-lint + py312-lint: + <<: *common + docker: + - image: cimg/python:3.12 + environment: + TOXENV: py312-lint py38-wheel: <<: *common @@ -144,6 +156,12 @@ jobs: - image: cimg/python:3.11 environment: TOXENV: py311-wheel + py312-wheel: + <<: *common + docker: + - image: cimg/python:3.12 + environment: + TOXENV: py312-wheel py311-wheel-windows: <<: *windows_steps @@ -159,12 +177,15 @@ workflows: - py39-core - py310-core - py311-core + - py312-core - py38-lint - py39-lint - py310-lint - py311-lint + - py312-lint - py38-wheel - py39-wheel - py310-wheel - py311-wheel + - py312-wheel - py311-wheel-windows diff --git a/setup.py b/setup.py index 193ed7be..c2247fee 100644 --- a/setup.py +++ b/setup.py @@ -67,5 +67,6 @@ setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], ) diff --git a/tox.ini b/tox.ini index 75c4d54a..2f61829e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist= - py{38,39,310,311}-core - py{38,39,310,311}-lint - py{38,39,310,311}-wheel + py{38,39,310,311,312}-core + py{38,39,310,311,312}-lint + py{38,39,310,311,312}-wheel py311-wheel-windows docs @@ -23,18 +23,19 @@ basepython= py39: python3.9 py310: python3.10 py311: python3.11 + py312: python3.12 extras= test docs allowlist_externals=make,pre-commit -[testenv:py{38,39,310,311}-lint] +[testenv:py{38,39,310,311,312}-lint] deps=pre-commit commands= pre-commit install pre-commit run --all-files --show-diff-on-failure -[testenv:py{38,39,310,311}-wheel] +[testenv:py{38,39,310,311,312}-wheel] deps= wheel build[virtualenv] From 2eff6f8be8603022915ad1a20978d57da977e304 Mon Sep 17 00:00:00 2001 From: pacrob <5199899+pacrob@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:02:54 -0700 Subject: [PATCH 93/94] update windows wheel ci jobs to use pyenv, add py312 job --- .circleci/config.yml | 99 ++++++++++++++++++++++++++++++++------------ tox.ini | 6 ++- 2 files changed, 76 insertions(+), 29 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 113f401d..fdc4c841 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,28 +39,51 @@ common: &common orbs: win: circleci/windows@5.0.0 -windows_steps: &windows_steps - executor: - name: win/default - shell: bash.exe - working_directory: C:\Users\circleci\project\ - 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: run tox - command: python -m tox run -r - - save_cache: - paths: - - .tox - key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} +windows-wheel-steps: + windows-wheel-setup: &windows-wheel-setup + executor: + name: win/default + shell: bash.exe + working_directory: C:\Users\circleci\project\ + environment: + TOXENV: windows-wheel + restore-cache-step: &restore-cache-step + restore_cache: + keys: + - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} + install-pyenv-step: &install-pyenv-step + run: + name: install pyenv + command: | + pip install pyenv-win --target $HOME/.pyenv + echo 'export PYENV="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV + echo 'export PYENV_ROOT="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV + echo 'export PYENV_USERPROFILE="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV + echo 'export PATH="$PATH:$HOME/.pyenv/pyenv-win/bin"' >> $BASH_ENV + echo 'export PATH="$PATH:$HOME/.pyenv/pyenv-win/shims"' >> $BASH_ENV + source $BASH_ENV + pyenv update + install-latest-python-step: &install-latest-python-step + run: + name: install latest python version and tox + command: | + LATEST_VERSION=$(pyenv install --list | grep -E "${MINOR_VERSION}\.[0-9]+$" | tail -1) + echo "installing python version $LATEST_VERSION" + pyenv install $LATEST_VERSION + pyenv global $LATEST_VERSION + python3 -m pip install --upgrade pip + python3 -m pip install tox + run-tox-step: &run-tox-step + run: + name: run tox + command: | + echo 'running tox with' $(python3 --version) + python3 -m tox run -r + save-cache-step: &save-cache-step + save_cache: + paths: + - .tox + key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} jobs: docs: @@ -163,10 +186,31 @@ jobs: environment: TOXENV: py312-wheel - py311-wheel-windows: - <<: *windows_steps - environment: - TOXENV: py311-wheel-windows + py311-windows-wheel: + <<: *windows-wheel-setup + steps: + - checkout + - <<: *restore-cache-step + - <<: *install-pyenv-step + - run: + name: set minor version + command: echo "export MINOR_VERSION='3.11'" >> $BASH_ENV + - <<: *install-latest-python-step + - <<: *run-tox-step + - <<: *save-cache-step + + py312-windows-wheel: + <<: *windows-wheel-setup + steps: + - checkout + - <<: *restore-cache-step + - <<: *install-pyenv-step + - run: + name: set minor version + command: echo "export MINOR_VERSION='3.12'" >> $BASH_ENV + - <<: *install-latest-python-step + - <<: *run-tox-step + - <<: *save-cache-step workflows: version: 2 @@ -188,4 +232,5 @@ workflows: - py310-wheel - py311-wheel - py312-wheel - - py311-wheel-windows + - py311-windows-wheel + - py312-windows-wheel diff --git a/tox.ini b/tox.ini index 2f61829e..728d47d1 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist= py{38,39,310,311,312}-core py{38,39,310,311,312}-lint py{38,39,310,311,312}-wheel - py311-wheel-windows + windows-wheel docs [flake8] @@ -19,6 +19,7 @@ commands= docs: make check-docs basepython= docs: python + windows-wheel: python py38: python3.8 py39: python3.9 py310: python3.10 @@ -50,13 +51,14 @@ commands= python -c "import " skip_install=true -[testenv:py311-wheel-windows] +[testenv:windows-wheel] deps= wheel build[virtualenv] allowlist_externals= bash.exe commands= + python --version python -m pip install --upgrade pip bash.exe -c "rm -rf build dist" python -m build From bdd1a342d9f88761caa99ed97fc5104096fc5efd Mon Sep 17 00:00:00 2001 From: pacrob <5199899+pacrob@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:00:58 -0700 Subject: [PATCH 94/94] add docs build path for ci to check pdf and epub --- .circleci/config.yml | 12 +++++++++++- Makefile | 10 ++++++++-- tox.ini | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fdc4c841..d9e28eb9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,10 +84,20 @@ windows-wheel-steps: paths: - .tox key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} + +docs: &docs + docker: + - image: common + steps: + - run: + name: install latexpdf dependencies + command: | + sudo apt-get update + sudo apt-get install latexmk tex-gyre texlive-fonts-extra jobs: docs: - <<: *common + <<: *docs docker: - image: cimg/python:3.8 environment: diff --git a/Makefile b/Makefile index c5956da1..d1c5c7a2 100644 --- a/Makefile +++ b/Makefile @@ -38,12 +38,18 @@ build-docs: $(MAKE) -C docs clean $(MAKE) -C docs html $(MAKE) -C docs doctest + +build-docs-ci: + $(MAKE) -C docs latexpdf + $(MAKE) -C docs epub -validate-docs: +validate-newsfragments: python ./newsfragments/validate_files.py towncrier build --draft --version preview -check-docs: build-docs validate-docs +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 diff --git a/tox.ini b/tox.ini index 728d47d1..ce1da94b 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ per-file-ignores=__init__.py:F401 usedevelop=True commands= core: pytest {posargs:tests/core} - docs: make check-docs + docs: make check-docs-ci basepython= docs: python windows-wheel: python