Fix docs rendering for classes using lazy import #651
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
The
lazy_import
introduced in PR #647 solves the issue of a failed pertpy import when not all optional dependencies are installed. However, since the classes were wrapped in multiple functions, they were no longer correctly displayed in the docs.Description of changes
lazy_import
method: Instead of wrapping the class in a function, I created aPlaceholder
class that raises anImportError
when called. This should be equivalent to the previous implementation functionality-wise. I verified that one can import pertpy when optional dependencies are not installed in the environment, and that the docs builds correctly as long as the optional dependencies are installed.docs/usage.md
(updated method name)edger
from the required packages intools/__init__
.EdgeR
is installed/imported viarpy2
, so checking thatedger
can be directly imported will fail, making the EdgeR implementation in pertpy unusable.numpy.matrix
classes to be stored invarm
/obsm
(see 3rd bullet point of release notes here). This caused the cinemaot and PyDeseq2 tests to fail. I resolved the former by storing a numpy array instead of a JAX array in the anndata. The latter issue is due to a bug in the pydeseq package itself, so I can't resolve that one, but I have opened an issue here.