Skip to content

Commit

Permalink
feat!: ape 0.7 upgrade (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Dec 19, 2023
1 parent 455d68b commit c1f4225
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
1 change: 0 additions & 1 deletion .mdformat.toml

This file was deleted.

10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: check-yaml

Expand All @@ -10,24 +10,24 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.0
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.7.1
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools, pydantic]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies: [mdformat-gfm, mdformat-frontmatter]
Expand Down
6 changes: 3 additions & 3 deletions ape_tenderly/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import requests
from ape.exceptions import ConfigError
from ape.utils import cached_property
from pydantic import BaseModel, parse_obj_as
from ethpm_types import BaseModel

TENDERLY_PROJECT = "TENDERLY_PROJECT"
TENDERLY_ACCESS_KEY = "TENDERLY_ACCESS_KEY"
Expand Down Expand Up @@ -53,7 +53,7 @@ def get_forks(self) -> List[Fork]:
raise TenderlyClientError(f"Error processing request: {response.text}")

if forks := response.json():
return parse_obj_as(List[Fork], forks)
return [Fork.model_validate_json(x) for x in forks]

else:
return []
Expand All @@ -71,7 +71,7 @@ def create_fork(self, chain_id: int) -> Fork:
if not response.ok:
raise TenderlyClientError(f"Error processing request: {response.text}")

return parse_obj_as(Fork, response.json().get("fork"))
return Fork.model_validate_json(response.json().get("fork"))

def remove_fork(self, fork_id: str):
response = self._authenticated_session.delete(f"{self._api_uri}/forks/{fork_id}")
Expand Down
3 changes: 2 additions & 1 deletion ape_tenderly/provider.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import atexit

from ape.api import PluginConfig, UpstreamProvider, Web3Provider
from ape.api import PluginConfig, UpstreamProvider
from ape.exceptions import ProviderError
from ape.logging import logger
from ape.utils import cached_property
from ape_ethereum.provider import Web3Provider
from web3 import HTTPProvider, Web3
from web3.gas_strategies.rpc import rpc_gas_price_strategy
from web3.middleware import geth_poa_middleware
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ force_grid_wrap = 0
include_trailing_comma = true
multi_line_output = 3
use_parentheses = true

[tool.mdformat]
number = true
20 changes: 12 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
extras_require = {
"test": [ # `test` GitHub Action jobs uses this
"pytest>=6.0", # Core testing package
"pytest-xdist", # multi-process runner
"pytest-xdist", # Multi-process runner
"pytest-cov", # Coverage analyzer plugin
"hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer
],
"lint": [
"black>=23.3.0,<24", # Auto-formatter and linter
"mypy>=0.991,<1", # Static type analyzer
"black>=23.12.0,<24", # Auto-formatter and linter
"mypy>=1.7.1,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"types-requests", # Needed for mypy typeshed
"flake8>=6.0.0,<7", # Style linter
"types-requests", # Needed for mypy type shed
"flake8>=6.1.0,<7", # Style linter
"flake8-breakpoint>=1.1.0,<2", # Detect breakpoints left in code
"flake8-print>=5.0.0,<6", # Detect print statements left in code
"isort>=5.10.1,<6", # Import sorting linter
"mdformat>=0.7.16", # Auto-formatter for markdown
"mdformat>=0.7.17", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown
"mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates
"mdformat-pyproject>=0.0.1", # Allows configuring in pyproject.toml
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
Expand Down Expand Up @@ -58,8 +61,9 @@
url="https://github.com/ApeWorX/ape-tenderly",
include_package_data=True,
install_requires=[
"eth-ape>=0.6.0,<0.7",
"requests>=2.28.1,<3",
"eth-ape>=0.7.0,<0.8",
"eth-pydantic-types", # Use same version as eth-ape
"requests", # Use same version as eth-ape
],
python_requires=">=3.8,<4",
extras_require=extras_require,
Expand Down
1 change: 1 addition & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_missing_gateway_secret(client):
client.get_gateway_rpc_uri("doesnt", "matter")


@pytest.mark.skip(reason="Requires a subscription to Tenderly's premium service.")
def test_create_fork(client):
assert len(client.get_forks()) == 0
fork = client.create_fork(1)
Expand Down

0 comments on commit c1f4225

Please sign in to comment.