Repository navigation
WIP: Move niche dependencies to optional extras and replace removed Biopython wrappers - #861
Draft
Adamtaranto wants to merge 3 commits into
Draft
Adamtaranto wants to merge 3 commits into
Adamtaranto wants to merge 3 commits into
Conversation
conda-forge libheif 1.23.4 (both gpl and lgpl builds) links against /opt/homebrew/opt/webp/lib/libsharpyuv.0.dylib, so ImageMagick fails to load on macOS and Wand reports "MagickWand shared library not found". Exclude that release. Also add tesseract, which pytesseract needs for GRABSEEDS label OCR, and drop libmagic, which nothing in jcvi or its dependencies uses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Recent Biopython releases no longer ship Bio.Application or the Bio.Emboss/Bio.Phylo/Bio.Align .Applications modules, so apps.phylo and the annotation.reformat needle action failed to import. Add jcvi.apps.commandline with drop-in FSeqBoot, FDNADist, FNeighbor, FConsense, Needle, Phyml, Raxml, Clustalw and Muscle command lines. They take the same keyword arguments and build the same command strings as Biopython 1.85, which tests/apps/test_commandline.py checks. A non-zero exit is logged as a warning rather than raised. compara.ks now uses these instead of its inline fallback. phylo.py also resolves Gblocks, ffitch and TreeFix paths lazily, since evaluating getpath() in default arguments prompted on the console at import time. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The default install pulled in heavy packages that only a few actions use (goatools, ortools, pysam, scikit-image, boto3, ...), listed three that nothing imports (graphviz, genomepy, cython at runtime), and omitted roughly twenty packages that the code does import. Core dependencies are now what widely imported modules need: biopython, CrossMap, deap, ete4, matplotlib, more-itertools, natsort, networkx, numpy, palettable, pandas, rich, scipy and seaborn. pandas was previously undeclared but is used by core graphics and already required by seaborn. Everything else lives in extras: assembly, aws, excel, fetch, graphviz, grabseeds, lp, ngs, ontology, projects, variation and web, combined in `all`. The tests extra depends on `jcvi[all]`, so CI coverage is unchanged. gurobi (licensed) and segment (PyTorch) stay out of `all`. apps.base gains require() for lazy imports and missing_extra() for leaf modules that import an optional package at top level. Both log which extra to install and exit instead of raising a bare ImportError. Tests that need an extra call pytest.importorskip. formats.html now imports BeautifulSoup from bs4; the old module name was Python 2 only. pyfasta (projects.str, variation.str) and ClientForm (utils.taxonomy) have no Python 3 releases and remain undeclared. Also split contributor tooling (black, isort, hatch, pre-commit, ...) out of `tests` into a `dev` extra. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adamtaranto
marked this pull request as draft
September 14, 2026 01:12
Collaborator
Author
|
In progress. Doing an audit of unused dependencies and undeclared imports. Aim is to remove unused deps and move rarely used deps off to 'optional' deps lists. Will then trim down bioconda recipe so that test builds run faster and install does not drag in unused deps. |
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.
Summary
This PR slims the default install, declares missing dependencies, and fixes modules broken by recent Biopython releases. There are three commits, which can be reviewed separately.
1. Optional extras (
build:)graphviz,genomepyand runtimecython, which nothing imports.assembly,aws,excel,fetch,graphviz,grabseeds,lp,ngs,ontology,projects,variationandweb, combined inall.gurobi(licensed) andsegment(PyTorch) stay out ofall.apps.basegainsrequire()andmissing_extra(). An action that needs a missing extra now logspip install 'jcvi[<extra>]'and exits, instead of raising a bareImportError.testsdepends onjcvi[all], so CI installs everything as before. Tests that need an extra usepytest.importorskip, so a core-only install skips them.teststo a newdevextra.2. Biopython application wrappers (
fix:)Biopython 1.88 no longer ships
Bio.Applicationor theBio.Emboss,Bio.PhyloandBio.Align.Applicationsmodules. That broke imports ofjcvi.apps.phyloand theannotation.reformat needleaction.jcvi.apps.commandlineprovides replacements for every wrapper jcvi used. They take the same keyword arguments and build the same command strings.tests/apps/test_commandline.pychecks them against output from Biopython 1.85.compara.ksdrops its inline fallback and uses the new module.apps.phylono longer prompts for Gblocks, ffitch or TreeFix paths when imported, because the path lookups are now lazy.3. Conda environment (
fix(env):)libheif1.23.4 links against a Homebrew-onlylibsharpyuvpath, which stops ImageMagick and Wand from loading on macOS.environment.ymlnow excludes that version.tesseract, which pytesseract needs for GRABSEEDS label OCR.libmagic, which nothing uses.Known gaps
jcvi.projects.strandjcvi.variation.strimportpyfasta, andjcvi.utils.taxonomyimportsClientForm. Neither package has a Python 3 release, so these modules still fail to import. Fixing them needs a port, for example topyfaidx.testsonly indirectly through bokeh. Consider adding PyYAML back totests.Testing
.[tests]installed. 277 tests passed with none skipped, including GRABSEEDS.🤖 Generated with Claude Code