Skip to content

Commit 524fc85

Browse files
committed
chore: remove remaining legacy config wrapper and stale module refs
1 parent e788e20 commit 524fc85

11 files changed

Lines changed: 22 additions & 97 deletions

.importlinter

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ forbidden_modules =
1616
aiochainscan.services
1717
aiochainscan.adapters
1818
aiochainscan.core
19-
aiochainscan.modules
2019
aiochainscan.scanners
2120

2221
[importlinter:contract:2]
@@ -28,7 +27,6 @@ forbidden_modules =
2827
aiochainscan.services
2928
aiochainscan.adapters
3029
aiochainscan.core
31-
aiochainscan.modules
3230
aiochainscan.scanners
3331

3432
[importlinter:contract:3]

aiochainscan/config.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -711,51 +711,10 @@ def __getattr__(self, name: str) -> Any:
711711
config_manager = _ConfigManagerProxy()
712712

713713

714-
# Backward compatibility - expose the same interface as before
715-
class ChainScanConfig:
716-
"""Backward compatibility wrapper."""
717-
718-
def __init__(self) -> None:
719-
pass
720-
721-
def get_scanner_config(self, scanner: str) -> ScannerConfig:
722-
return get_config_manager().get_scanner_config(scanner)
723-
724-
def get_api_key(self, scanner: str) -> str | None:
725-
try:
726-
return get_config_manager().get_api_key(scanner)
727-
except ValueError:
728-
config = get_config_manager().get_scanner_config(scanner)
729-
if not config.requires_api_key:
730-
return ''
731-
raise
732-
733-
def validate_network(self, scanner: str, network: str) -> str:
734-
return get_config_manager().validate_network(scanner, network)
735-
736-
def get_supported_scanners(self) -> list[str]:
737-
return get_config_manager().get_supported_scanners()
738-
739-
def get_scanner_networks(self, scanner: str) -> set[str]:
740-
return get_config_manager().get_scanner_networks(scanner)
741-
742-
def create_client_config(self, scanner: str, network: str = 'main') -> dict[str, str]:
743-
return get_config_manager().create_client_config(scanner, network)
744-
745-
def list_all_configurations(self) -> dict[str, dict[str, Any]]:
746-
return get_config_manager().list_all_configurations()
747-
748-
749-
# Global instance for backward compatibility
750-
config = ChainScanConfig()
751-
752-
753714
# Export new advanced interface
754715
__all__ = [
755716
'ConfigurationManager',
756717
'ScannerConfig',
757-
'ChainScanConfig',
758-
'config',
759718
'config_manager',
760719
'get_config_manager',
761720
]

aiochainscan/core/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ..services.ens_resolver import ENSResolver
1515

1616
from ..chain_registry import get_chain_info, resolve_chain_id
17-
from ..config import config as global_config
17+
from ..config import get_config_manager
1818
from ..constants import MAX_BLOCK_NUMBER
1919
from ..ports.rate_limiter import RateLimiter, RetryPolicy
2020
from ..scanners import get_scanner_class
@@ -34,6 +34,8 @@
3434
from .types import JSONDict
3535
from .url_builder import UrlBuilder
3636

