Skip to content

Commit

Permalink
Update dependencies (again) (#390)
Browse files Browse the repository at this point in the history
This PR updates dependencies.

The PR is required since the packags broke locally with a fresh install.
Before, some package kept web3 at an old version. I also updated some
other packages while debugging.

Most packages are updated to only have lower requirements.
Notable exceptions:
- web3: the new version breakes some other dependencies (safe-eth-py),
so the latest release before the new major version is used
- SQLAlchemy: too scary to update
- pandas/numpy: new version of numpy seems to handle types differently
and does not work with large integers well.
  • Loading branch information
fhenneke authored Aug 26, 2024
1 parent b7e74ae commit aeef18f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 deletions.
15 changes: 7 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
certifi==2022.6.15
duneapi==8.0.0
dune-client==1.1.1
certifi>=2022.6.15
duneapi>=8.0.0
dune-client>=1.1.1
psycopg2-binary>=2.9.6
python-dotenv>=0.20.0
coinpaprika>=0.1.0
requests>=2.28.1
safe-cli==0.7.0
safe-eth-py==5.5.0
slackclient==2.9.4
web3>=6.20.0
safe-eth-py>=5.5.0
slackclient>=2.9.4
web3<7.0.0
SQLAlchemy<2.0.0
sqlalchemy-stubs==0.4
sqlalchemy-stubs>=0.4
pandas==2.0.3
pandas-stubs==2.0.2.230605
numpy==1.26.4
Expand Down
6 changes: 3 additions & 3 deletions src/fetch/dune.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional

from dune_client.client import DuneClient
from dune_client.query import Query
from dune_client.query import QueryBase
from dune_client.types import QueryParameter, DuneRecord

from src.constants import RECOGNIZED_BONDING_POOLS
Expand Down Expand Up @@ -46,11 +46,11 @@ def _period_params(self) -> list[QueryParameter]:
@staticmethod
def _parameterized_query(
query_data: QueryData, params: list[QueryParameter]
) -> Query:
) -> QueryBase:
return query_data.with_params(params)

def _get_query_results(
self, query: Query, job_id: Optional[str] = None
self, query: QueryBase, job_id: Optional[str] = None
) -> list[dict[str, str]]:
"""Internally every dune query execution is routed through here."""
log.info(f"Fetching {query.name} from query: {query}")
Expand Down
8 changes: 3 additions & 5 deletions src/multisend.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
from eth_typing.evm import ChecksumAddress
from gnosis.eth.ethereum_client import EthereumClient
from gnosis.eth.ethereum_network import EthereumNetwork
from gnosis.safe.api import TransactionServiceApi
from gnosis.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
from gnosis.safe.safe import Safe

# This dependency can be removed once this issue is resolved:
# https://github.com/safe-global/safe-eth-py/issues/284
from safe_cli.api.transaction_service_api import TransactionServiceApi

from src.constants import LOG_CONFIG_FILE, web3
from src.abis.load import weth9
Expand Down Expand Up @@ -99,10 +97,10 @@ def post_multisend(
# There is a deep warning being raised here:
# Details in issue: https://github.com/safe-global/safe-eth-py/issues/294
safe_tx.sign(signing_key)
tx_service = TransactionServiceApi(client, network)
tx_service = TransactionServiceApi(network, client)
print(
f"Posting transaction with hash"
f" {safe_tx.safe_tx_hash.hex()} to {safe.address}"
)
tx_service.post_transaction(safe_address=safe.address, safe_tx=safe_tx)
tx_service.post_transaction(safe_tx=safe_tx)
return int(safe_tx.safe_nonce)
8 changes: 4 additions & 4 deletions src/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from copy import copy
from dataclasses import dataclass

from dune_client.query import Query
from dune_client.query import QueryBase
from dune_client.types import QueryParameter


Expand All @@ -16,14 +16,14 @@ class QueryData:
"""Stores name and a version of the query for each query."""

name: str
query: Query
query: QueryBase

def __init__(self, name: str, q_id: int, filepath: str) -> None:
self.name = name
self.filepath = filepath
self.query = Query(q_id, name)
self.query = QueryBase(q_id, name)

def with_params(self, params: list[QueryParameter]) -> Query:
def with_params(self, params: list[QueryParameter]) -> QueryBase:
"""Copies the query, adds parameters, returning the copy."""
query_copy = copy(self.query)
query_copy.params = params
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/gap_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pandas as pd
from pandas import DataFrame
from dune_client.client import DuneClient
from dune_client.query import Query
from dune_client.query import QueryBase
from dune_client.types import QueryParameter
from dotenv import load_dotenv

Expand Down Expand Up @@ -90,7 +90,7 @@ def dune_df(self, query_id: int, start: int, end: int) -> DataFrame:
"""Executes and fetches dataframe from Dune `query_id`"""
return pd.read_csv(
self.dune.refresh_csv(
Query(
QueryBase(
query_id=query_id,
params=[
QueryParameter.number_type("start", start),
Expand Down Expand Up @@ -177,7 +177,7 @@ def find_missing(
start=args.start,
end=int(
dune_client.refresh(
Query(name="Latest Dune Block", query_id=2603762)
QueryBase(name="Latest Dune Block", query_id=2603762)
).get_rows()[0]["latest_block"]
),
)
Expand Down
4 changes: 2 additions & 2 deletions tests/queries/test_internal_trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from typing import Optional

from dune_client.client import DuneClient
from dune_client.query import Query
from dune_client.query import QueryBase
from dune_client.types import Address, QueryParameter

from src.models.accounting_period import AccountingPeriod
from src.queries import QUERIES


def exec_or_get(dune: DuneClient, query: Query, result_id: Optional[str] = None):
def exec_or_get(dune: DuneClient, query: QueryBase, result_id: Optional[str] = None):
if not result_id:
results = dune.refresh(query)
print(f"Execution ID: {results.execution_id}")
Expand Down

0 comments on commit aeef18f

Please sign in to comment.