Import performance part 3
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
In #406 we decided to get rid of scanpy.api, which worsened our import time. Thanks to @ivirshup (#703, #704), the main culprits to long import times are out of the game, but there’s still room for improvement.
I used profimp to identify the rest. I started with just profimp --html 'import scanpy', identified the external imports that take a while, and created a file in which I imported them before finally importing scanpy:
uvx --with=.[leiden] profimp --html "# anndata big imports
import numpy
import pandas
import zarr
import h5py
# scanpy big imports
import numba
import sklearn # preprocessing._simple
#import sklearn.metrics # neighbors
#import networkx # diffmap, paga, plotting._utils
import leidenalg
import matplotlib.pyplot
# rest
import scanpy" | save -f dist/profimp-scanpy.html
Outdated: 1.4s with networkx and sklearn.metrics


Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documented profimp command with the listed imports and inspect dist/profimp-scanpy.html. The issue provides no target files, tests, or specific optimization scope; completion would require identifying and reducing the remaining scanpy import-time costs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100