Skip to content

Conversation

@JR-1991
Copy link
Member

@JR-1991 JR-1991 commented Jan 15, 2026

This pull request refactors the ChEBI fetcher module to use the ChEBI search API for all chemical entity queries, streamlines data models, and simplifies result processing throughout the codebase. It also updates dependencies and improves error handling in both ChEBI and PubChem fetchers. The most important changes are grouped below:

ChEBI API Refactor & Data Model Updates:

  • Replaced the previous ChEBI entry data models (ChEBIStructure, ChEBIEntryData, ChEBIEntryResult, ChEBIApiResponse) with new models (ChebiSearchSource, ChebiSearchResult, ChebiSearchResponse) that directly match the ChEBI search API response format. All fetch and search methods now use these new models.
  • Updated all fetcher methods (get_entry_by_id, get_entries_batch, search_entries) to use the ChEBI search API endpoint and return ChebiSearchSource objects instead of the previous entry result models. Batch fetching now iterates over IDs and calls the search API for each. [1] [2] [3]
  • Renamed and refactored the entry processing function to process_search_result, mapping ChEBI search results directly to SmallMolecule objects, and updated all usages in fetch, batch, and search functions. [1] [2] [3] [4]

Error Handling Improvements:

  • Improved error handling in the PubChem fetcher: removed redundant status code checks and now rely on httpx exceptions for HTTP errors, aligning error handling with the ChEBI fetcher.
  • Updated the integration test for PubChem to expect httpx.HTTPStatusError for invalid IDs instead of a generic ValueError.

Dependency Updates:

  • Updated the mdmodels dependency version in pyproject.toml from 0.2.1 to 0.2.4.

This change is Reviewable

Refactored pyenzyme.fetcher.chebi to use the ChEBI search API for fetching entries, simplifying data models and result processing. Updated function signatures and logic to work with the new API response structure. Adjusted integration tests to expect httpx.HTTPStatusError for invalid PubChem IDs instead of ValueError.
Bumped mdmodels version requirement from >=0.2.1 to >=0.2.4 to ensure compatibility with recent updates and bug fixes.
@JR-1991 JR-1991 self-assigned this Jan 15, 2026
@JR-1991 JR-1991 added bug Something isn't working enhancement New feature or request labels Jan 15, 2026
@JR-1991 JR-1991 added this to EnzymeML Jan 15, 2026
@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
py-enzyme Ready Ready Preview, Comment Jan 15, 2026 0:20am

Removed Python 3.10 from CI test matrices and set 'requires-python' to >=3.11 in pyproject.toml to ensure compatibility with newer Python versions.
Bumped required Python version to >=3.11, <4 and updated dependency markers for packages such as astropy, bokeh, and anyio. Removed version-specific constraints for numpy and contourpy, and updated astropy to version 7.2.0. This improves compatibility with newer Python releases and simplifies dependency management.
Deleted the test_legacy.py file which tested backward compatibility for loading and serializing EnzymeML v1 documents. This may indicate deprecation of legacy support or a cleanup of outdated tests.
@JR-1991 JR-1991 merged commit cc113aa into main Jan 15, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this to Done in EnzymeML Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants