Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Add support for Python 3.8 #1679

Merged
merged 4 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 99 additions & 99 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,173 +113,173 @@ eth2_fixtures: &eth2_fixtures
- ./eth2-fixtures
key: cache-v3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}-{{ checksum "./.circleci/get_eth2_fixtures.sh" }}-{{ checksum "./.circleci/build_geth.sh" }}
jobs:
py36-lint:
py38-lint:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-lint
TOXENV: py38-lint
py37-lint:
<<: *common
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-lint
py36-lint-eth2:
py38-lint-eth2:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-lint-eth2
TOXENV: py38-lint-eth2
py37-lint-eth2:
<<: *common
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-lint-eth2

py36-docs:
py38-docs:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-docs
TOXENV: py38-docs

py36-rpc-state-byzantium:
py38-rpc-state-byzantium:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-byzantium
py36-rpc-state-constantinople:
TOXENV: py38-rpc-state-byzantium
py38-rpc-state-constantinople:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-constantinople
py36-rpc-state-frontier:
TOXENV: py38-rpc-state-constantinople
py38-rpc-state-frontier:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-frontier
py36-rpc-state-homestead:
TOXENV: py38-rpc-state-frontier
py38-rpc-state-homestead:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-homestead
py36-rpc-state-istanbul:
TOXENV: py38-rpc-state-homestead
py38-rpc-state-istanbul:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-istanbul
py36-rpc-state-petersburg:
TOXENV: py38-rpc-state-istanbul
py38-rpc-state-petersburg:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-petersburg
TOXENV: py38-rpc-state-petersburg

py36-rpc-state-tangerine_whistle:
py38-rpc-state-tangerine_whistle:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-tangerine_whistle
py36-rpc-state-spurious_dragon:
TOXENV: py38-rpc-state-tangerine_whistle
py38-rpc-state-spurious_dragon:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-state-spurious_dragon
py36-rpc-blockchain:
TOXENV: py38-rpc-state-spurious_dragon
py38-rpc-blockchain:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-rpc-blockchain
TOXENV: py38-rpc-blockchain

py36-eth1-core:
py38-eth1-core:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth1-core
py36-integration:
TOXENV: py38-eth1-core
py38-integration:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-integration
py36-lightchain_integration:
TOXENV: py38-integration
py38-lightchain_integration:
<<: *geth_steps
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-lightchain_integration
TOXENV: py38-lightchain_integration
GETH_VERSION: v1.8.22
py36-long_run_integration:
py38-long_run_integration:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-long_run_integration
py36-p2p:
TOXENV: py38-long_run_integration
py38-p2p:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-p2p
py36-p2p-trio:
TOXENV: py38-p2p
py38-p2p-trio:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-p2p-trio
py36-eth2-core:
TOXENV: py38-p2p-trio
py38-eth2-core:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth2-core
py36-eth2-utils:
TOXENV: py38-eth2-core
py38-eth2-utils:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth2-utils
py36-eth2-fixtures:
TOXENV: py38-eth2-utils
py38-eth2-fixtures:
<<: *eth2_fixtures
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth2-fixtures
py36-eth2-integration:
TOXENV: py38-eth2-fixtures
py38-eth2-integration:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth2-integration
py36-wheel-cli:
TOXENV: py38-eth2-integration
py38-wheel-cli:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-wheel-cli
py36-eth1-components:
TOXENV: py38-wheel-cli
py38-eth1-components:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth1-components
py36-eth2-trio:
TOXENV: py38-eth1-components
py38-eth2-trio:
<<: *common
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
environment:
TOXENV: py36-eth2-trio
TOXENV: py38-eth2-trio

py37-rpc-state-quadratic:
<<: *common
Expand Down Expand Up @@ -398,16 +398,16 @@ workflows:
test:
jobs:
# These tests are long, so should be started first to optimize for total suite run time
- py36-integration
- py36-wheel-cli
- py38-integration
- py38-wheel-cli
- py37-wheel-cli
- py36-long_run_integration
- py38-long_run_integration
- py37-rpc-state-sstore
- py36-eth2-core
- py38-eth2-core
- py37-eth2-core
- py37-libp2p

