Skip to content

Commit

Permalink
feat!: Ape 0.8 target (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: Dalena <[email protected]>
  • Loading branch information
antazoey and dtdang authored May 31, 2024
1 parent f6523f2 commit 6d4fe9f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Ecosystem Plugin for [Base](https://base.org/) 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

Expand Down
4 changes: 2 additions & 2 deletions ape_base/__init__.py
Original file line number Diff line number Diff line change
@@ -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, Base, BaseConfig
Expand Down Expand Up @@ -29,6 +29,6 @@ def networks():
@plugins.register(plugins.ProviderPlugin)
def providers():
for network_name in NETWORKS:
yield "base", network_name, GethProvider
yield "base", network_name, Node

yield "base", LOCAL_NETWORK_NAME, LocalProvider
6 changes: 3 additions & 3 deletions ape_base/ecosystem.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import ClassVar, Dict, Tuple, Type, cast
from typing import ClassVar, cast

from ape.api import TransactionAPI
from ape.types import TransactionSignature
Expand Down Expand Up @@ -72,7 +72,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]] = {
TransactionType.STATIC.value: StaticFeeTransaction,
TransactionType.DYNAMIC.value: DynamicFeeTransaction,
TransactionType.ACCESS_LIST.value: AccessListTransaction,
Expand Down Expand Up @@ -142,7 +142,7 @@ def create_transaction(self, **kwargs) -> TransactionAPI:
return txn_class(**tx_data)


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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ write_to = "ape_base/version.py"

[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
target-version = ['py39', 'py310', 'py311', 'py312']
include = '\.pyi?$'

[tool.pytest.ini_options]
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
url="https://github.com/ApeWorX/ape-base",
include_package_data=True,
install_requires=[
"eth-ape>=0.7.6,<0.8",
"ape-optimism>=0.7.2,<0.8",
"eth-ape>=0.8.1,<0.9",
"ape-optimism", # Ape determines the version
"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_base"],
license="Apache-2.0",
Expand All @@ -80,7 +80,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",
Expand Down
16 changes: 8 additions & 8 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

EXPECTED_OUTPUT = """
base
├── local (default)
│ └── test (default)
├── mainnet
│ └── geth (default)
├── sepolia
│ └── geth (default)
└── local (default)
└── test (default)
│ └── node (default)
└── sepolia
└── node (default)
""".strip()


Expand Down Expand Up @@ -46,8 +46,8 @@ def assert_rich_text(actual: str, expected: str):

def test_networks(runner, cli, base):
# Do this in case local env changed it.
base.mainnet.set_default_provider("geth")
base.sepolia.set_default_provider("geth")
base.mainnet.set_default_provider("node")
base.sepolia.set_default_provider("node")

result = runner.invoke(cli, ["networks", "list"])
result = runner.invoke(cli, ("networks", "list"))
assert_rich_text(result.output, EXPECTED_OUTPUT)

0 comments on commit 6d4fe9f

Please sign in to comment.