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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.40%. Comparing base (2b4b2b9) to head (090d452).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4364      +/-   ##
==========================================
- Coverage   86.62%   85.40%   -1.23%     
==========================================
  Files         139       77      -62     
  Lines       20955    13809    -7146     
  Branches       15       15              
==========================================
- Hits        18152    11793    -6359     
+ Misses       2803     2016     -787     
Flag Coverage Δ
python ?
r 85.40% <100.00%> (+0.04%) ⬆️

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
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