Skip to content

Commit

Permalink
Make EhrData subclass AnnData (#50)
Browse files Browse the repository at this point in the history
* Make EhrData subclass AnnData

* Some init fixes

* some type fixes

* no useless privates

* repr fixes

* Fix tests

* fix docs

* improve typing

* Fix docs

* docs

* newer docs runner

* try uv for docs

* Fix docs
  • Loading branch information
flying-sheep authored Oct 10, 2024
1 parent d8449f8 commit a2b8215
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 213 deletions.
14 changes: 6 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# https://docs.readthedocs.io/en/stable/config-file/v2.html
version: 2
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "3.10"
python: "3.12"
jobs:
post_install:
- pip install uv
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install .[doc]
sphinx:
configuration: docs/conf.py
# disable this for more lenient docs builds
fail_on_warning: true
python:
install:
- method: pip
path: .
extra_requirements:
- doc
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
"anndata": ("https://anndata.readthedocs.io/en/stable", None),
"scanpy": ("https://scanpy.readthedocs.io/en/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
"pandas": ("https://pandas.pydata.org/docs", None),
"zarr": ("https://zarr.readthedocs.io/en/stable", None),
"vitessce": ("https://python-docs.vitessce.io", None),
"lamin": ("https://docs.lamin.ai", None),
Expand Down Expand Up @@ -142,6 +144,8 @@
nitpick_ignore = [
# https://github.com/duckdb/duckdb-web/issues/3806
("py:class", "duckdb.duckdb.DuckDBPyConnection"),
# Is documented as a py:attribute instead
("py:class", "numpy.int64"),
]

# Redirect broken parameter annotation classes
Expand Down
41 changes: 41 additions & 0 deletions docs/extensions/skip_inherited.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from __future__ import annotations

from contextlib import suppress
from typing import TYPE_CHECKING, Literal

if TYPE_CHECKING:
from sphinx.application import Sphinx


def skip_member_handler(
app: Sphinx,
what: Literal["module", "class", "exception", "function", "method", "attribute", "property"],
name: str,
obj: object,
skip: bool,
options,
) -> bool | None:
"""Skip inherited members."""
if what not in {"method", "attribute", "property"}:
return None
if isinstance(obj, property):
obj = obj.fget
if name == "__getitem__":
return False
if name.startswith("_"):
return True
if not hasattr(obj, "__module__"):
return None
if not obj.__module__.startswith("ehrdata"):
return True
return None


def setup(app: Sphinx) -> None:
"""Setup lamindb for CI."""
import lamindb as ln

with suppress(RuntimeError):
ln.setup.init(storage="/tmp/lamindb")

app.connect("autodoc-skip-member", skip_member_handler)
Loading

0 comments on commit a2b8215

Please sign in to comment.