Make IPFS/Web3 dependencies optional in ipfs_storage_service
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

Coordinator API:
- Changed ipfshttpclient and web3 imports to optional
- Service now starts without IPFS/Web3 dependencies
- Logs warning instead of raising ImportError
- IPFS features disabled when dependencies not available
This commit is contained in:
aitbc
2026-05-14 23:13:12 +02:00
parent 94215d96c0
commit b8a395f341

View File

@@ -17,12 +17,15 @@ from typing import Any
from .secure_pickle import safe_loads
# Optional IPFS/Web3 dependencies
ipfshttpclient = None
web3 = None
try:
import ipfshttpclient
from web3 import Web3
web3 = Web3
except ImportError as e:
logger.error(f"IPFS/Web3 dependencies not installed: {e}")
raise
logger.warning(f"IPFS/Web3 dependencies not installed: {e}. IPFS features will be disabled.")
@dataclass