- py36-docs
- py38-docs

- py37-eth1-core
- py37-p2p
Expand All @@ -422,28 +422,28 @@ workflows:
- py37-rpc-state-quadratic
- py37-rpc-state-zero_knowledge

- py36-rpc-state-byzantium
- py36-rpc-state-constantinople
- py36-rpc-state-frontier
- py36-rpc-state-homestead
- py36-rpc-state-petersburg
- py36-rpc-state-spurious_dragon
- py36-rpc-state-tangerine_whistle
- py36-rpc-blockchain
- py38-rpc-state-byzantium
- py38-rpc-state-constantinople
- py38-rpc-state-frontier
- py38-rpc-state-homestead
- py38-rpc-state-petersburg
- py38-rpc-state-spurious_dragon
- py38-rpc-state-tangerine_whistle
- py38-rpc-blockchain

- py36-eth1-core
- py36-p2p
- py36-p2p-trio
- py36-eth2-utils
- py36-eth2-fixtures
- py36-eth2-integration
- py36-eth1-components
- py36-eth2-trio
- py38-eth1-core
- py38-p2p
- py38-p2p-trio
- py38-eth2-utils
- py38-eth2-fixtures
- py38-eth2-integration
- py38-eth1-components
- py38-eth2-trio

- py36-lightchain_integration
- py38-lightchain_integration

- py36-lint
- py36-lint-eth2
- py38-lint
- py38-lint-eth2
- py37-lint
- py37-lint-eth2

Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
image: latest
python:
version: 3.6
version: 3.7
install:
- method: pip
path: .
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ To develop on top of Trinity or to contribute to the project, check out the
Installing on Ubuntu
--------------------

Trinity requires Python 3.6 as well as some tools to compile its dependencies. On Ubuntu, the
``python3.6-dev`` package contains everything we need. Run the following command to install it.
Trinity requires Python 3.7 as well as some tools to compile its dependencies. On Ubuntu, the
``python3.7-dev`` package contains everything we need. Run the following command to install it.

.. code:: sh
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1675.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for Python 3.6 making Python 3.7 the minimal supported Python version.
17 changes: 16 additions & 1 deletion p2p/_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import collections
from typing import Hashable, Sequence, Tuple, TypeVar
from typing import Hashable, Sequence, Tuple, TypeVar, AsyncGenerator, Any

import rlp

Expand Down Expand Up @@ -93,3 +93,18 @@ def duplicates(elements: Sequence[TValue]) -> Tuple[TValue, ...]:
collections.Counter(elements).items()
if count > 1
)


TCo = TypeVar('TCo')
TContra = TypeVar('TContra')


class aclosing:
def __init__(self, aiter: AsyncGenerator[TCo, TContra]) -> None:
self._aiter = aiter

async def __aenter__(self) -> AsyncGenerator[TCo, TContra]:
return self._aiter

async def __aexit__(self, *args: Any) -> None:
await self._aiter.aclose()
5 changes: 2 additions & 3 deletions p2p/behaviors.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import contextlib
from typing import (
AsyncIterator,
)

from async_generator import asynccontextmanager

from eth_utils import ValidationError

from p2p.abc import (
Expand Down Expand Up @@ -36,7 +35,7 @@ def should_apply_to(self, connection: 'ConnectionAPI') -> bool:
# mypy bug: https://github.com/python/mypy/issues/708
return self.qualifier(connection, self.logic) # type: ignore

@asynccontextmanager
@contextlib.asynccontextmanager
async def apply(self, connection: ConnectionAPI) -> AsyncIterator[None]:
if self._applied_to is not None:
raise ValidationError(
Expand Down
Loading