Skip to content
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
54 changes: 13 additions & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,50 +1,22 @@
_build/
data*
results*
logs*
_issues.ipynb
*/figures/*
figures/*
data/*
write/*

*.egg-info/
.pytest_cache/
.coverage
cache/
coverage.xml
test.h5ad
test_compr.h5ad
test_no_compr.h5ad
docs/_build
archive/
data/
README.html
scripts/
test_notebooks.txt
upload_to_pypi.sh
/_build/
/dist/
*.h5ad
*.zip

# Ignore biomart file
.pybiomart.sqlite
/cache/
/archive/
/data/
/write/
/figures/
/scripts/

# always-ignore extensions
# caches
*~

# Python / Byte-compiled / optimized / DLL
__pycache__/
*.py[cod]
*.so
.cache
.ipynb_checkpoints/
.*cache/

# OS or Editor files and folders
.DS_Store
Thumbs.db
.ipynb_checkpoints/
.directory
/.idea/
/.vscode/
/hatch.toml

# always-ignore directories
/dist/
/build/
17 changes: 8 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.12
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
- id: ruff-check
args: ["--fix"]
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.6.0
hooks:
- id: prettier
exclude_types:
- markdown
language_version: 21.5.0
- id: pyproject-fmt
- repo: https://github.com/biomejs/pre-commit
rev: v2.2.3
hooks:
- id: biome-format
7 changes: 0 additions & 7 deletions .prettierrc.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Build docs",
"type": "debugpy",
"request": "launch",
"module": "sphinx",
"args": ["-M", "html", ".", "_build"],
"console": "internalConsole",
},
],
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always",
},
},
"notebook.formatOnSave.enabled": true,
"python.terminal.activateEnvironment": true,
"python.analysis.typeCheckingMode": "basic",
}
16 changes: 8 additions & 8 deletions _static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
body {
background-image: repeating-linear-gradient(
45deg,
var(--pst-color-danger-bg) 0,
var(--pst-color-danger-bg) 20px,
transparent 20px,
transparent 40px
);
background-image: repeating-linear-gradient(
45deg,
var(--pst-color-danger-bg) 0,
var(--pst-color-danger-bg) 20px,
transparent 20px,
transparent 40px
);
}

.bd-sidebar-primary,
.bd-sidebar-secondary,
body:not(.scrolled) .bd-header-article {
background-color: initial !important;
background-color: initial !important;
}
27 changes: 12 additions & 15 deletions basic-scrna-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
"outputs": [],
"source": [
"# Core scverse libraries\n",
"import scanpy as sc\n",
"from __future__ import annotations\n",
"\n",
"import anndata as ad\n",
"\n",
"# Data retrieval\n",
"import pooch"
"import pooch\n",
"import scanpy as sc"
]
},
{
Expand Down Expand Up @@ -185,9 +187,7 @@
"metadata": {},
"outputs": [],
"source": [
"sc.pp.calculate_qc_metrics(\n",
" adata, qc_vars=[\"mt\", \"ribo\", \"hb\"], inplace=True, log1p=True\n",
")"
"sc.pp.calculate_qc_metrics(adata, qc_vars=[\"mt\", \"ribo\", \"hb\"], inplace=True, log1p=True)"
]
},
{
Expand Down Expand Up @@ -604,12 +604,13 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": null,
"id": "11bb19be-3df1-4a17-ad84-16b50a9348ea",
"metadata": {},
"outputs": [],
"source": [
"# Using the igraph implementation and a fixed number of iterations can be significantly faster, especially for larger datasets\n",
"# Using the igraph implementation and a fixed number of iterations can be significantly faster,\n",
"# especially for larger datasets\n",
"sc.tl.leiden(adata, flavor=\"igraph\", n_iterations=2)"
]
},
Expand Down Expand Up @@ -764,9 +765,7 @@
"outputs": [],
"source": [
"for res in [0.02, 0.5, 2.0]:\n",
" sc.tl.leiden(\n",
" adata, key_added=f\"leiden_res_{res:4.2f}\", resolution=res, flavor=\"igraph\"\n",
" )"
" sc.tl.leiden(adata, key_added=f\"leiden_res_{res:4.2f}\", resolution=res, flavor=\"igraph\")"
]
},
{
Expand Down Expand Up @@ -1052,9 +1051,7 @@
}
],
"source": [
"sc.pl.rank_genes_groups_dotplot(\n",
" adata, groupby=\"leiden_res_0.50\", standard_scale=\"var\", n_genes=5\n",
")"
"sc.pl.rank_genes_groups_dotplot(adata, groupby=\"leiden_res_0.50\", standard_scale=\"var\", n_genes=5)"
]
},
{
Expand Down Expand Up @@ -1214,7 +1211,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "notebook",
"language": "python",
"name": "python3"
},
Expand All @@ -1228,7 +1225,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.7"
},
"mystnb": {
"execution_mode": "off"
Expand Down
18 changes: 18 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://biomejs.dev/schemas/2.1.1/schema.json",
"formatter": { "useEditorconfig": true },
"overrides": [
{
"includes": ["./.vscode/*.json", "**/*.jsonc", "**/asv.conf.json"],
"json": {
"formatter": {
"trailingCommas": "all",
},
"parser": {
"allowComments": true,
"allowTrailingCommas": true,
},
},
},
],
}
22 changes: 13 additions & 9 deletions conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from collections.abc import Mapping
from datetime import datetime
from __future__ import annotations

