Skip to content

Commit b8f21f1

Browse files
authored
Update Python Version Support (remove web3) (#48)
Add Support for Python 3.11 (remove web3 dependency)
1 parent 9f1b6db commit b8f21f1

File tree

6 files changed

+21
-25
lines changed

6 files changed

+21
-25
lines changed

.github/workflows/pull-request.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ on:
44
push:
55
branches: [ main ]
66
jobs:
7-
lint-format-types:
7+
lint-format-types-unit:
88
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.7", "3.11"]
912
steps:
1013
- uses: actions/checkout@v2
11-
- name: Setup Python 3.7
14+
- name: Set up Python ${{ matrix.python-version }}
1215
uses: actions/setup-python@v2
1316
with:
14-
python-version: '3.7'
17+
python-version: ${{ matrix.python-version }}
18+
1519
- name: Install Requirements
1620
run: pip install -r requirements/dev.txt
1721
- name: Pylint
@@ -20,27 +24,21 @@ jobs:
2024
run: black --check ./
2125
- name: Type Check (mypy)
2226
run: mypy dune_client --strict
23-
unit-tests:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v2
27-
- name: Setup Python 3.7
28-
uses: actions/setup-python@v2
29-
with:
30-
python-version: '3.7'
31-
- name: Install Requirements
32-
run:
33-
pip install -r requirements/dev.txt
3427
- name: Unit Tests
3528
run: python -m pytest tests/unit
29+
3630
e2e-tests:
3731
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
python-version: ["3.7", "3.11"]
3835
steps:
3936
- uses: actions/checkout@v2
40-
- name: Setup Python 3.7
37+
- name: Set up Python ${{ matrix.python-version }}
4138
uses: actions/setup-python@v2
4239
with:
43-
python-version: '3.7'
40+
python-version: ${{ matrix.python-version }}
41+
4442
- name: Install Requirements
4543
run:
4644
pip install -r requirements/dev.txt

dune_client/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from enum import Enum
1111
from typing import Any, Dict
1212

13-
from web3 import Web3
14-
1513
from dune_client.util import postgres_date
1614

1715
DuneRecord = Dict[str, str]
@@ -31,7 +29,7 @@ def __init__(self, address: str):
3129
# so they don't have to convert all addresses to hex strings manually
3230
address = address.replace("\\x", "0x")
3331
if Address._is_valid(address):
34-
self.address: str = Web3.toChecksumAddress(address)
32+
self.address: str = address.lower()
3533
else:
3634
raise ValueError(f"Invalid Ethereum Address {address}")
3735

requirements/prod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
aiohttp>=3.8.3
12
types-python-dateutil>=2.8.19
23
types-PyYAML>=6.0.11
34
types-requests>=2.28.9
45
python-dateutil>=2.8.2
56
requests>=2.28.1
6-
web3>=5.30.0
77
ndjson>=0.3.1

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ install_requires =
2525
types-requests>=2.28.9
2626
python-dateutil>=2.8.2
2727
requests>=2.28.1
28-
web3>=5.30.0
28+
aiohttp>=3.8.3
2929
python_requires = >=3.7
3030
setup_requires =
3131
setuptools_scm

tests/e2e/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_internal_error(self):
141141
dune.execute(query)
142142
self.assertEqual(
143143
str(err.exception),
144-
"Can't build ExecutionResponse from {'error': 'An internal error occured'}",
144+
"Can't build ExecutionResponse from {'error': 'Query not found'}",
145145
)
146146

147147
def test_invalid_job_id_error(self):

tests/unit/test_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def test_invalid(self):
2222
def test_valid(self):
2323
self.assertEqual(
2424
Address(address=self.lower_case_address).address,
25-
"0xdE1c59Bc25D806aD9DdCbe246c4B5e5505645718",
25+
"0xde1c59bc25d806ad9ddcbe246c4b5e5505645718",
2626
)
2727
self.assertEqual(
2828
Address(address=self.check_sum_address).address,
29-
"0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB",
29+
"0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab",
3030
)
3131
self.assertEqual(
3232
Address(address=self.dune_format).address,
33-
"0x5d4020b9261F01B6f8a45db929704b0Ad6F5e9E6",
33+
"0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6",
3434
)
3535

3636
def test_inequality(self):

0 commit comments

Comments
 (0)