Skip to content

Conversation

@jp-dark
Copy link
Collaborator

@jp-dark jp-dark commented Jan 7, 2026

Add a method for setting the global context and one for getting the global context. Use the one to get the global context in internal context helper function.

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 91.04478% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.36%. Comparing base (2b4b2b9) to head (8eacb64).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4364      +/-   ##
==========================================
- Coverage   86.62%   85.36%   -1.26%     
==========================================
  Files         139       77      -62     
  Lines       20955    13814    -7141     
  Branches       15       15              
==========================================
- Hits        18152    11793    -6359     
+ Misses       2803     2021     -782     
Flag Coverage Δ
python ?
r 85.36% <91.04%> (+0.01%) ⬆️

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

Components Coverage Δ
python_api ∅ <ø> (∅)
libtiledbsoma 77.24% <ø> (ø)
🚀 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 January 7, 2026 20:14
Copy link
Member

@aaronwolen aaronwolen left a comment

Choose a reason for hiding this comment

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

Thanks! Great documentation and user messaging.

There seems to be a lot of overlap between the getter/setter's functionality. It looks like both functions:

  • Check if a context exists
  • Create one if needed
  • Store it in .pkgenv[["somactx"]]
  • Return the context

So the only differences are:

  • set_default_context() accepts config and always creates a new one
  • get_default_context() has no args and only creates one if missing

I'd expect get_default_context() to error if one wasn't set and suggest users call set_default_context(). That might make the use case for each function clearer.

And then for internal use within get_soma_context() maybe we add an internal helper .get_or_create_default_context() that matches the current behavior of get_default_context() so factory functions automatically handle lazy creation for users.

@jp-dark jp-dark requested a review from aaronwolen January 8, 2026 20:56
@jp-dark jp-dark force-pushed the dark/r-soma-context-follow-up branch from f7693c6 to 2c6a0a0 Compare January 9, 2026 14:59
@jp-dark jp-dark force-pushed the dark/r-soma-context-follow-up branch from 915bae4 to 090d452 Compare January 9, 2026 22:06
Copy link
Member

@aaronwolen aaronwolen left a comment

Choose a reason for hiding this comment

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

Perfect! As discussed, a took a stab at expanding the docs since this concept may be unfamiliar to some R users. Also suggested updating the set_default_context() to invisibly return the context object, which is typical for setters.

@jp-dark jp-dark merged commit 671a49f into main Jan 13, 2026
17 checks passed
@jp-dark jp-dark deleted the dark/r-soma-context-follow-up branch January 13, 2026 19:18
@github-actions
Copy link

The backport to release-2.3 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-2.3 release-2.3
# Navigate to the new working tree
cd .worktrees/backport-release-2.3
# Create a new branch
git switch --create backport-4364-to-release-2.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 671a49fd4c1dd808f212efb4fb85541c8a1711a1
# Push it to GitHub
git push --set-upstream origin backport-4364-to-release-2.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-2.3

Then, create a pull request where the base branch is release-2.3 and the compare/head branch is backport-4364-to-release-2.3.

jp-dark added a commit that referenced this pull request Jan 13, 2026
* Add functions to set/get global default context

* Update NEWS, docs, and version number

* Add export to function

* Update NEWS

* Fix typo in check

* Update get_context_default and docs

* Fix typo

* Add `replace` option to context and format file

* Update docs and comment out deprecation test

* Apply suggested documentation improvements

Co-authored-by: Aaron Wolen <[email protected]>

* Update documentation

* Apply suggestions from code review

Co-authored-by: Aaron Wolen <[email protected]>

* Update documentation

---------

Co-authored-by: Aaron Wolen <[email protected]>
(cherry picked from commit 671a49f)
jp-dark added a commit that referenced this pull request Jan 13, 2026
* Add functions to set/get global default context

* Update NEWS, docs, and version number

* Add export to function

* Update NEWS

* Fix typo in check

* Update get_context_default and docs

* Fix typo

* Add `replace` option to context and format file

* Update docs and comment out deprecation test

* Apply suggested documentation improvements



* Update documentation

* Apply suggestions from code review



* Update documentation

---------


(cherry picked from commit 671a49f)

Co-authored-by: Aaron Wolen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants