Skip to content

Commit

Permalink
Merge branch 'main' into more-efficient-dense-writing
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold committed Nov 15, 2024
2 parents 99d4400 + af6480e commit 690b682
Show file tree
Hide file tree
Showing 107 changed files with 1,859 additions and 1,114 deletions.
7 changes: 4 additions & 3 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
python.version: "3.12"
RUN_COVERAGE: yes
TEST_TYPE: "coverage"
Python3.9:
python.version: "3.9"
Python3.10:
python.version: "3.10"
PreRelease:
python.version: "3.12"
DEPENDENCIES_VERSION: "pre-release"
TEST_TYPE: "strict-warning"
minimum_versions:
python.version: "3.9"
python.version: "3.10"
DEPENDENCIES_VERSION: "minimum"
TEST_TYPE: "coverage"
steps:
Expand Down Expand Up @@ -88,6 +88,7 @@ jobs:
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "test-data/coverage.xml"
failIfCoverageEmpty: true
condition: eq(variables['TEST_TYPE'], 'coverage')

- task: PublishTestResults@2
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,28 @@ jobs:
ASV_DIR: "./benchmarks"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- run: git fetch origin main:main
if: ${{ github.ref_name != 'main' }}
# Errors on main branch

- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-name: asv
cache-environment: true
# Deps documented in https://asv.readthedocs.io/en/latest/installing.html
# libmambapy upper bound: https://github.com/airspeed-velocity/asv/issues/1438
create-args: >-
python=3.11
python=${{ matrix.python }}
asv
mamba
packaging
libmambapy<2
conda-build
- name: Cache datasets
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/test-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,20 @@ jobs:
- name: Nvidia SMI sanity check
run: nvidia-smi

- name: Install yq
run: |
sudo snap install yq
- name: Extract max Python version from classifiers
run: |
classifiers=$(yq .project.classifiers pyproject.toml -oy | grep --only-matching --perl-regexp '(?<=Python :: )(\d\.\d+)')
max_version=$(echo "$classifiers" | sort -V | tail -1)
echo "max_python_version=$max_version" >> $GITHUB_ENV
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
python-version: ${{ env.max_python_version }}

- name: Install UV
uses: hynek/setup-cached-uv@v2
Expand All @@ -75,3 +85,10 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

- name: Remove 'run-gpu-ci' Label
if: always()
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "run-gpu-ci"
github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.7.3
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand All @@ -14,7 +14,7 @@ repos:
exclude_types:
- markdown
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
7 changes: 7 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ build:
os: ubuntu-20.04
tools:
python: "3.12"
jobs:
post_checkout:
# unshallow so version can be derived from tag
- git fetch --unshallow || true
pre_build:
# run towncrier to preview the next version’s release notes
- ( find docs/release-notes -regex '[^.]+[.][^.]+.md' | grep -q . ) && towncrier build --keep || true
sphinx:
configuration: docs/conf.py
fail_on_warning: true # do not change or you will be fired
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![PyPI](https://img.shields.io/pypi/v/anndata.svg)](https://pypi.org/project/anndata)
[![Downloads](https://static.pepy.tech/badge/anndata/month)](https://pepy.tech/project/anndata)
[![Downloads](https://static.pepy.tech/badge/anndata)](https://pepy.tech/project/anndata)
[![Stars](https://img.shields.io/github/stars/scverse/anndata?logo=GitHub&color=yellow)](https://github.com/scverse/anndata/stargazers)
[![Stars](https://img.shields.io/github/stars/scverse/anndata?style=flat&logo=github&color=yellow)](https://github.com/scverse/anndata/stargazers)
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](http://numfocus.org)

<img
Expand Down Expand Up @@ -36,15 +36,29 @@ Please consider making a tax-deductible [donation](https://numfocus.org/donate-t
>
</a>
## Public API

Our public API is documented in the [API section][] of these docs.
We cannot guarantee the stability of our internal APIs, whether it's the location of a function, its arguments, or something else.
In other words, we do not officially support (or encourage users to do) something like `from anndata._core import AnnData` as `_core` is both not documented and contains a [leading underscore][].
However, we are aware that [many users do use these internal APIs][] and thus encourage them to [open an issue][] or migrate to the public API.
That is, if something is missing from our public API as documented, for example a feature you wish to be exported publicly, please open an issue.

[api section]: https://anndata.readthedocs.io/en/stable/api.html
[leading underscore]: https://peps.python.org/pep-0008/#public-and-internal-interfaces
[many users do use these internal APIs]: https://github.com/search?q=%22anndata._io%22&type=code
[open an issue]: https://github.com/scverse/anndata/issues/new/choose


## Citation

If you use `anndata` in your work, please cite the `anndata` pre-print as follows:
If you use `anndata` in your work, please cite the `anndata` publication as follows:

> **anndata: Annotated data**
>
> Isaac Virshup, Sergei Rybakov, Fabian J. Theis, Philipp Angerer, F. Alexander Wolf
>
> _bioRxiv_ 2021 Dec 19. doi: [10.1101/2021.12.16.473007](https://doi.org/10.1101/2021.12.16.473007).
> _JOSS_ 2024 Sep 16. doi: [10.21105/joss.04371](https://doi.org/10.21105/joss.04371).
You can cite the scverse publication as follows:

Expand Down
3 changes: 2 additions & 1 deletion benchmarks/benchmarks/sparse_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from scipy import sparse

from anndata import AnnData
from anndata.experimental import sparse_dataset, write_elem
from anndata._core.sparse_dataset import sparse_dataset
from anndata._io.specs import write_elem


def make_alternating_mask(n):
Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/min-deps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!python3
#!/usr/bin/env python3
from __future__ import annotations

import argparse
Expand Down
108 changes: 108 additions & 0 deletions ci/scripts/towncrier_automation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import subprocess
from typing import TYPE_CHECKING

from packaging.version import Version

if TYPE_CHECKING:
from collections.abc import Sequence


class Args(argparse.Namespace):
version: str
dry_run: bool


def parse_args(argv: Sequence[str] | None = None) -> Args:
parser = argparse.ArgumentParser(
prog="towncrier-automation",
description=(
"This script runs towncrier for a given version, "
"creates a branch off of the current one, "
"and then creates a PR into the original branch with the changes. "
"The PR will be backported to main if the current branch is not main."
),
)
parser.add_argument(
"version",
type=str,
help=(
"The new version for the release must have at least three parts, like `major.minor.patch` and no `major.minor`. "
"It can have a suffix like `major.minor.patch.dev0` or `major.minor.0rc1`."
),
)
parser.add_argument(
"--dry-run",
help="Whether or not to dry-run the actual creation of the pull request",
action="store_true",
)
args = parser.parse_args(argv, Args())
# validate the version
if len(Version(args.version).release) != 3:
msg = f"Version argument {args.version} must contain major, minor, and patch version."
raise ValueError(msg)
return args


def main(argv: Sequence[str] | None = None) -> None:
args = parse_args(argv)

# Run towncrier
subprocess.run(
["towncrier", "build", f"--version={args.version}", "--yes"], check=True
)

# Check if we are on the main branch to know if we need to backport
base_branch = subprocess.run(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
capture_output=True,
text=True,
check=True,
).stdout.strip()
pr_description = "" if base_branch == "main" else "@meeseeksdev backport to main"
branch_name = f"release_notes_{args.version}"

# Create a new branch + commit
subprocess.run(["git", "switch", "-c", branch_name], check=True)
subprocess.run(["git", "add", "docs/release-notes"], check=True)
pr_title = f"(chore): generate {args.version} release notes"
subprocess.run(["git", "commit", "-m", pr_title], check=True)

# push
if not args.dry_run:
subprocess.run(
["git", "push", "--set-upstream", "origin", branch_name], check=True
)
else:
print("Dry run, not pushing")

# Create a PR
subprocess.run(
[
"gh",
"pr",
"create",
f"--base={base_branch}",
f"--title={pr_title}",
f"--body={pr_description}",
"--label=skip-gpu-ci",
*(["--label=no milestone"] if base_branch == "main" else []),
*(["--dry-run"] if args.dry_run else []),
],
check=True,
)

# Enable auto-merge
if not args.dry_run:
subprocess.run(
["gh", "pr", "merge", branch_name, "--auto", "--squash"], check=True
)
else:
print("Dry run, not merging")


if __name__ == "__main__":
main()
Loading

0 comments on commit 690b682

Please sign in to comment.