Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support web3.py dependencies #17

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e .[release]

- name: Build
run: python setup.py sdist bdist_wheel

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ jobs:

strategy:
matrix:
# 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"]
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -83,7 +81,7 @@ jobs:
- name: Run Tests
run: pytest -m "not fuzzing" -n 0 -s --cov
env:
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
TENDERLY_GATEWAY_ACCESS_KEY: ${{ secrets.TENDERLY_GATEWAY_ACCESS_KEY }}

# NOTE: uncomment this block after you've marked tests with @pytest.mark.fuzzing
# fuzzing:
Expand Down
18 changes: 17 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
<<<<<<< HEAD
rev: v4.6.0
=======
rev: v5.0.0
>>>>>>> 3721525 (feat: support web3.py dependencies (#16))
hooks:
- id: check-yaml

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

- repo: https://github.com/psf/black
<<<<<<< HEAD
rev: 24.4.2
=======
rev: 24.10.0
>>>>>>> 3721525 (feat: support web3.py dependencies (#16))
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
<<<<<<< HEAD
rev: 7.0.0
=======
rev: 7.1.1
>>>>>>> 3721525 (feat: support web3.py dependencies (#16))
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
<<<<<<< HEAD
rev: v1.10.0
=======
rev: v1.13.0
>>>>>>> 3721525 (feat: support web3.py dependencies (#16))
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools, pydantic]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.19
hooks:
- id: mdformat
additional_dependencies: [mdformat-gfm, mdformat-frontmatter]
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 Tenderly 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.13.

## Installation

Expand Down
6 changes: 3 additions & 3 deletions ape_tenderly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"polygon": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("mumbai", TenderlyGatewayProvider),
("mumbai-fork", TenderlyForkProvider),
("amoy", TenderlyGatewayProvider),
("amoy-fork", TenderlyForkProvider),
],
"arbitrum": [
("mainnet-fork", TenderlyForkProvider),
Expand All @@ -31,7 +31,7 @@
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"avalance": [
"avalanche": [
("mainnet-fork", TenderlyForkProvider),
],
"fantom": [
Expand Down
8 changes: 6 additions & 2 deletions ape_tenderly/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
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

try:
from web3.middleware import ExtraDataToPOAMiddleware # type: ignore
except ImportError:
from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware # type: ignore

from .client import Fork, TenderlyClient

Expand Down Expand Up @@ -95,7 +99,7 @@ def connect(self):
polygon = (137, 80001)

if chain_id in (*optimism, *polygon):
self._web3.middleware_onion.inject(geth_poa_middleware, layer=0)
self._web3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)

self._web3.eth.set_gas_price_strategy(rpc_gas_price_strategy)

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_tenderly/version.py"

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

[tool.pytest.ini_options]
Expand Down
23 changes: 13 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
"hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer
],
"lint": [
"black>=24.4.2,<25", # Auto-formatter and linter
"mypy>=1.10.0,<2", # Static type analyzer
"black>=24.10.0,<25", # Auto-formatter and linter
"mypy>=1.13.0,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"types-requests", # Needed for mypy type shed
"flake8>=7.0.0,<8", # Style linter
"flake8>=7.1.1,<8", # 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
"flake8-pydantic", # For detecting issues with Pydantic models
"flake8-type-checking", # Detect imports to move in/out of type-checking blocks
"isort>=5.13.2,<6", # Import sorting linter
"mdformat>=0.7.17", # Auto-formatter for markdown
"mdformat>=0.7.19", # 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
"mdformat-pyproject>=0.0.2", # Allows configuring in pyproject.toml
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
Expand Down Expand Up @@ -61,11 +63,12 @@
url="https://github.com/ApeWorX/ape-tenderly",
include_package_data=True,
install_requires=[
"eth-ape>=0.7.0,<0.8",
"eth-pydantic-types", # Use same version as eth-ape
"requests", # Use same version as eth-ape
"eth-ape>=0.8.21,<0.9",
"eth-pydantic-types>=0.1.3,<0.2",
"web3>=6.20.1,<8",
"requests>=2.28.1,<3",
],
python_requires=">=3.8,<4",
python_requires=">=3.9,<4",
extras_require=extras_require,
py_modules=["ape_tenderly"],
license="Apache-2.0",
Expand All @@ -81,10 +84,10 @@
"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",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
)
Loading