Repository navigation
refactor(py)!: make phylo2vec.opt importable without the GradME extras - #228
Merged
Merged
Conversation
phylo2vec.opt imported GradME eagerly, so any import from it needed jax, optax, tqdm and rpy2. GradME is now imported in a try block: without these, the rest of phylo2vec.opt imports, and asking for GradME raises an ImportError that says what to install. Since only GradME needs them, the [opt] extras are renamed [gradme]. joblib is dropped from them, as it is already a core dependency. The test task now runs the docstring examples of the phylo2vec.opt modules that need no extras, instead of skipping the whole package. BREAKING CHANGE: the [opt] extras are now [gradme]. `pip install phylo2vec[opt]` only warns that the extra does not exist and installs phylo2vec without the GradME dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
phylo2vec.optimportedGradMEeagerly, so importing anything from it required jax, optax, tqdm and rpy2. This preparesphylo2vec.optfor the upcoming BME functions, which need none of them.GradMEandgradme_lossare imported in atryblock. Without the extras, the rest ofphylo2vec.optimports, and asking forGradMEraises anImportErrorthat says what to install.[opt]extras are renamed[gradme], withoutjoblib(already a core dependency).pixi run testnow runs the docstring examples inphylo2vec.opt, except in the modules that need extra packages.[gradme]; newtests/test_opt.pyfor the import behaviour.Breaking change:
pip install phylo2vec[opt]no longer installs the GradME dependencies. Usepip install phylo2vec[gradme].