-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
The chembl_webresource_client package appears to have low maintenance activity (no releases since Feb 2024) and can cause import failures when the ChEMBL API service is unavailable. This blocks the entire import chain even when ChEMBL functionality isn't needed.
Current State
- The package is now in the optional
[chembl]dependency group - Import is lazily handled in
themap/utils/protein_utils.pywith a try/except - Functions raise
RuntimeErrorwith helpful message when ChEMBL client is unavailable
Proposed Solution
Replace chembl_webresource_client usage with direct REST API calls using requests:
import requests
def get_protein_accession(target_chembl_id: str) -> Optional[str]:
"""Get protein accession using direct REST API."""
url = f"https://www.ebi.ac.uk/chembl/api/data/target/{target_chembl_id}.json"
response = requests.get(url, timeout=30)
if response.status_code == 200:
data = response.json()
components = data.get("target_components", [])
if components:
return components[0].get("accession")
return None
def get_target_chembl_id(assay_chembl_id: str) -> Optional[str]:
"""Get target ChEMBL ID using direct REST API."""
url = f"https://www.ebi.ac.uk/chembl/api/data/assay/{assay_chembl_id}.json"
response = requests.get(url, timeout=30)
if response.status_code == 200:
data = response.json()
return data.get("target_chembl_id")
return NoneBenefits
- Removes dependency on potentially unmaintained package
requestsis already a dependency (used elsewhere)- More explicit error handling
- No import-time network calls
Files to Modify
themap/utils/protein_utils.py- Replace client usage with REST callspyproject.toml- Removechembl-webresource-clientfrom[chembl]optional deps
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels