Skip to content

Improve handling of ChEMBL database versions - #468

Merged
stitam merged 16 commits into
ropensci:masterfrom
stitam:chembl_versions
Aug 21, 2026
Merged

Improve handling of ChEMBL database versions#468
stitam merged 16 commits into
ropensci:masterfrom
stitam:chembl_versions

Conversation

@stitam

@stitam stitam commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Our current definition of the "latest" ChEMBL version in webchem is fragile because the version number is pinned inside the package. Whenever there is a new ChEMBL release we have to update the flag in webchem, which is not good practice. With this PR the "latest" flag becomes dynamic, and e.g db_download_chembl() queries the ChEMBL webservice for the current latest version.

At the same time, the PR introduces new functionality to pin ChEMBL database version for a user or a project. It adds chembl_check_db_version() (similar mechanism to cs_check_key()) which looks for CHEMBL_DB_VERSION in .Renviron or the chembl_db_version option in .Rprofile. This is an exported function to help users with pinning, but it is also used internally to resolve version = NULL in offline ChEMBL functions. version = NULL is the new default, so instead of defaulting to the latest version which can change over time, functions will default to the pinned version.

With this, the suggested workflow becomes:

  1. download the latest version or any version we need for our project
  2. pin the version through .Renviron or .Rprofile
  3. use ChEMBL offline functions without ever touching the version argument

PR task list:

  • Update NEWS
  • Add tests (if appropriate)
  • Update documentation with devtools::document()
  • Check package passed

@stitam
stitam requested a lite review from Copilot August 21, 2026 19:37
@stitam stitam added this to the 25-ISC-1-02-M1 milestone Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes ChEMBL version handling more robust by removing the hard-coded “latest” version from the package and introducing a user/project-level pinning mechanism for offline ChEMBL usage.

Changes:

  • Make “latest” ChEMBL resolution dynamic (via ChEMBL status endpoint) and shift multiple APIs to default version = NULL.
  • Add chembl_check_db_version() to resolve a pinned default version from .Renviron/.Rprofile (and export it).
  • Update tests and documentation to reflect the new versioning workflow.

Reviewed changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/testthat/test-chembl.R Updates online tests to avoid asserting a pinned “latest” version and tightens version validation expectations.
tests/testthat/test-chembl_offline.R Switches offline tests to use pinned version via options and updates offline setup logic accordingly.
R/utils.R Changes db_connect() default version behavior to use pinned defaults (via version = NULL).
R/chembl.R Implements dynamic “latest” resolution in db_download_chembl() and changes multiple ChEMBL helpers to require explicit/pinned versions.
R/chembl_offline.R Introduces and exports chembl_check_db_version() and updates offline query path to rely on pinned defaults.
NEWS.md Documents the new pinned-version workflow and new helper function.
NAMESPACE Exports chembl_check_db_version().
man/db_download_chembl.Rd Updates documentation for the new default version = NULL behavior and the “latest” workflow.
man/db_connect.Rd Updates documentation for db_connect() now defaulting to pinned version behavior.
man/chembl_query.Rd Updates documentation for chembl_query() offline version default/pinning behavior.
man/chembl_check_db_version.Rd Adds new man page for chembl_check_db_version().
Files not reviewed (4)
  • man/chembl_check_db_version.Rd: Generated file
  • man/chembl_query.Rd: Generated file
  • man/db_connect.Rd: Generated file
  • man/db_download_chembl.Rd: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread R/chembl.R Outdated
Comment thread R/chembl_offline.R
Comment thread R/chembl.R Outdated
Comment thread R/chembl.R
Comment thread tests/testthat/test-chembl_offline.R
Comment thread NEWS.md Outdated
stitam and others added 2 commits August 21, 2026 22:45
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@stitam
stitam merged commit 839b83f into ropensci:master Aug 21, 2026
6 checks passed
@stitam
stitam deleted the chembl_versions branch August 21, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants