Skip to content

Commit

Permalink
Merge branch 'main' into ig/refactor_base_class
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep authored Oct 10, 2023
2 parents 4739e6a + 08ef471 commit 2725767
Show file tree
Hide file tree
Showing 97 changed files with 2,469 additions and 1,094 deletions.
18 changes: 8 additions & 10 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ trigger:
variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
RUN_COVERAGE: no
PYTEST_ADDOPTS: --color=yes --junitxml=junit/test-results.xml
PYTEST_ADDOPTS: --color=yes --junitxml=test-data/test-results.xml
PRERELEASE_DEPENDENCIES: no

jobs:
Expand All @@ -16,8 +16,8 @@ jobs:
Python3.11:
python.version: "3.11"
RUN_COVERAGE: yes
Python3.8:
python.version: "3.8"
Python3.9:
python.version: "3.9"
PreRelease:
python.version: "3.11"
PRERELEASE_DEPENDENCIES: yes
Expand All @@ -37,15 +37,13 @@ jobs:
displayName: Cache pip packages

- script: |
python -m pip install --upgrade pip
pip install pytest-cov wheel
python -m pip install --upgrade pip wheel
pip install .[dev,test]
displayName: "Install dependencies"
condition: eq(variables['PRERELEASE_DEPENDENCIES'], 'no')
- script: |
python -m pip install --pre --upgrade pip
pip install --pre pytest-cov wheel
python -m pip install --pre --upgrade pip wheel
pip install --pre .[dev,test]
displayName: "Install dependencies release candidates"
condition: eq(variables['PRERELEASE_DEPENDENCIES'], 'yes')
Expand All @@ -67,14 +65,14 @@ jobs:
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/coverage.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/**/htmlcov"
summaryFileLocation: "test-data/coverage.xml"
condition: eq(variables['RUN_COVERAGE'], 'yes')

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: "junit/test-*.xml"
testResultsFiles: "test-data/test-results.xml"
testResultsFormat: JUnit
testRunTitle: "Publish test results for Python $(python.version)"

- script: bash <(curl -s https://codecov.io/bash)
Expand Down
1 change: 0 additions & 1 deletion .cirun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ runners:
preemptible:
- true
- false
workflow: .github/workflows/test-gpu.yml
labels:
- cirun-aws-gpu
8 changes: 6 additions & 2 deletions .github/workflows/check-pr-milestoned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ on:
- synchronize

env:
LABELS: ${{ join( github.event.pull_request.labels.*.name, '|' ) }}
LABELS: ${{ join(github.event.pull_request.labels.*.name, '|') }}

jobs:
check-milestone:
name: "Triage: Check Milestone"
runs-on: ubuntu-latest
steps:
- if: github.event.pull_request.milestone == null && contains( env.LABELS, 'no milestone' ) == false
- name: Check if merging isn’t blocked
if: contains(env.LABELS, 'DON’T MERGE')
run: exit 1
- name: Check if a milestone is necessary and exists
if: github.event.pull_request.milestone == null && contains(env.LABELS, 'no milestone') == false
run: exit 1
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
17 changes: 6 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@
.DS_Store
*~

# Compiled files
# Caches for compiled and downloaded files
__pycache__/
/*cache/
/data/

# Distribution / packaging
/build/
/dist/
/anndata/_version.py
/*.egg-info/
/requirements*.lock
/.python-version
/hatch.toml

# Tests and coverage
/*cache/
/data/
/tmp.zarr/
test.h5ad
test.loom
test.zarr
.coverage
# Test results (nunit/junit) and coverage
/test-data/
/*coverage*

# jupyter
.ipynb_checkpoints
Expand Down
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.0.285"
rev: "v0.0.292"
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.2
rev: v3.0.3
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -26,3 +26,10 @@ repos:
- id: detect-private-key
- id: no-commit-to-branch
args: ["--branch=main"]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
22 changes: 17 additions & 5 deletions anndata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Annotated multivariate observation data."""
from __future__ import annotations

try: # See https://github.com/maresb/hatch-vcs-footgun-example
from setuptools_scm import get_version
Expand Down Expand Up @@ -34,15 +35,26 @@
read_zarr,
)
from ._warnings import (
ExperimentalFeatureWarning,
ImplicitModificationWarning,
OldFormatWarning,
WriteWarning,
ImplicitModificationWarning,
ExperimentalFeatureWarning,
)
from . import experimental

# backwards compat / shortcut for default format
read = read_h5ad
# Experimental needs to be imported last
from . import experimental # isort: skip


def read(*args, **kwargs):
import warnings

warnings.warn(
"`anndata.read` is deprecated, use `anndata.read_h5ad` instead. "
"`ad.read` will be removed in mid 2024.",
FutureWarning,
)
return read_h5ad(*args, **kwargs)


__all__ = [
"__version__",
Expand Down
11 changes: 7 additions & 4 deletions anndata/_core/access.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from __future__ import annotations

from functools import reduce
from typing import NamedTuple, Tuple
from typing import TYPE_CHECKING, NamedTuple

from . import anndata
if TYPE_CHECKING:
from anndata import AnnData


class ElementRef(NamedTuple):
parent: "anndata.AnnData"
parent: AnnData
attrname: str
keys: Tuple[str, ...] = ()
keys: tuple[str, ...] = ()

def __str__(self) -> str:
return f".{self.attrname}" + "".join(map(lambda x: f"['{x}']", self.keys))
Expand Down
Loading

0 comments on commit 2725767

Please sign in to comment.