From caf9050a19a889c90afd23a05b6d5f9aefadd665 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Tue, 15 Jan 2019 16:06:18 -0800 Subject: [PATCH 01/47] Drop py3.5, add py3.7 --- .circleci/config.yml | 18 +++++++++--------- .travis.yml | 18 +++++++++--------- docs/conf.py | 2 +- setup.py | 4 ++-- tox.ini | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f542a12..bbc56d0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,27 +39,27 @@ jobs: doctest: <<: *common docker: - - image: circleci/python:3.5 + - image: circleci/python:3.6 environment: TOXENV: doctest lint: <<: *common docker: - - image: circleci/python:3.5 + - image: circleci/python:3.6 environment: TOXENV: lint - py35-core: - <<: *common - docker: - - image: circleci/python:3.5 - environment: - TOXENV: py35-core py36-core: <<: *common docker: - image: circleci/python:3.6 environment: TOXENV: py36-core + py37-core: + <<: *common + docker: + - image: circleci/python:3.7 + environment: + TOXENV: py37-core pypy3-core: <<: *common docker: @@ -72,6 +72,6 @@ workflows: jobs: - doctest - lint - - py35-core - py36-core + - py37-core - pypy3-core diff --git a/.travis.yml b/.travis.yml index 78c56a6e..c5238746 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,23 +4,23 @@ dist: trusty matrix: include: # - # Python 3.5 testing + # Python 3.6 testing # + # core + - python: "3.6" + env: TOX_POSARGS="-e py36-core" # lint - - python: "3.5" + - python: "3.6" env: TOX_POSARGS="-e lint" # doctest - - python: "3.5" + - python: "3.6" env: TOX_POSARGS="-e doctest" - # core - - python: "3.5" - env: TOX_POSARGS="-e py35-core" # - # Python 3.6 testing + # Python 3.7 testing # # core - - python: "3.6" - env: TOX_POSARGS="-e py36-core" + - python: "3.7" + env: TOX_POSARGS="-e py37-core" # # pypy3 testing # diff --git a/docs/conf.py b/docs/conf.py index a74a9775..0c63ed46 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -273,7 +273,7 @@ # -- Intersphinx configuration ------------------------------------------------ intersphinx_mapping = { - 'python': ('https://docs.python.org/3.5', None), + 'python': ('https://docs.python.org/3.6', None), } # -- Doctest configuration ---------------------------------------- diff --git a/setup.py b/setup.py index 99618aae..047d6ff3 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ "eth-utils>=1,<2", ], setup_requires=['setuptools-markdown'], - python_requires='>=3.5, <4', + python_requires='>=3.6, <4', extras_require=extras_require, py_modules=[''], license="MIT", @@ -62,8 +62,8 @@ 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: PyPy', ], ) diff --git a/tox.ini b/tox.ini index 6ae707b1..71e19f2d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - py{35,36,py3}-core + py{36,37,py3}-core lint doctest @@ -26,8 +26,8 @@ commands= doctest: make -C {toxinidir}/docs doctest basepython = doctest: python - py35: python3.5 py36: python3.6 + py37: python3.7 pypy3: pypy3 extras= test From dd74824840c0b5899dcbc4b5a7b61b4398218fd1 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Thu, 24 Jan 2019 13:57:17 -0700 Subject: [PATCH 02/47] Add docstring checking with pydocstyle --- .pydocstyle.ini | 30 ++++++++++++++++++++++++++++++ setup.py | 1 + tox.ini | 1 + 3 files changed, 32 insertions(+) create mode 100644 .pydocstyle.ini diff --git a/.pydocstyle.ini b/.pydocstyle.ini new file mode 100644 index 00000000..0d40aa88 --- /dev/null +++ b/.pydocstyle.ini @@ -0,0 +1,30 @@ +[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/setup.py b/setup.py index 047d6ff3..6c02fb21 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ 'lint': [ "flake8==3.4.1", "isort>=4.2.15,<5", + "pydocstyle>=3.0.0,<4", ], 'doc': [ "Sphinx>=1.6.5,<2", diff --git a/tox.ini b/tox.ini index 71e19f2d..63721258 100644 --- a/tox.ini +++ b/tox.ini @@ -40,3 +40,4 @@ extras=lint commands= flake8 {toxinidir}/ {toxinidir}/tests isort --recursive --check-only --diff {toxinidir}/ {toxinidir}/tests + pydocstyle {toxinidir}/ {toxinidir}/tests From de4bdf9e308e7eba871e7399a67dcdbf6c5a8bbc Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 25 Mar 2019 15:14:04 -0600 Subject: [PATCH 03/47] Remove attribution to specific person --- LICENSE | 2 +- README.md | 4 ++-- docs/conf.py | 8 ++++---- setup.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/LICENSE b/LICENSE index 1b7a2b56..d93175ab 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Jason Carver +Copyright (c) 2019 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 88439600..ad7eb27f 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ pip install ## Developer Setup -If you would like to hack on , please check out the -[Ethereum Development Tactical Manual](https://github.com/pipermerriam/ethereum-dev-tactical-manual) +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 diff --git a/docs/conf.py b/docs/conf.py index 0c63ed46..aaf6fb6e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,7 +54,7 @@ # General information about the project. project = '' -copyright = '2018, Jason Carver, Piper Merriam' +copyright = '2019, The Ethereum Foundation' __version__ = setup_version # The version info for the project you're documenting, acts as replacement for @@ -210,7 +210,7 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', '.tex', ' Documentation', - 'Jason Carver', 'manual'), + 'The Ethereum Foundation', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -240,7 +240,7 @@ # (source start file, name, description, authors, manual section). man_pages = [ ('index', '', ' Documentation', - ['Jason Carver'], 1) + ['The Ethereum Foundation'], 1) ] # If true, show URL addresses after external links. @@ -254,7 +254,7 @@ # dir menu entry, description, category) texinfo_documents = [ ('index', '', ' Documentation', - 'Jason Carver', '', '', + 'The Ethereum Foundation', '', '', 'Miscellaneous'), ] diff --git a/setup.py b/setup.py index 6c02fb21..904429c9 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ version='0.1.0-alpha.0', description=""": """, long_description_markdown_filename='README.md', - author='Jason Carver', + author='The Ethereum Foundation', author_email='ethcalibur+pip@gmail.com', url='https://github.com/ethereum/', include_package_data=True, From 5f3e6b37bf6f596e23b05bac12069ddc1c34fd83 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 25 Mar 2019 20:04:26 -0600 Subject: [PATCH 04/47] Remove travis config --- .travis.yml | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c5238746..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -sudo: false -language: python -dist: trusty -matrix: - include: - # - # Python 3.6 testing - # - # core - - python: "3.6" - env: TOX_POSARGS="-e py36-core" - # lint - - python: "3.6" - env: TOX_POSARGS="-e lint" - # doctest - - python: "3.6" - env: TOX_POSARGS="-e doctest" - # - # Python 3.7 testing - # - # core - - python: "3.7" - env: TOX_POSARGS="-e py37-core" - # - # pypy3 testing - # - # core - - python: "pypy3.5" - env: TOX_POSARGS="-e pypy3-core" -cache: - - pip: true -install: - - travis_retry pip install pip setuptools --upgrade - - travis_retry pip install tox -before_script: - - python --version - - pip --version - - pip freeze -script: - - tox $TOX_POSARGS From 5e6dc2999162c19f87bf123d839f693399babbb5 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Tue, 26 Mar 2019 11:51:15 -0600 Subject: [PATCH 05/47] Update default author email --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 904429c9..0203cbf7 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ description=""": """, long_description_markdown_filename='README.md', author='The Ethereum Foundation', - author_email='ethcalibur+pip@gmail.com', + author_email='snakecharmers@ethereum.org', url='https://github.com/ethereum/', include_package_data=True, install_requires=[ From 720b2cf3d2cbef46d73cff6d0e237a60d59a6b62 Mon Sep 17 00:00:00 2001 From: Christoph Burgdorf Date: Fri, 26 Apr 2019 15:59:33 +0200 Subject: [PATCH 06/47] Add mypy support --- mypy.ini | 16 ++++++++++++++++ setup.py | 1 + tox.ini | 1 + 3 files changed, 18 insertions(+) create mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000..1fcbd14c --- /dev/null +++ b/mypy.ini @@ -0,0 +1,16 @@ +[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/setup.py b/setup.py index 0203cbf7..97ac1c39 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ 'lint': [ "flake8==3.4.1", "isort>=4.2.15,<5", + "mypy==0.701", "pydocstyle>=3.0.0,<4", ], 'doc': [ diff --git a/tox.ini b/tox.ini index 63721258..e7e9920e 100644 --- a/tox.ini +++ b/tox.ini @@ -38,6 +38,7 @@ whitelist_externals=make basepython=python extras=lint commands= + mypy -p {toxinidir}/ --config-file {toxinidir}/mypy.ini flake8 {toxinidir}/ {toxinidir}/tests isort --recursive --check-only --diff {toxinidir}/ {toxinidir}/tests pydocstyle {toxinidir}/ {toxinidir}/tests From 84d2b22a7b9214b3ff40463325b2ffb338594628 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Wed, 1 May 2019 14:31:32 -0600 Subject: [PATCH 07/47] switch to native pypy markdown support --- setup.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 97ac1c39..edd66855 100644 --- a/setup.py +++ b/setup.py @@ -31,18 +31,24 @@ } extras_require['dev'] = ( - extras_require['dev'] + - extras_require['test'] + - extras_require['lint'] + + extras_require['dev'] + # noqa: W504 + extras_require['test'] + # noqa: W504 + extras_require['lint'] + # noqa: W504 extras_require['doc'] ) + +with open('./README.md') as readme: + long_description = readme.read() + + setup( name='', # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme version='0.1.0-alpha.0', description=""": """, - long_description_markdown_filename='README.md', + long_description=long_description, + long_description_content_type='text/markdown', author='The Ethereum Foundation', author_email='snakecharmers@ethereum.org', url='https://github.com/ethereum/', @@ -50,7 +56,6 @@ install_requires=[ "eth-utils>=1,<2", ], - setup_requires=['setuptools-markdown'], python_requires='>=3.6, <4', extras_require=extras_require, py_modules=[''], From dc9f04c18f9a96d6e0252275bab454c793fe1e44 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Fri, 3 May 2019 14:45:31 -0700 Subject: [PATCH 08/47] 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 a6f607881443a06c3bbf3be3aad0651651b84c8a Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 3 Jun 2019 12:22:46 -0700 Subject: [PATCH 09/47] Add vim .swo files and .mypy_cache to .gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9a48c01a..0e057278 100644 --- a/.gitignore +++ b/.gitignore @@ -85,7 +85,10 @@ logs .idea/mongoSettings.xml # VIM temp files -*.swp +*.sw[op] + +# mypy +.mypy_cache ## File-based project format: *.iws From 02fe35663c96b81bbd7512480653fbd6140d7ff5 Mon Sep 17 00:00:00 2001 From: Christoph Burgdorf Date: Mon, 29 Jul 2019 12:51:01 +0200 Subject: [PATCH 10/47] Setup towncrier to generate release notes --- .circleci/config.yml | 6 ++-- .github/PULL_REQUEST_TEMPLATE.md | 10 ++++++ Makefile | 14 ++++++++- README.md | 4 +-- docs/index.rst | 2 +- docs/{releases.rst => release_notes.rst} | 2 ++ newsfragments/README.md | 26 ++++++++++++++++ newsfragments/validate_files.py | 32 +++++++++++++++++++ pyproject.toml | 39 ++++++++++++++++++++++++ setup.py | 1 + tox.ini | 8 ++--- 11 files changed, 132 insertions(+), 12 deletions(-) rename docs/{releases.rst => release_notes.rst} (78%) create mode 100644 newsfragments/README.md create mode 100755 newsfragments/validate_files.py create mode 100644 pyproject.toml diff --git a/.circleci/config.yml b/.circleci/config.yml index bbc56d0a..fa7691e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,12 +36,12 @@ common: &common key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} jobs: - doctest: + docs: <<: *common docker: - image: circleci/python:3.6 environment: - TOXENV: doctest + TOXENV: docs lint: <<: *common docker: @@ -70,7 +70,7 @@ workflows: version: 2 test: jobs: - - doctest + - docs - lint - py36-core - py37-core diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 76ef5ac6..21d4db59 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,6 +6,16 @@ Issue # Summary of approach. +### 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) + #### Cute Animal Picture ![put a cute animal picture link inside the parentheses]() diff --git a/Makefile b/Makefile index 18f7003b..56033104 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,8 @@ build-docs: $(MAKE) -C docs clean $(MAKE) -C docs html $(MAKE) -C docs doctest + ./newsfragments/validate_files.py + towncrier --draft --version preview docs: build-docs open docs/_build/html/index.html @@ -49,13 +51,23 @@ linux-docs: build-docs xdg-open docs/_build/html/index.html release: clean + CURRENT_SIGN_SETTING=$(git config commit.gpgSign) git config commit.gpgSign true - bumpversion $(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) + # Before we bump the version, make sure that the towncrier-generated docs will build + make build-docs + # We need --allow-dirty because of the generated release_notes file that goes into the release + # commit. No other files are added accidentially. The dry-run still runs *without* --allow-dirty + bumpversion --allow-dirty $(bump) git push upstream && git push upstream --tags python setup.py sdist bdist_wheel twine upload dist/* git config commit.gpgSign "$(CURRENT_SIGN_SETTING)" + dist: clean python setup.py sdist bdist_wheel ls -l dist diff --git a/README.md b/README.md index ad7eb27f..3ceb98c9 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,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, -and the previous stable branch is released from said branch). To include changes made with each -release, update "docs/releases.rst" with the changes, and apply commit directly to master -before release. +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/index.rst b/docs/index.rst index b3598a41..89815efa 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,7 +10,7 @@ Contents :maxdepth: 3 - releases + release_notes Indices and tables diff --git a/docs/releases.rst b/docs/release_notes.rst similarity index 78% rename from docs/releases.rst rename to docs/release_notes.rst index 6fdd6c97..63786aca 100644 --- a/docs/releases.rst +++ b/docs/release_notes.rst @@ -1,6 +1,8 @@ Release Notes ============= +.. towncrier release notes start + v0.1.0-alpha.1 -------------- diff --git a/newsfragments/README.md b/newsfragments/README.md new file mode 100644 index 00000000..09c1cc8d --- /dev/null +++ b/newsfragments/README.md @@ -0,0 +1,26 @@ +This directory collects "newsfragments": short files that each contain +a snippet of ReST-formatted text that will be added to the next +release notes. This should be a description of aspects of the change +(if any) that are relevant to users. (This contrasts with the +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: + +* `feature` +* `bugfix` +* `performance` +* `doc` +* `removal` +* `misc` + +So for example: `123.feature.rst`, `456.bugfix.rst` + +If the PR fixes an issue, use that number here. If there is no issue, +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 + will look like in the final release notes. \ No newline at end of file diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py new file mode 100755 index 00000000..c6695bc7 --- /dev/null +++ b/newsfragments/validate_files.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +# 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 + +ALLOWED_EXTENSIONS = { + '.bugfix.rst', + '.doc.rst', + '.feature.rst', + '.misc.rst', + '.performance.rst', + '.removal.rst', +} + +ALLOWED_FILES = { + 'validate_files.py', + 'README.md', +} + +THIS_DIR = pathlib.Path(__file__).parent + +for fragment_file in THIS_DIR.iterdir(): + + if fragment_file.name in ALLOWED_FILES: + continue + + full_extension = "".join(fragment_file.suffixes) + if full_extension not in ALLOWED_EXTENSIONS: + raise Exception(f"Unexpected file: {fragment_file}") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..42a4130e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[tool.towncrier] +# Read https://github.com/ethereum//newsfragments/README.md for instructions +package = "" +filename = "docs/release_notes.rst" +directory = "newsfragments" +underlines = ["-", "~", "^"] +issue_format = "`#{issue} /issues/{issue}>`__" + +# Configure all default sections plus an extra one for performance improvements. + +[[tool.towncrier.type]] +directory = "feature" +name = "Features" +showcontent = true + +[[tool.towncrier.type]] +directory = "bugfix" +name = "Bugfixes" +showcontent = true + +[[tool.towncrier.type]] +directory = "performance" +name = "Performance improvements" +showcontent = true + +[[tool.towncrier.type]] +directory = "doc" +name = "Improved Documentation" +showcontent = true + +[[tool.towncrier.type]] +directory = "removal" +name = "Deprecations and Removals" +showcontent = true + +[[tool.towncrier.type]] +directory = "misc" +name = "Miscellaneous internal changes" +showcontent = false \ No newline at end of file diff --git a/setup.py b/setup.py index edd66855..54dbd6ca 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ 'doc': [ "Sphinx>=1.6.5,<2", "sphinx_rtd_theme>=0.1.9", + "towncrier>=19.2.0, <20", ], 'dev': [ "bumpversion>=0.5.3,<1", diff --git a/tox.ini b/tox.ini index e7e9920e..953e83ab 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ envlist= py{36,37,py3}-core lint - doctest + docs [isort] combine_as_imports=True @@ -23,15 +23,15 @@ ignore= usedevelop=True commands= core: pytest {posargs:tests/core} - doctest: make -C {toxinidir}/docs doctest + docs: make build-docs basepython = - doctest: python + docs: python py36: python3.6 py37: python3.7 pypy3: pypy3 extras= test - doctest: doc + docs: doc whitelist_externals=make [testenv:lint] From 07eecb5c69b9c92e5e5699fafded51bbfaddca54 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 25 Nov 2019 12:22:29 -0800 Subject: [PATCH 11/47] Separate release-note build from release --- Makefile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 56033104..5e087e37 100644 --- a/Makefile +++ b/Makefile @@ -50,18 +50,24 @@ docs: build-docs linux-docs: build-docs xdg-open docs/_build/html/index.html -release: clean - CURRENT_SIGN_SETTING=$(git config commit.gpgSign) - git config commit.gpgSign true +notes: # 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) # Before we bump the version, make sure that the towncrier-generated docs will build make build-docs - # We need --allow-dirty because of the generated release_notes file that goes into the release - # commit. No other files are added accidentially. The dry-run still runs *without* --allow-dirty - bumpversion --allow-dirty $(bump) + git commit -m "Compile release notes" + +release: 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 + ./newsfragments/validate_files.py is-empty + make build-docs + CURRENT_SIGN_SETTING=$(git config commit.gpgSign) + git config commit.gpgSign true + bumpversion $(bump) git push upstream && git push upstream --tags python setup.py sdist bdist_wheel twine upload dist/* From 89363b2d9b67c30a04dc9aa3ef2ad6e1ad1b1709 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 25 Nov 2019 12:28:05 -0800 Subject: [PATCH 12/47] Add internal type for release notes --- newsfragments/README.md | 3 ++- newsfragments/validate_files.py | 17 ++++++++++++++--- pyproject.toml | 11 +++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/newsfragments/README.md b/newsfragments/README.md index 09c1cc8d..09a10ddc 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -12,6 +12,7 @@ Each file should be named like `..rst`, where * `bugfix` * `performance` * `doc` +* `internal` * `removal` * `misc` @@ -23,4 +24,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 --draft` to get a preview of what the release notes entry - will look like in the final release notes. \ No newline at end of file + will look like in the final release notes. diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index c6695bc7..c0e9b289 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -5,11 +5,13 @@ import os import pathlib +import sys ALLOWED_EXTENSIONS = { '.bugfix.rst', '.doc.rst', '.feature.rst', + '.internal.rst', '.misc.rst', '.performance.rst', '.removal.rst', @@ -22,11 +24,20 @@ 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', ) + for fragment_file in THIS_DIR.iterdir(): if fragment_file.name in ALLOWED_FILES: continue - - full_extension = "".join(fragment_file.suffixes) - if full_extension not in ALLOWED_EXTENSIONS: + elif num_args == 0: + 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': raise Exception(f"Unexpected file: {fragment_file}") + else: + raise RuntimeError("Strange: arguments {sys.argv} were validated, but not found") diff --git a/pyproject.toml b/pyproject.toml index 42a4130e..a9724ba6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,8 +6,6 @@ directory = "newsfragments" underlines = ["-", "~", "^"] issue_format = "`#{issue} /issues/{issue}>`__" -# Configure all default sections plus an extra one for performance improvements. - [[tool.towncrier.type]] directory = "feature" name = "Features" @@ -33,7 +31,12 @@ directory = "removal" name = "Deprecations and Removals" showcontent = true +[[tool.towncrier.type]] +directory = "internal" +name = "Internal Changes - for Contributors" +showcontent = true + [[tool.towncrier.type]] directory = "misc" -name = "Miscellaneous internal changes" -showcontent = false \ No newline at end of file +name = "Miscellaneous changes" +showcontent = false From 4ab4a01a360d2e6b61f4c144f5613f7c5a9acddd Mon Sep 17 00:00:00 2001 From: Nick Gheorghita Date: Thu, 12 Dec 2019 13:21:22 +0100 Subject: [PATCH 13/47] 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 14/47] 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 15/47] 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 16/47] 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 @@ # 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 17/47] 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 @@ 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 18/47] 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 19/47] 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 20/47] 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 21/47] 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 22/47] 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 23/47] 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 24/47] 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 25/47] 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 @@ 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 26/47] 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 @@ "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 27/47] 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 28/47] 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 -## Plugin-specific files: +## IntelliJ +out/ -# IntelliJ -/out/ -.idea* +## Plugin-specific files: -#pip wheel metadata -pip-wheel-metadata +### mpeltonen/sbt-idea plugin +.idea_modules/ -# 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 29/47] 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 @@ '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 30/47] 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 31/47] 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 32/47] 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 @@ '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 33/47] 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 @@ '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 34/47] 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 @@ '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 35/47] 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 @@ 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 @@ 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 36/47] 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 37/47] 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 38/47] 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 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 39/47] 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 40/47] 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 41/47] 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 @@ '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 42/47] 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 caee07810f36719e388ad3642cf3a3ad86575b02 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 18 Aug 2022 11:47:36 -0700 Subject: [PATCH 43/47] Fill any new template variable usages --- .github/PULL_REQUEST_TEMPLATE.md | 6 +++--- README.md | 4 ++-- docs/Makefile | 8 ++++---- pyproject.toml | 10 +++++----- setup.py | 2 +- tox.ini | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 21d4db59..8f408c84 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -11,10 +11,10 @@ Summary of approach. [//]: # (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) +[//]: # (For important changes that should go into the release notes please add a newsfragment file as explained here: https://github.com/ethereum/py-ssz/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) +[//]: # (See: https://ssz.readthedocs.io/en/latest/contributing.html#pull-requests) +- [ ] Add entry to the [release notes](https://github.com/ethereum/py-ssz/blob/master/newsfragments/README.md) #### Cute Animal Picture diff --git a/README.md b/README.md index 3fbbdbf9..afc0e18a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Python implementation of the Simple Serialization encoding and decoding Read more in the [documentation on ReadTheDocs](https://ssz.readthedocs.io/). [View the change log](https://ssz.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). +Read more in the [documentation on ReadTheDocs](https://ssz.readthedocs.io/). [View the change log](https://ssz.readthedocs.io/en/latest/release_notes.html). >>>>>>> template ## Quickstart @@ -23,7 +23,7 @@ pip install ssz ## Developer Setup -If you would like to hack on , please check out the [Snake Charmers +If you would like to hack on py-ssz, please check out the [Snake Charmers Tactical Manual](https://github.com/ethereum/snake-charmers-tactical-manual) for information on how we do: diff --git a/docs/Makefile b/docs/Makefile index aa0085b3..bf87e7b4 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/.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ssz.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ssz.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/" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/" + @echo "# mkdir -p $$HOME/.local/share/devhelp/ssz" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ssz" @echo "# devhelp" epub: diff --git a/pyproject.toml b/pyproject.toml index 31433140..eec0fe32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [tool.towncrier] -# Read https://github.com/ethereum//newsfragments/README.md for instructions -package = "" +# Read https://github.com/ethereum/py-ssz/newsfragments/README.md for instructions +package = "ssz" filename = "docs/release_notes.rst" directory = "newsfragments" underlines = ["-", "~", "^"] -title_format = " v{version} ({project_date})" -issue_format = "`#{issue} /issues/{issue}>`__" +title_format = "py-ssz v{version} ({project_date})" +issue_format = "`#{issue} `__" [[tool.towncrier.type]] directory = "feature" @@ -34,7 +34,7 @@ showcontent = true [[tool.towncrier.type]] directory = "internal" -name = "Internal Changes - for Contributors" +name = "Internal Changes - for py-ssz Contributors" showcontent = true [[tool.towncrier.type]] diff --git a/setup.py b/setup.py index 59fb67c8..d99d30e6 100644 --- a/setup.py +++ b/setup.py @@ -71,7 +71,7 @@ zip_safe=False, keywords="ethereum", packages=find_packages(exclude=["tests", "tests.*"]), - package_data={'': ['py.typed']}, + package_data={'ssz': ['py.typed']}, classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", diff --git a/tox.ini b/tox.ini index 374d6986..7ffd0fce 100644 --- a/tox.ini +++ b/tox.ini @@ -54,4 +54,4 @@ commands= flake8 {toxinidir}/ssz {toxinidir}/tests {toxinidir}/scripts black --check {toxinidir}/ssz {toxinidir}/tests {toxinidir}/scripts isort --recursive --check-only --diff {toxinidir}/ssz {toxinidir}/tests {toxinidir}/scripts - pydocstyle --explain {toxinidir}/ {toxinidir}/tests + pydocstyle --explain {toxinidir}/ssz {toxinidir}/tests From 272b52abe36b947702bf3f6b99e5ce8106214653 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 18 Aug 2022 11:52:54 -0700 Subject: [PATCH 44/47] Upgrade black, follow latest style rules --- scripts/benchmark/tree_hash.py | 8 ++++---- setup.py | 12 ++++++------ ssz/abc.py | 4 ++-- ssz/cache/cache.py | 2 +- ssz/cache/utils.py | 2 +- ssz/examples/zoo.py | 2 +- ssz/hash.py | 2 +- ssz/hash_tree.py | 2 +- ssz/hashable_container.py | 3 +-- ssz/hashable_structure.py | 6 ++---- ssz/utils.py | 8 ++++---- tests/hashable/chunk_strategies.py | 4 ++-- tests/misc/test_cache.py | 2 +- tests/misc/test_utils.py | 4 ++-- tests/sedes/test_basic_sedes.py | 6 +++--- tests/sedes/test_composite_sedes.py | 18 +++++++++--------- tests/sedes/test_fixed_size_sedes.py | 16 ++++++++-------- tests/tools/test_parsing_and_dumping.py | 4 ++-- tests/tree_hash/test_basic_sedes_trie_hash.py | 2 +- 19 files changed, 52 insertions(+), 55 deletions(-) diff --git a/scripts/benchmark/tree_hash.py b/scripts/benchmark/tree_hash.py index fa3859be..23f46115 100644 --- a/scripts/benchmark/tree_hash.py +++ b/scripts/benchmark/tree_hash.py @@ -26,8 +26,8 @@ TOLERABLE_PERFORMANCE = 15 # Seconds -VALIDATOR_REGISTRY_LIMIT = 2 ** 40 # (= 1,099,511,627,776) -EPOCHS_PER_HISTORICAL_VECTOR = 2 ** 16 # (= 65,536) +VALIDATOR_REGISTRY_LIMIT = 2**40 # (= 1,099,511,627,776) +EPOCHS_PER_HISTORICAL_VECTOR = 2**16 # (= 65,536) FAR_FUTURE_EPOCH = 0 @@ -252,7 +252,7 @@ def make_state_hashable(num_validators): def prepare_state_benchmark(): - num_validators = 2 ** 17 + num_validators = 2**17 state = make_state(num_validators) print("state.hash_tree_root\t", state.hash_tree_root.hex()) index = 100 @@ -291,7 +291,7 @@ def benchmark(): def prepare_state_benchmark_hashable(): - num_validators = 2 ** 17 + num_validators = 2**17 state = make_state_hashable(num_validators) print("state.hash_tree_root\t", state.root.hex()) index = 100 diff --git a/setup.py b/setup.py index d99d30e6..55d9e198 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ "mypy-extensions>=0.4.1,<1.0.0", ], "lint": [ - "black==19.3b", + "black>=22.6.0,<23", "flake8==3.7.9", "isort>=4.3.21,<5", "pydocstyle>=5.0.0,<6", @@ -41,7 +41,7 @@ + extras_require["doc"] ) -with open('./README.md') as readme: +with open("./README.md") as readme: long_description = readme.read() @@ -51,9 +51,9 @@ version="0.2.4", description="""ssz: Python implementation of the Simple Serialization encoding and decoding""", long_description=long_description, - long_description_content_type='text/markdown', - author='The Ethereum Foundation', - author_email='snakecharmers@ethereum.org', + long_description_content_type="text/markdown", + author="The Ethereum Foundation", + author_email="snakecharmers@ethereum.org", url="https://github.com/ethereum/py-ssz", include_package_data=True, install_requires=[ @@ -71,7 +71,7 @@ zip_safe=False, keywords="ethereum", packages=find_packages(exclude=["tests", "tests.*"]), - package_data={'ssz': ['py.typed']}, + package_data={"ssz": ["py.typed"]}, classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", diff --git a/ssz/abc.py b/ssz/abc.py index 0dc80e14..a9fdb1df 100644 --- a/ssz/abc.py +++ b/ssz/abc.py @@ -87,7 +87,7 @@ def set(self: TStructure, index: int, value: TElement) -> TStructure: @abstractmethod def evolver( - self: TStructure + self: TStructure, ) -> "HashableStructureEvolverAPI[TStructure, TElement]": ... @@ -111,7 +111,7 @@ def __mul__(self: TStructure, times: int) -> TStructure: @abstractmethod def evolver( - self: TStructure + self: TStructure, ) -> "ResizableHashableStructureEvolverAPI[TStructure, TElement]": ... diff --git a/ssz/cache/cache.py b/ssz/cache/cache.py index 4c0c2ade..d0e0ada6 100644 --- a/ssz/cache/cache.py +++ b/ssz/cache/cache.py @@ -8,7 +8,7 @@ else: MM = MutableMapping -DEFAULT_CACHE_SIZE = 2 ** 10 +DEFAULT_CACHE_SIZE = 2**10 class SSZCache(MM): diff --git a/ssz/cache/utils.py b/ssz/cache/utils.py index 905b3391..0d53c8bb 100644 --- a/ssz/cache/utils.py +++ b/ssz/cache/utils.py @@ -15,7 +15,7 @@ def get_key(sedes, value: Any) -> str: return f"{sedes.get_sedes_id()}{key}" -@functools.lru_cache(maxsize=2 ** 12) +@functools.lru_cache(maxsize=2**12) def get_base_key(sedes: TSedes, value: Any) -> bytes: return sedes.serialize(value) diff --git a/ssz/examples/zoo.py b/ssz/examples/zoo.py index 9dcc4f2b..0b11b9ed 100644 --- a/ssz/examples/zoo.py +++ b/ssz/examples/zoo.py @@ -26,7 +26,7 @@ class Animal(HashableContainer): fields = [ ("id_hash", bytes32), ("public_key", bytes48), - ("clock_in_records", List(ClockInRecords, 2 ** 32)), + ("clock_in_records", List(ClockInRecords, 2**32)), ("vaccinated", boolean), ] diff --git a/ssz/hash.py b/ssz/hash.py index cddef34d..d0250c8f 100644 --- a/ssz/hash.py +++ b/ssz/hash.py @@ -4,7 +4,7 @@ from eth_typing import Hash32 -@functools.lru_cache(maxsize=2 ** 12) +@functools.lru_cache(maxsize=2**12) def hash_eth2(data: bytes) -> Hash32: """ Return SHA-256 hashed result. diff --git a/ssz/hash_tree.py b/ssz/hash_tree.py index 75a4ba2e..443994d1 100644 --- a/ssz/hash_tree.py +++ b/ssz/hash_tree.py @@ -274,7 +274,7 @@ def hash_layer(child_layer: RawHashTreeLayer, layer_index: int) -> RawHashTreeLa def generate_hash_tree_layers( - chunks: RawHashTreeLayer + chunks: RawHashTreeLayer, ) -> Generator[RawHashTreeLayer, None, None]: yield chunks previous_layer = chunks diff --git a/ssz/hashable_container.py b/ssz/hashable_container.py index be34b158..41e47836 100644 --- a/ssz/hashable_container.py +++ b/ssz/hashable_container.py @@ -112,7 +112,7 @@ def get_meta_from_bases(bases: Tuple[Type, ...]) -> Optional[Meta]: @to_tuple def get_field_sedes_from_fields( - fields: Sequence[Field] + fields: Sequence[Field], ) -> Generator[BaseSedes, None, None]: for _, field in fields: if isinstance(field, BaseSedes): @@ -233,7 +233,6 @@ class GenericMetaSignedHashableContainer( ): pass - else: GenericMetaHashableContainer = MetaHashableContainer # type: ignore GenericMetaSignedHashableContainer = MetaSignedHashableContainer # type: ignore diff --git a/ssz/hashable_structure.py b/ssz/hashable_structure.py index 19ba718a..3d3db3d6 100644 --- a/ssz/hashable_structure.py +++ b/ssz/hashable_structure.py @@ -274,7 +274,7 @@ def set(self: TStructure, index: int, value: TElement) -> TStructure: return self.mset(index, value) def evolver( - self: TStructure + self: TStructure, ) -> "HashableStructureEvolverAPI[TStructure, TElement]": return HashableStructureEvolver(self) @@ -366,9 +366,7 @@ def persistent(self) -> TStructure: ) ).extend(self._appended_elements) hash_tree = self._original_structure.hash_tree.mset( - *itertools.chain.from_iterable( # type: ignore - updated_chunks.items() - ) + *itertools.chain.from_iterable(updated_chunks.items()) # type: ignore ).extend(appended_chunks) return self._original_structure.__class__( diff --git a/ssz/utils.py b/ssz/utils.py index 6ca3e3c9..46d1ff16 100644 --- a/ssz/utils.py +++ b/ssz/utils.py @@ -58,7 +58,7 @@ def pad_zeros(value: bytes) -> bytes: return value.ljust(CHUNK_SIZE, b"\x00") -@functools.lru_cache(maxsize=2 ** 12) +@functools.lru_cache(maxsize=2**12) def to_chunks(packed_data: bytes) -> Tuple[bytes, ...]: size = len(packed_data) number_of_full_chunks = size // CHUNK_SIZE @@ -75,7 +75,7 @@ def to_chunks(packed_data: bytes) -> Tuple[bytes, ...]: return full_chunks + (last_chunk,) -@functools.lru_cache(maxsize=2 ** 12) +@functools.lru_cache(maxsize=2**12) def pack(serialized_values: Sequence[bytes]) -> Tuple[Hash32, ...]: if len(serialized_values) == 0: return (EMPTY_CHUNK,) @@ -84,7 +84,7 @@ def pack(serialized_values: Sequence[bytes]) -> Tuple[Hash32, ...]: return to_chunks(data) -@functools.lru_cache(maxsize=2 ** 12) +@functools.lru_cache(maxsize=2**12) def pack_bytes(byte_string: bytes) -> Tuple[bytes, ...]: if len(byte_string) == 0: return (EMPTY_CHUNK,) @@ -92,7 +92,7 @@ def pack_bytes(byte_string: bytes) -> Tuple[bytes, ...]: return to_chunks(byte_string) -@functools.lru_cache(maxsize=2 ** 12) +@functools.lru_cache(maxsize=2**12) def pack_bits(values: Sequence[bool]) -> Tuple[Hash32]: as_bytearray = get_serialized_bytearray(values, len(values), extra_byte=False) packed = bytes(as_bytearray) diff --git a/tests/hashable/chunk_strategies.py b/tests/hashable/chunk_strategies.py index 61f6ce77..be41182e 100644 --- a/tests/hashable/chunk_strategies.py +++ b/tests/hashable/chunk_strategies.py @@ -5,7 +5,7 @@ def chunk_count_st(): - return st.one_of(st.none(), st.integers(min_value=1, max_value=2 ** 5)) + return st.one_of(st.none(), st.integers(min_value=1, max_value=2**5)) def chunk_st(): @@ -13,7 +13,7 @@ def chunk_st(): def element_size_st(): - return st.builds(lambda power: 2 ** power, st.integers(min_value=0, max_value=5)) + return st.builds(lambda power: 2**power, st.integers(min_value=0, max_value=5)) @st.composite diff --git a/tests/misc/test_cache.py b/tests/misc/test_cache.py index a554b7f0..b617022c 100644 --- a/tests/misc/test_cache.py +++ b/tests/misc/test_cache.py @@ -10,7 +10,7 @@ class Foo(Serializable): @pytest.fixture def foo_with_db(): - return Foo(field1=10, field2=b"\x12" * 32, cache=SSZCache(cache_size=2 ** 10)) + return Foo(field1=10, field2=b"\x12" * 32, cache=SSZCache(cache_size=2**10)) @pytest.fixture diff --git a/tests/misc/test_utils.py b/tests/misc/test_utils.py index 73d15197..08c5f867 100644 --- a/tests/misc/test_utils.py +++ b/tests/misc/test_utils.py @@ -65,7 +65,7 @@ def test_merkleize(chunks, root): @pytest.mark.parametrize( ("limit", "success"), - ((2 ** MAX_ZERO_HASHES_LAYER, True), (2 ** MAX_ZERO_HASHES_LAYER + 1, False)), + ((2**MAX_ZERO_HASHES_LAYER, True), (2**MAX_ZERO_HASHES_LAYER + 1, False)), ) def test_merkleize_edge_case(limit, success): chunks = (A_CHUNK,) @@ -81,7 +81,7 @@ def test_merkleize_edge_case(limit, success): ( (A_CHUNK, 0, hash_eth2(A_CHUNK + b"\x00" * 32)), (B_CHUNK, 1, hash_eth2(B_CHUNK + b"\x01" + b"\x00" * 31)), - (C_CHUNK, 2 ** 256 - 1, hash_eth2(C_CHUNK + b"\xff" * 32)), + (C_CHUNK, 2**256 - 1, hash_eth2(C_CHUNK + b"\xff" * 32)), ), ) def test_mix_in_length(root, length, result): diff --git a/tests/sedes/test_basic_sedes.py b/tests/sedes/test_basic_sedes.py index fcfc29b8..cecd4888 100644 --- a/tests/sedes/test_basic_sedes.py +++ b/tests/sedes/test_basic_sedes.py @@ -20,10 +20,10 @@ def test_boolean(value, serialized): (16, 0, "0x0000"), (16, 256, "0x0001"), (16, 65536 - 1, "0xffff"), - (32, sum((i + 1) * 256 ** i for i in range(4)), "0x01020304"), + (32, sum((i + 1) * 256**i for i in range(4)), "0x01020304"), (256, 0, "0x" + "00" * 32), - (256, 0xAA * sum(256 ** i for i in range(32)), "0x" + "aa" * 32), - (256, 2 ** 256 - 1, "0x" + "ff" * 32), + (256, 0xAA * sum(256**i for i in range(32)), "0x" + "aa" * 32), + (256, 2**256 - 1, "0x" + "ff" * 32), ), ) def test_uint(bit_length, value, serialized): diff --git a/tests/sedes/test_composite_sedes.py b/tests/sedes/test_composite_sedes.py index 52e07411..dc1cf58e 100644 --- a/tests/sedes/test_composite_sedes.py +++ b/tests/sedes/test_composite_sedes.py @@ -27,11 +27,11 @@ ((0xAA,), "0xaa"), ((0xAA, 0xBB, 0xCC), "0xaabbcc"), ((0xAA,) * 256, "0x" + "aa" * 256), - ((0xAA,) * (256 ** 2 - 1), "0x" + "aa" * (256 ** 2 - 1)), + ((0xAA,) * (256**2 - 1), "0x" + "aa" * (256**2 - 1)), ), ) def test_list(value, serialized): - sedes = List(uint8, 2 ** 32) + sedes = List(uint8, 2**32) assert encode_hex(ssz.encode(value, sedes)) == serialized decoded = ssz.decode(decode_hex(serialized), sedes) assert isinstance(decoded, HashableList) @@ -44,7 +44,7 @@ def test_invalid_serialized_list(): # incorrectly register as an empty list due to mis-interpreting the failed # stream read as the stream having been empty. data = decode_hex("0x0001") - sedes = List(List(uint8, 2 ** 32), 2 ** 32) + sedes = List(List(uint8, 2**32), 2**32) with pytest.raises(DeserializationError): ssz.decode(data, sedes=sedes) @@ -75,7 +75,7 @@ def test_tuple_of_static_sized_entries(value, serialized): ), ) def test_list_of_dynamic_sized_entries(value, serialized): - sedes = Vector(List(uint8, 2 ** 32), len(value)) + sedes = Vector(List(uint8, 2**32), len(value)) assert encode_hex(ssz.encode(value, sedes)) == serialized decoded = ssz.decode(decode_hex(serialized), sedes) assert isinstance(decoded, HashableVector) @@ -96,20 +96,20 @@ def test_container_of_static_sized_fields(value, serialized): @pytest.mark.parametrize( ("fields", "value", "serialized"), ( - ((List(uint8, 2 ** 32),), ((),), "0x" "04000000"), - ((List(uint8, 2 ** 32),), ((0xAA, 0xBB),), "0x" "04000000" "aabb"), + ((List(uint8, 2**32),), ((),), "0x" "04000000"), + ((List(uint8, 2**32),), ((0xAA, 0xBB),), "0x" "04000000" "aabb"), ( - (uint8, List(uint8, 2 ** 32)), + (uint8, List(uint8, 2**32)), (0xAA, (0xBB, 0xCC)), "0x" "aa" "05000000" "bbcc", ), ( - (List(uint8, 2 ** 32), uint8), + (List(uint8, 2**32), uint8), ((0xAA, 0xBB), 0xCC), "0x" "05000000" "cc" "aabb", ), ( - (List(uint8, 2 ** 32), List(uint8, 2 ** 32)), + (List(uint8, 2**32), List(uint8, 2**32)), ((0xAA, 0xBB), (0xCC, 0xDD)), "0x" "08000000" "0a000000" "aabbccdd", ), diff --git a/tests/sedes/test_fixed_size_sedes.py b/tests/sedes/test_fixed_size_sedes.py index 5fa763d2..24a6b805 100644 --- a/tests/sedes/test_fixed_size_sedes.py +++ b/tests/sedes/test_fixed_size_sedes.py @@ -38,14 +38,14 @@ def test_fixed_size(sedes, size): @pytest.mark.parametrize( "sedes", ( - List(uint8, 2 ** 32), - List(Vector(uint8, 2), 2 ** 32), - List(List(uint8, 2 ** 32), 2 ** 32), - List(Container((uint8, Vector(uint8, 4))), 2 ** 32), - Vector(List(uint8, 2 ** 32), 2), - Container((List(uint8, 2 ** 32),)), - Container((uint8, List(uint8, 2 ** 32), uint8)), - Container((Container((List(uint8, 2 ** 32),)),)), + List(uint8, 2**32), + List(Vector(uint8, 2), 2**32), + List(List(uint8, 2**32), 2**32), + List(Container((uint8, Vector(uint8, 4))), 2**32), + Vector(List(uint8, 2**32), 2), + Container((List(uint8, 2**32),)), + Container((uint8, List(uint8, 2**32), uint8)), + Container((Container((List(uint8, 2**32),)),)), ), ) def test_dynamic_size(sedes): diff --git a/tests/tools/test_parsing_and_dumping.py b/tests/tools/test_parsing_and_dumping.py index 7ff9ad9c..9d9236d4 100644 --- a/tests/tools/test_parsing_and_dumping.py +++ b/tests/tools/test_parsing_and_dumping.py @@ -20,11 +20,11 @@ def test_dump_serializble_with_explicit_sedes(): def test_not_serializable(): octopi = (octopus, octopus, octopus) - sedes = List(Animal, 2 ** 32) + sedes = List(Animal, 2**32) output = to_formatted_dict(octopi, sedes) hashable_octopi = HashableList.from_iterable(octopi, sedes) - assert hashable_octopi == from_formatted_dict(output, List(Animal, 2 ** 32)) + assert hashable_octopi == from_formatted_dict(output, List(Animal, 2**32)) def test_custom_codec(): diff --git a/tests/tree_hash/test_basic_sedes_trie_hash.py b/tests/tree_hash/test_basic_sedes_trie_hash.py index 5382d6b6..fa50bc0c 100644 --- a/tests/tree_hash/test_basic_sedes_trie_hash.py +++ b/tests/tree_hash/test_basic_sedes_trie_hash.py @@ -12,7 +12,7 @@ def uint_and_value_strategy(draw): num_bits = 8 * 2 ** draw(st.integers(min_value=0, max_value=5)) uint = UInt(num_bits) - value = draw(st.integers(min_value=0, max_value=2 ** num_bits - 1)) + value = draw(st.integers(min_value=0, max_value=2**num_bits - 1)) return uint, value From ced5c558c94c7bf7120756735c5b297e3392fdd7 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 18 Aug 2022 12:10:03 -0700 Subject: [PATCH 45/47] Use updated pydocstyle rules --- ssz/cache/utils.py | 4 +++- ssz/hashable_container.py | 6 ++++-- ssz/hashable_structure.py | 12 ++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ssz/cache/utils.py b/ssz/cache/utils.py index 0d53c8bb..956f52ce 100644 --- a/ssz/cache/utils.py +++ b/ssz/cache/utils.py @@ -33,7 +33,9 @@ def get_merkle_leaves_with_cache( value: Any, element_sedes: TSedes, cache: CacheObj ) -> Iterable[Hash32]: """ - NOTE: cache is mutable + Generate the merkle leaves for every element in `value`, from the cache. + + NOTE: cache will be mutated when any new merkle leaves are generated. """ for element in value: key = element_sedes.get_key(element) diff --git a/ssz/hashable_container.py b/ssz/hashable_container.py index 41e47836..d3de3d48 100644 --- a/ssz/hashable_container.py +++ b/ssz/hashable_container.py @@ -90,7 +90,8 @@ def from_fields( def get_meta_from_bases(bases: Tuple[Type, ...]) -> Optional[Meta]: - """Return the meta object defined by one of the given base classes. + """ + Return the meta object defined by one of the given base classes. Returns None if no base defines a meta object. Raises a TypeError if more than one do. """ @@ -329,7 +330,8 @@ def evolver(self: TStructure) -> "HashableContainerEvolver[TStructure, TElement] class HashableContainerEvolver(HashableStructureEvolver[TStructure, TElement]): - """Base class for evolvers for hashable containers. + """ + Base class for evolvers for hashable containers. Subclasses (created dynamically by MetaHashableContainer when creating the corresponding HashableContainer) should add settable field descriptors for all fields. diff --git a/ssz/hashable_structure.py b/ssz/hashable_structure.py index 3d3db3d6..d890dc95 100644 --- a/ssz/hashable_structure.py +++ b/ssz/hashable_structure.py @@ -41,7 +41,8 @@ def update_element_in_chunk( original_chunk: Hash32, index: int, element: bytes ) -> Hash32: - """Replace part of a chunk with a given element. + """ + Replace part of a chunk with a given element. The chunk is interpreted as a concatenated sequence of equally sized elements. This function replaces the element given by its index in the chunk with the given data. @@ -49,7 +50,8 @@ def update_element_in_chunk( If the length of the element is zero or not a divisor of the chunk size, a `ValueError` is raised. If the index is out of range, an `IndexError` is raised. - Example: + .. doctest:: + >>> from ssz.hashable_structure import update_element_in_chunk >>> update_element_in_chunk(b"aabbcc", 1, b"xx") b'aaxxcc' @@ -75,7 +77,8 @@ def update_element_in_chunk( def update_elements_in_chunk( original_chunk: Hash32, updated_elements: Dict[int, bytes] ) -> Hash32: - """Update multiple elements in a chunk. + """ + Update multiple elements in a chunk. The set of updates is given by a dictionary mapping indices to elements. The items of the dictionary will be passed one by one to `update_element_in_chunk`. @@ -110,7 +113,8 @@ def get_updated_chunks( num_original_elements: int, num_padding_elements: int, ) -> Generator[Tuple[int, Hash32], None, None]: - """For an element changeset, compute the updates that have to be applied to the existing chunks. + """ + For an element changeset, compute the updates that have to be applied to the existing chunks. The changeset is given as a dictionary of element indices to updated elements and a sequence of appended elements. Note that appended elements that do not affect existing chunks are ignored. From d57ffb149ec9ae9f8e79ed1213996d3aab8ad6eb Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 18 Aug 2022 11:56:02 -0700 Subject: [PATCH 46/47] Ignore black reformatting commit --- .git-blame-ignore-revs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..00f5d151 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,4 @@ +# .git-blame-ignore-revs + +# Update black and follow new style rules +272b52abe36b947702bf3f6b99e5ce8106214653 From 2566117c6f356891adde03a5605793ab014fa50d Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 18 Aug 2022 12:36:19 -0700 Subject: [PATCH 47/47] Remove ruamel.yaml from all-test dependencies ruamel isn't building on python 3.9 or 3.10. Upgrading ruamel may fix that, but the yaml tests don't seem to be passing anyway, and weren't included in CI. So rather than try to dig in right now to fix them, just push the dependency fix to whoever decides to revive the yaml tests. --- setup.py | 5 ++++- tox.ini | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 55d9e198..e7704bcd 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,11 @@ "pytest-xdist>=2.4.0,<3", "tox==3.14.6", "hypothesis==4.54.0", - "ruamel.yaml==0.15.87", "mypy-extensions>=0.4.1,<1.0.0", ], + "yaml": [ + "ruamel.yaml==0.15.87", + ], "lint": [ "black>=22.6.0,<23", "flake8==3.7.9", @@ -39,6 +41,7 @@ + extras_require["test"] + extras_require["lint"] + extras_require["doc"] + + extras_require["yaml"] ) with open("./README.md") as readme: diff --git a/tox.ini b/tox.ini index 7ffd0fce..8539d31a 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist= lint docs benchmark + yaml [isort] force_sort_within_sections=True @@ -38,6 +39,9 @@ whitelist_externals=make [testenv:yaml] basepython=python3.6 +extras= + test + yaml commands= pytest {toxinidir}/tests/yaml_tests/test_yaml.py