from datetime import UTC, datetime
from importlib.metadata import metadata
from types import MappingProxyType
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING, ClassVar

from docutils import nodes
from sphinx import addnodes
Expand All @@ -11,7 +12,10 @@
from sphinx.ext.intersphinx import resolve_reference_in_inventory
from sphinx.util.docutils import SphinxDirective


if TYPE_CHECKING:
from collections.abc import Mapping, Sequence

from docutils.parsers.rst.states import Inliner
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
Expand All @@ -20,7 +24,7 @@
meta = metadata("scanpy-tutorials")
project = meta["Name"]
author = meta["Author"]
copyright = f"{datetime.now():%Y}, {author}"
copyright = f"{datetime.now(UTC):%Y}, {author}" # noqa: A001
release = version = meta["Version"]

extensions = [
Expand Down Expand Up @@ -48,7 +52,6 @@
anndata=("https://anndata.readthedocs.io/en/stable/", None),
scanpy=("https://scanpy.readthedocs.io/en/stable/", None),
)
# TODO: move images here from scanpy
suppress_warnings = ["image.not_readable"]

# -- Options for HTML output ----------------------------------------------
Expand Down Expand Up @@ -88,6 +91,7 @@ def fake_cite(
options: Mapping[str, object] = MappingProxyType({}),
content: Sequence[str] = (),
) -> tuple[list[nodes.Node], list[str]]:
del name, lineno, options, content
msg = f"cite:{text}"
return [
inliner.document.reporter.info(msg),
Expand All @@ -96,16 +100,15 @@ def fake_cite(


class FakeDomain(Domain):
name = "cite"
roles = dict(p=fake_cite, t=fake_cite)
name: ClassVar = "cite"
roles: ClassVar = dict(p=fake_cite, t=fake_cite)


# Role linking to the canonical location in scanpy’s docs


MSG = (
"Please access this document in its canonical location "
"as the currently accessed page may not be rendered correctly"
"Please access this document in its canonical location as the currently accessed page may not be rendered correctly"
)


Expand Down Expand Up @@ -144,6 +147,7 @@ def missing_reference(
node: addnodes.pending_xref,
contnode: nodes.TextElement,
) -> nodes.Node | None:
del app, env, contnode
# ignore known scanpy labels
if node["reftarget"] in {
"external-data-integration",
Expand Down
Loading