Skip to content

[python][r] Update deprecation lifecycle#4431

Open
jp-dark wants to merge 12 commits intomainfrom
dark/deprecations
Open

[python][r] Update deprecation lifecycle#4431
jp-dark wants to merge 12 commits intomainfrom
dark/deprecations

Conversation

@jp-dark
Copy link
Copy Markdown
Collaborator

@jp-dark jp-dark commented Mar 13, 2026

Issue and/or context: Closes SOMA-815

Changes:
R:

  • Change tiledbsoma_ctx parameter to be defunct.
  • Remove defunct warning for deleting in write mode and just throw the standard error.
  • Update argument types for domain/shape and throw an error if NULL.
  • Remove defunct method set_data_type.

Pythons:

  • Update argument types for domain/shape and throw an error if None.
  • Update somacore version to match a version with updated API.

Notes for Reviewer:

@jp-dark jp-dark marked this pull request as draft March 16, 2026 13:59
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 35.51402% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.21%. Comparing base (a60c8f1) to head (c4f714e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4431      +/-   ##
==========================================
- Coverage   85.43%   85.21%   -0.22%     
==========================================
  Files         136      136              
  Lines       21437    21434       -3     
==========================================
- Hits        18314    18265      -49     
- Misses       3123     3169      +46     
Flag Coverage Δ
python 88.29% <50.00%> (-0.10%) ⬇️
r 83.50% <33.68%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
python_api 88.29% <50.00%> (-0.10%) ⬇️
libtiledbsoma ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jp-dark jp-dark marked this pull request as ready for review March 16, 2026 20:03
soma_domain <- domain
if (is.null(soma_domain)) {
.deprecate(
lifecycle::deprecate_stop(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should not need to be changed: .deprecate() will automatically signal a defunct stage with the next release

Comment on lines 75 to 77
if (
!(is.null(soma_domain) || .is_domain(soma_domain, index_column_names))
) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can simplify the logic here as domain/soma_domain can no longer be NULL

Suggested change
if (
!(is.null(soma_domain) || .is_domain(soma_domain, index_column_names))
) {
if (!.is_domain(soma_domain, index_column_names)) {

Comment on lines -85 to 107
## needed eg after open() to set (Arrow) type
#' @description Sets a cache value for the datatype.
#'
#' @section Lifecycle:
#' As of \pkg{tiledbsoma} 2.1.0, \code{$set_data_type()} is deprecated; this
#' functionality is no longer needed as \code{libtiledbsoma} now accurately
#' sets the TileDB data type upon array opening
#'
#' @param type A character value describing the TileDB data type.
#'
set_data_type = function(type) {
.deprecate(
when = "2.1.0",
what = sprintf("%s$set_data_type()", class(self)[1L])
)
soma_debug(sprintf(
"[SOMANDArrayBase::set_data_type] caching type %s",
type$ToString()
))
private$.type <- type
},

#' @description Test if the array has the upgraded resizeable shape feature
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I understand the deprecation policy correctly, shouldn't this be removed as part of tiledbsoma 4.x? Or have we already reached defunct, allowing us to remove this as part of tiledbsoma 3.x? (or am I misunderstanding the deprecation policy altogether?)

private$.read_only_error("tiledbsoma_ctx")
}
.deprecate(
lifecycle::deprecate_stop(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

.deprecate() should be able to switch this to a defunct error rather than a deprecation warning automatically with tiledbsoma 2.5.0 or 3.x

if (!is.null(tiledbsoma_ctx)) {
.deprecate(
if (lifecycle::is_present(tiledbsoma_ctx)) {
lifecycle::deprecate_stop(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

.deprecate() should be able to switch this to a defunct error rather than a deprecation warning automatically with tiledbsoma 2.5.0 or 3.x

Comment on lines +227 to +233
if (lifecycle::is_present(tiledbsoma_ctx)) {
lifecycle::deprecate_stop(
what = "DimReduc.write_soma(tiledbsoma_ctx)",
when = "2.3.0",
details = "Use `context` instead."
)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm confused about this (and the other write_soma(tiledbsoma_ctx) defunct signals):

  • the what implies there's a write_soma method for the DimReduc generic (eg. DimReduc(tiledbsoma_ctx = )); this what should be write_soma.DimReduc(tiledbsoma_ctx) or write_soma(tiledbsoma_ctx) as write_soma.DimReduc() will never be called directly
  • we could simplify all these defunct signals by adding the call to .deprecate() or lifecycle::deprecate_stop() in the generic write_soma() and continuing to pass tiledbsoma_ctx = tiledbsoma_ctx to all subsequent write_soma() calls

Comment on lines -71 to -80
test_that("SOMAContext from default SOMATileDBContext", {
# Create context.
with_mocked_bindings(
.tiledbsoma_deprecation_version = function() "2.3.0",
.deprecation_stage = function(when) "deprecate",
{
lifecycle::expect_deprecated(tiledbsoma_ctx <- SOMATileDBContext$new())
lifecycle::expect_deprecated(context <- get_soma_context(NULL, tiledbsoma_ctx, what="get_soma_context()"))
}
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As per the deprecation policy, can we keep and modify some of these tests to ensure that the defunct error is being signalled properly?

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