37+
global_config = get_config_manager()
38+
3739
# Strict type aliases for scanner and network names (defined after imports)
3840
ScannerName = Literal['etherscan', 'blockscout', 'blockscout_v2']
3941
NetworkName = Literal[

docs/BUGFIX_CONNECTION_POOLING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
### Before (Bug - Creates 100 HTTP clients!)
5757
```python
58-
from aiochainscan import get_balance
58+
from aiochainscan import ChainscanClient
5959
import asyncio
6060

6161
addresses = ['0x...' for _ in range(100)]
@@ -133,7 +133,7 @@ $ pytest tests/ -q
133133

134134
### Example Warning Output
135135
```python
136-
>>> from aiochainscan import get_balance
136+
>>> from aiochainscan import ChainscanClient
137137
>>> await get_balance(address='0x...', api_kind='eth', network='main', api_key='...')
138138

139139
DeprecationWarning: get_balance() is deprecated and will be removed in v0.5.0.

docs/CONNECTION_POOLING_FIX.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Users believed they were getting connection pooling because:
5454

5555
```python
5656
import asyncio
57-
from aiochainscan import get_balance
57+
from aiochainscan import ChainscanClient
5858

5959
addresses = ['0x...' for _ in range(100)] # Typical whale tracking use case
6060

@@ -152,7 +152,7 @@ log_batches = await asyncio.gather(*[
152152
### Before (v0.3.x - Bug Present)
153153

154154
```python
155-
from aiochainscan import get_balance
155+
from aiochainscan import ChainscanClient
156156
import asyncio
157157

158158
addresses = ['0x...' for _ in range(100)]
@@ -324,7 +324,7 @@ All facade functions in `aiochainscan/__init__.py`:
324324
```python
325325
# Test that warnings are emitted
326326
import warnings
327-
from aiochainscan import get_balance
327+
from aiochainscan import ChainscanClient
328328

329329
with warnings.catch_warnings(record=True) as w:
330330
warnings.simplefilter("always")
@@ -337,7 +337,7 @@ with warnings.catch_warnings(record=True) as w:
337337
### Monitoring Usage
338338

339339
Track which facade functions are still being used in the wild:
340-
- Check GitHub search for `from aiochainscan import get_balance`
340+
- Check GitHub search for `from aiochainscan import ChainscanClient`
341341
- Monitor PyPI download stats after v0.4.0 release
342342
- Provide 6-month deprecation period before v0.5.0 removal
343343

docs/FIX_COMPLETE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ $ pytest tests/ -q
109109
$ python -c "
110110
import asyncio
111111
import warnings
112-
from aiochainscan import get_balance
112+
from aiochainscan import ChainscanClient
113113
from aiochainscan.adapters.httpx_client import HttpxClientAdapter
114114
115115
warnings.simplefilter('always')
@@ -226,7 +226,7 @@ All documentation cross-references each other for easy navigation.
226226
227227
**Before**:
228228
```python
229-
from aiochainscan import get_balance
229+
from aiochainscan import ChainscanClient
230230
balance = await get_balance(address='0x...', api_kind='eth', network='main', api_key=key)
231231
```
232232

docs/IMPLEMENTATION_SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Users have **at least one minor version** to migrate.
230230
- Or implement a decorator approach for consistency
231231

232232
2. **Monitor usage**
233-
- Track GitHub searches for `from aiochainscan import get_balance`
233+
- Track GitHub searches for `from aiochainscan import ChainscanClient`
234234
- Check PyPI download stats
235235
- Monitor GitHub issues for migration questions
236236

docs/MIGRATION_GUIDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ finally:
6767

6868
**Before (Deprecated)**:
6969
```python
70-
from aiochainscan import get_balance
70+
from aiochainscan import ChainscanClient
7171

7272
balance = await get_balance(
7373
address='0x742d35Cc6634C0532925a3b8D9fa7a3D91D1e9b3',
@@ -96,7 +96,7 @@ finally:
9696

9797
**Before (Deprecated - Creates 100 HTTP clients!)**:
9898
```python
99-
from aiochainscan import get_balance
99+
from aiochainscan import ChainscanClient
100100
import asyncio
101101

102102
addresses = ['0x...' for _ in range(100)]
@@ -244,7 +244,7 @@ await client.close()
244244
The library still provides high-level facade functions that don't require creating a client:
245245

246246
```python
247-
from aiochainscan import get_address_balance, get_block_by_number
247+
from aiochainscan import ChainscanClient
248248

249249
# These functions handle client creation/cleanup internally
250250
balance = await get_address_balance(

docs/QUICK_REFERENCE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DeprecationWarning: get_balance() is deprecated and will be removed in v0.5.0
1515

1616
#### ❌ Old (Deprecated)
1717
```python
18-
from aiochainscan import get_balance
18+
from aiochainscan import ChainscanClient
1919

2020
balance = await get_balance(
2121
address='0x...',
@@ -43,7 +43,7 @@ finally:
4343

4444
#### ❌ Old (Creates 100 HTTP clients - VERY SLOW!)
4545
```python
46-
from aiochainscan import get_balance
46+
from aiochainscan import ChainscanClient
4747
import asyncio
4848

4949
addresses = ['0x...' for _ in range(100)]

pyproject.toml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,6 @@ forbidden_modules = [
174174
"aiochainscan.adapters",
175175
]
176176

177-
[[tool.importlinter.contracts]]
178-
name = "Modules do not import core/network directly or services/adapters"
179-
type = "forbidden"
180-
source_modules = [
181-
"aiochainscan.modules",
182-
]
183-
forbidden_modules = [
184-
"aiochainscan.services",
185-
"aiochainscan.adapters",
186-
"aiochainscan.core",
187-
"aiochainscan.network",
188-
]
189-
190177
[[tool.importlinter.contracts]]
191178
name = "Services do not import core or network"
192179
type = "forbidden"
@@ -208,29 +195,6 @@ forbidden_modules = [
208195
"aiochainscan.scanners",
209196
]
210197

211-
[[tool.importlinter.contracts]]
212-
name = "Internal packages do not import modules"
213-
type = "forbidden"
214-
source_modules = [
215-
"aiochainscan.domain",
216-
"aiochainscan.services",
217-
"aiochainscan.adapters",
218-
"aiochainscan.ports",
219-
]
220-
forbidden_modules = [
221-
"aiochainscan.modules",
222-
]
223-
224-
[[tool.importlinter.contracts]]
225-
name = "Facade does not import modules (no back-edges)"
226-
type = "forbidden"
227-
source_modules = [
228-
"aiochainscan",
229-
]
230-
forbidden_modules = [
231-
"aiochainscan.modules",
232-
]
233-
234198
[[tool.mypy.overrides]]
235199
module = [
236200
"aiochainscan.common",

0 commit comments

Comments
 (0)