Skip to content

implement dynamic API for likelihoods#185

Merged
arberqoku merged 3 commits intomainfrom
likelihoods_dynamic_api
Apr 21, 2026
Merged

implement dynamic API for likelihoods#185
arberqoku merged 3 commits intomainfrom
likelihoods_dynamic_api

Conversation

@ilia-kats
Copy link
Copy Markdown
Collaborator

This is not really necessary currently, but may become necessary in the future (see e.g. the discussion in #145) and implementing it now avoids having to do another API break in the future.

@ilia-kats ilia-kats force-pushed the likelihoods_dynamic_api branch from b711115 to 0844312 Compare March 31, 2026 16:25
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 91.36691% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.22%. Comparing base (b7b2d88) to head (e442b6f).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/mofaflex/_core/api/types.py 78.94% 4 Missing ⚠️
src/mofaflex/_core/api/utils.py 94.73% 4 Missing ⚠️
src/mofaflex/_core/api/_generate.py 60.00% 2 Missing ⚠️
src/mofaflex/_core/likelihoods/negativebinomial.py 80.00% 1 Missing ⚠️
src/mofaflex/_core/likelihoods/normal.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
+ Coverage   90.18%   90.22%   +0.04%     
==========================================
  Files          56       56              
  Lines        5735     5771      +36     
==========================================
+ Hits         5172     5207      +35     
- Misses        563      564       +1     
Files with missing lines Coverage Δ
src/mofaflex/_core/likelihoods/base.py 93.18% <100.00%> (+0.07%) ⬆️
src/mofaflex/_core/model.py 93.75% <100.00%> (+0.02%) ⬆️
src/mofaflex/_core/mofaflex.py 94.15% <100.00%> (-0.23%) ⬇️
src/mofaflex/_core/terms/__init__.py 100.00% <ø> (ø)
src/mofaflex/_core/terms/base.py 75.47% <100.00%> (-3.95%) ⬇️
src/mofaflex/_core/utils.py 94.23% <100.00%> (+0.01%) ⬆️
src/mofaflex/pl/_plotting.py 81.52% <100.00%> (ø)
src/mofaflex/tl/_downstream.py 92.68% <ø> (ø)
src/mofaflex/_core/likelihoods/negativebinomial.py 95.74% <80.00%> (-2.04%) ⬇️
src/mofaflex/_core/likelihoods/normal.py 92.18% <80.00%> (-1.37%) ⬇️
... and 3 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ilia-kats ilia-kats force-pushed the likelihoods_dynamic_api branch 2 times, most recently from 4ee3010 to 8bc643a Compare April 1, 2026 08:43
@ilia-kats ilia-kats force-pushed the likelihoods_dynamic_api branch from 97210ff to e442b6f Compare April 7, 2026 07:33
Copy link
Copy Markdown
Collaborator

@florinwalter florinwalter left a comment

Choose a reason for hiding this comment

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

Looks very good and dynamic

self._wrapped = wrapped
self._forward = forward

def __dir__(self, forward: bool | None = None):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggestion to improve readability:

def __dir__(self, forward: bool | None = None):
    should_forward = self._forward if forward is None else forward
    names = list(self._wrapped.api())
    if should_forward:
        names.extend(self._model.__dir__())
    return sorted(set(names))

Also should we rather return a (unique) list instead, more explicit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

sorting and conversion to list are performed automatically when __dir__ is called.

@arberqoku arberqoku merged commit a8d374c into main Apr 21, 2026
9 checks passed
@arberqoku arberqoku deleted the likelihoods_dynamic_api branch April 21, 2026 13:09
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.

3 participants