Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix benchmarks and pandas compat #1100

Merged
merged 9 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -e {0} # -e to fail on error
shell: bash -el {0} # -e to fail on error, -l for mamba

strategy:
fail-fast: false
matrix:
python: ["3.10"]
python: ["3.11"]
os: [ubuntu-latest]

env:
Expand All @@ -33,12 +33,15 @@ jobs:
if: ${{ github.ref_name != 'main' }}
# Errors on main branch

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
- uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
environment-name: asv
cache-environment: true
create-args: >-
python=3.11
asv
mamba
packaging

- name: Cache datasets
uses: actions/cache@v3
Expand All @@ -47,12 +50,8 @@ jobs:
~/.cache
key: benchmark-state-${{ hashFiles('benchmarks/**') }}

- name: Install dependencies
run: |
pip install asv

- name: Quick benchmark run
working-directory: ${{ env.ASV_DIR }}
run: |
asv machine --yes
asv run -qev --strict
asv run --quick --show-stderr --verbose
8 changes: 8 additions & 0 deletions anndata/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ def test_views():
assert adata_subset.obs["foo"].tolist() == list(range(2))


def test_view_subset_shapes():
adata = gen_adata((20, 10), **GEN_ADATA_DASK_ARGS)

view = adata[:, ::2]
assert view.var.shape == (5, 8)
assert {k: v.shape[0] for k, v in view.varm.items()} == {k: 5 for k in view.varm}


def test_modify_view_component(matrix_type, mapping_name):
adata = ad.AnnData(
np.zeros((10, 10)),
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// If missing or the empty string, the tool will be automatically
// determined by looking for tools on the PATH environment
// variable.
"environment_type": "conda",
"environment_type": "mamba",

// timeout in seconds for installing any dependencies in environment
// defaults to 10 min
Expand Down Expand Up @@ -117,7 +117,7 @@
// // additional env for python2.7
// {"python": "2.7", "numpy": "1.8"},
// // additional env if run on windows+conda
// {"platform": "win32", "environment_type": "conda", "python": "2.7", "libpython": ""},
// {"platform": "win32", "environment_type": "mamba", "python": "2.7", "libpython": ""},
// ],

// The directory (relative to the current directory) that benchmarks are
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ classifiers = [
"Topic :: Scientific/Engineering :: Visualization",
]
dependencies = [
"pandas>=1.1.1", # pandas <1.1.1 has pandas/issues/35446
# pandas <1.1.1 has pandas/issues/35446
# pandas 2.1.0rc0 has pandas/issues/54622
"pandas >=1.1.1, !=2.1.0rc0",
"numpy>=1.16.5", # required by pandas 1.x
"scipy>1.4",
"h5py>=3",
Expand Down
Loading