Skip to content

Commit 1bc81b5

Browse files
Internal docs (#181)
1 parent d4427fc commit 1bc81b5

File tree

2 files changed

+46
-7
lines changed

2 files changed

+46
-7
lines changed

src/dipdup/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import os
2+
import sys
3+
14
__version__ = '3.1.3'
25
__spec_version__ = '1.2'
36
spec_version_mapping = {
@@ -12,3 +15,5 @@
1215
'1.1': True,
1316
'1.2': True,
1417
}
18+
19+
sys.path.append(os.getcwd())

src/dipdup/config.py

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import logging.config
55
import os
66
import re
7-
import sys
87
from abc import ABC
98
from abc import abstractmethod
109
from collections import Counter
@@ -56,7 +55,6 @@
5655
DEFAULT_RETRY_COUNT = 3
5756
DEFAULT_RETRY_SLEEP = 1
5857

59-
sys.path.append(os.getcwd())
6058
_logger = logging.getLogger('dipdup.config')
6159

6260

@@ -71,6 +69,7 @@ class SqliteDatabaseConfig:
7169
"""
7270
SQLite connection config
7371
72+
:param kind: always 'sqlite'
7473
:param path: Path to .sqlite3 file, leave default for in-memory database
7574
"""
7675

@@ -86,13 +85,15 @@ def connection_string(self) -> str:
8685
class PostgresDatabaseConfig:
8786
"""Postgres database connection config
8887
88+
:param kind: always 'postgres'
8989
:param host: Host
9090
:param port: Port
9191
:param user: User
9292
:param password: Password
9393
:param database: Database name
9494
:param schema_name: Schema name
9595
:param immune_tables: List of tables to preserve during reindexing
96+
:param connection_timeout: Connection timeout
9697
"""
9798

9899
kind: Literal['postgres']
@@ -121,6 +122,18 @@ def valid_immune_tables(cls, v):
121122

122123
@dataclass
123124
class HTTPConfig:
125+
"""Advanced configuration of HTTP client
126+
127+
:param cache: Whether to cache responses
128+
:param retry_count: Number of retries before giving up
129+
:param retry_sleep: Sleep time between retries
130+
:param retry_multiplier: Multiplier for sleep time between retries
131+
:param ratelimit_rate: Number of requests per `ratelimit_period`
132+
:param ratelimit_period: Time period for rate limiting
133+
:param connection_limit: Number of simultaneous connections
134+
:param connection_timeout: Connection timeout
135+
:param batch_size: Number of items fetched in a single request
136+
"""
124137
cache: Optional[bool] = None
125138
retry_count: Optional[int] = None
126139
retry_sleep: Optional[float] = None
@@ -186,7 +199,9 @@ def valid_address(cls, v):
186199
class TzktDatasourceConfig(NameMixin):
187200
"""TzKT datasource config
188201
189-
:param url: Base API url
202+
:param kind: always 'tzkt'
203+
:param url: Base API URL, e.g. https://api.tzkt.io/
204+
:param http: HTTP client configuration
190205
"""
191206

192207
kind: Literal['tzkt']
@@ -212,7 +227,10 @@ def __post_init_post_parse__(self) -> None:
212227
class BcdDatasourceConfig(NameMixin):
213228
"""BCD datasource config
214229
215-
:param url: Base API url
230+
:param kind: always 'bcd'
231+
:param url: Base API URL
232+
:param network: Network name, e.g. mainnet, hangzhounet, etc.
233+
:param http: HTTP client configuration
216234
"""
217235

218236
kind: Literal['bcd']
@@ -233,6 +251,14 @@ def valid_url(cls, v):
233251

234252
@dataclass
235253
class CoinbaseDatasourceConfig(NameMixin):
254+
"""Coinbase datasource config
255+
256+
:param kind: always 'coinbase'
257+
:param api_key: API key
258+
:param secret_key: API secret key
259+
:param passphrase: API passphrase
260+
:param http: HTTP client configuration
261+
"""
236262
kind: Literal['coinbase']
237263
api_key: Optional[str] = None
238264
secret_key: Optional[str] = None
@@ -394,8 +420,11 @@ def transaction_id(self) -> int:
394420
class OperationHandlerTransactionPatternConfig(PatternConfig, StorageTypeMixin, ParameterTypeMixin, TransactionIdMixin):
395421
"""Operation handler pattern config
396422
397-
:param destination: Alias of the contract to match
398-
:param entrypoint: Contract entrypoint
423+
:param type: always 'transaction'
424+
:param source: Source contract alias to filter operations with
425+
:param destination: Destination contract alias to filter operations with
426+
:param entrypoint: Contract entrypoint to filter operations with
427+
:param optional: Whether can operation be missing in operation group
399428
"""
400429

401430
type: Literal['transaction'] = 'transaction'
@@ -442,10 +471,15 @@ def destination_contract_config(self) -> ContractConfig:
442471

443472
@dataclass
444473
class OperationHandlerOriginationPatternConfig(PatternConfig, StorageTypeMixin):
474+
"""Origination handler pattern config
475+
476+
:param source: Source contract alias to filter operations with
477+
:param similar_to: Alias of contract having the same code/signature (depending on `strict` field)
478+
"""
479+
type: Literal['origination'] = 'origination'
445480
source: Optional[Union[str, ContractConfig]] = None
446481
similar_to: Optional[Union[str, ContractConfig]] = None
447482
originated_contract: Optional[Union[str, ContractConfig]] = None
448-
type: Literal['origination'] = 'origination'
449483
optional: bool = False
450484
strict: bool = False
451485

0 commit comments

Comments
 (0)