Skip to content

Fix undocumented reopen behavior in Python#4106

Merged
jp-dark merged 8 commits intomainfrom
dark/fix-reopen
Jun 10, 2025
Merged

Fix undocumented reopen behavior in Python#4106
jp-dark merged 8 commits intomainfrom
dark/fix-reopen

Conversation

@jp-dark
Copy link
Copy Markdown
Collaborator

@jp-dark jp-dark commented Jun 5, 2025

Issue and/or context:
Towards SOMA-168

Changes:
The Python SOMAObject.reopen method is documented as creating a new SOMAObject with the requested mode and timestamp from an existing SOMAObject. The existing behavior was to close and reopen the original SOMAObject in its original mode in order to write metadata to the object before reopening, and would then create and return a new SOMAObject with the requested mode and timestamp.

This breaking change will close the internal handle, open a new internal handle in the requested mode and timestamp, and return the original (i.e. self) from the method in the requested mode and timestamp.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.93%. Comparing base (387421f) to head (4170c40).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4106      +/-   ##
==========================================
+ Coverage   65.90%   65.93%   +0.03%     
==========================================
  Files         158      158              
  Lines       21000    21002       +2     
  Branches     1239     1237       -2     
==========================================
+ Hits        13839    13848       +9     
+ Misses       6748     6741       -7     
  Partials      413      413              
Flag Coverage Δ
libtiledbsoma 53.97% <ø> (+0.04%) ⬆️
python 89.37% <100.00%> (-0.04%) ⬇️

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

Components Coverage Δ
python_api 89.37% <100.00%> (-0.04%) ⬇️
libtiledbsoma 44.69% <ø> (+0.09%) ⬆️
🚀 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 June 5, 2025 01:43
@jp-dark jp-dark requested a review from bkmartinjr June 5, 2025 01:43
@jp-dark jp-dark marked this pull request as draft June 5, 2025 18:38
jp-dark added 2 commits June 6, 2025 06:01
The Python `SOMAObject.reopen` method is documented as creating a new
`SOMAObject` with the requested mode and timestamp from an existing
`SOMAObject`. The existing behavior closed and reopened the original
`SOMAObject` in its original mode in order to write metadata to the
object before reopening.

This change instead throws an error if the original object has
un-written metadata instructing the user to call close first. The
existing object is not modified.

This change allows the removal of all C++ reopen code. Simply calling
``open`` from the Python layer  is a simplier and less error prone option.
@jp-dark jp-dark force-pushed the dark/fix-reopen branch from 63caee8 to 16bae7f Compare June 6, 2025 10:01
@jp-dark jp-dark marked this pull request as ready for review June 9, 2025 15:19
Comment thread apis/python/src/tiledbsoma/_tdb_handles.py Outdated
Copy link
Copy Markdown
Member

@bkmartinjr bkmartinjr left a comment

Choose a reason for hiding this comment

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

one very minor comment - otherwise LGTM. Approving, but suggest addressing the nit.

@jp-dark jp-dark merged commit 4a24642 into main Jun 10, 2025
29 of 35 checks passed
@jp-dark jp-dark deleted the dark/fix-reopen branch June 10, 2025 14:39
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