From 7a57714a8df126ca823c1f347cdbd3da85f5dcea Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 31 May 2024 14:50:05 -0500 Subject: [PATCH] feat!: Ape 0.8 target (#30) --- .github/workflows/draft.yaml | 2 ++ .github/workflows/test.yaml | 2 +- README.md | 2 +- ape_arbitrum/__init__.py | 4 ++-- ape_arbitrum/ecosystem.py | 8 ++++---- pyproject.toml | 2 +- setup.py | 5 ++--- tests/test_integration.py | 16 ++++++++-------- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/draft.yaml b/.github/workflows/draft.yaml index 423582b..f136f49 100644 --- a/.github/workflows/draft.yaml +++ b/.github/workflows/draft.yaml @@ -8,6 +8,8 @@ on: jobs: update-draft: runs-on: ubuntu-latest + permissions: + contents: write steps: # Drafts your next Release notes as Pull Requests are merged into "main" - uses: release-drafter/release-drafter@v5 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index aa36e33..af337dc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -65,7 +65,7 @@ jobs: # TODO: Replace with macos-latest when works again. # https://github.com/actions/setup-python/issues/808 os: [ubuntu-latest, macos-12] # eventually add `windows-latest` - python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] + python-version: [3.9, "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 38e9ef1..b9af081 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Ecosystem Plugin for Arbitrum support in Ape. ## Dependencies -- [python3](https://www.python.org/downloads) version 3.8 up to 3.12. +- [python3](https://www.python.org/downloads) version 3.9 up to 3.12. ## Installation diff --git a/ape_arbitrum/__init__.py b/ape_arbitrum/__init__.py index 943067c..3d6915a 100644 --- a/ape_arbitrum/__init__.py +++ b/ape_arbitrum/__init__.py @@ -1,6 +1,6 @@ from ape import plugins from ape.api.networks import LOCAL_NETWORK_NAME, ForkedNetworkAPI, NetworkAPI, create_network_type -from ape_geth import GethProvider +from ape_node import Node from ape_test import LocalProvider from .ecosystem import NETWORKS, Arbitrum, ArbitrumConfig @@ -29,6 +29,6 @@ def networks(): @plugins.register(plugins.ProviderPlugin) def providers(): for network_name in NETWORKS: - yield "arbitrum", network_name, GethProvider + yield "arbitrum", network_name, Node yield "arbitrum", LOCAL_NETWORK_NAME, LocalProvider diff --git a/ape_arbitrum/ecosystem.py b/ape_arbitrum/ecosystem.py index 3e491dc..17cdc0e 100644 --- a/ape_arbitrum/ecosystem.py +++ b/ape_arbitrum/ecosystem.py @@ -1,5 +1,5 @@ import time -from typing import ClassVar, Dict, Tuple, Type, cast +from typing import ClassVar, cast from ape.api.transactions import ConfirmationsProgressBar, ReceiptAPI, TransactionAPI from ape.exceptions import ApeException, TransactionError @@ -92,7 +92,7 @@ def await_confirmations(self) -> "ReceiptAPI": def _create_config( required_confirmations: int = 1, block_time: int = 1, - cls: Type = NetworkConfig, + cls: type = NetworkConfig, **kwargs, ) -> NetworkConfig: return cls( @@ -152,7 +152,7 @@ def create_transaction(self, **kwargs) -> TransactionAPI: tx_data["data"] = b"" # Deduce the transaction type. - transaction_types: Dict[int, Type[TransactionAPI]] = { + transaction_types: dict[int, type[TransactionAPI]] = { EthTransactionType.STATIC.value: StaticFeeTransaction, EthTransactionType.DYNAMIC.value: DynamicFeeTransaction, EthTransactionType.ACCESS_LIST.value: AccessListTransaction, @@ -264,7 +264,7 @@ def decode_receipt(self, data: dict) -> ReceiptAPI: ) -def _correct_key(key: str, data: Dict, alt_keys: Tuple[str, ...]) -> Dict: +def _correct_key(key: str, data: dict, alt_keys: tuple[str, ...]) -> dict: if key in data: return data diff --git a/pyproject.toml b/pyproject.toml index 340845e..8057ac0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ write_to = "ape_arbitrum/version.py" [tool.black] line-length = 100 -target-version = ['py38', 'py39', 'py310', 'py311'] +target-version = ['py39', 'py310', 'py311', 'py312'] include = '\.pyi?$' [tool.pytest.ini_options] diff --git a/setup.py b/setup.py index d29c77b..896217f 100644 --- a/setup.py +++ b/setup.py @@ -71,11 +71,11 @@ url="https://github.com/ApeWorX/ape-arbitrum", include_package_data=True, install_requires=[ - "eth-ape>=0.7.6,<0.8", + "eth-ape>=0.8.1,<0.9", "eth-pydantic-types", # Use same version as eth-ape "ethpm-types", # Use same version as eth-ape ], - python_requires=">=3.8,<4", + python_requires=">=3.9,<4", extras_require=extras_require, py_modules=["ape_arbitrum"], license="Apache-2.0", @@ -91,7 +91,6 @@ "Operating System :: MacOS", "Operating System :: POSIX", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/tests/test_integration.py b/tests/test_integration.py index 28c10df..a12b4d7 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -4,12 +4,12 @@ EXPECTED_OUTPUT = """ arbitrum +├── local (default) +│ └── test (default) ├── mainnet -│ └── geth (default) -├── sepolia -│ └── geth (default) -└── local (default) - └── test (default) +│ └── node (default) +└── sepolia + └── node (default) """.strip() @@ -46,8 +46,8 @@ def assert_rich_text(actual: str, expected: str): def test_networks(runner, cli, arbitrum): # Do this in case local env changed it. - arbitrum.mainnet.set_default_provider("geth") - arbitrum.sepolia.set_default_provider("geth") + arbitrum.mainnet.set_default_provider("node") + arbitrum.sepolia.set_default_provider("node") - result = runner.invoke(cli, ["networks", "list"]) + result = runner.invoke(cli, ("networks", "list")) assert_rich_text(result.output, EXPECTED_OUTPUT)