Skip to content

Commit c26290b

Browse files
Formatting (#3414)
Co-authored-by: Ilan Gold <[email protected]>
1 parent e71dc55 commit c26290b

File tree

9 files changed

+146
-65
lines changed

9 files changed

+146
-65
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Thumbs.db
4242

4343
# IDEs and editors
4444
/.idea/
45-
/.vscode/
4645

4746
# asv benchmark files
4847
/benchmarks/.asv

.pre-commit-config.yaml

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ repos:
33
rev: v0.8.6
44
hooks:
55
- id: ruff
6-
types_or: [python, pyi, jupyter]
76
args: ["--fix"]
87
- id: ruff-format
9-
types_or: [python, pyi, jupyter]
108
# The following can be removed once PLR0917 is out of preview
119
- name: ruff preview rules
1210
id: ruff
13-
types_or: [python, pyi, jupyter]
1411
args: ["--preview", "--select=PLR0917"]
1512
- repo: https://github.com/flying-sheep/bibfmt
1613
rev: v4.3.0
@@ -19,6 +16,15 @@ repos:
1916
args:
2017
- --sort-by-bibkey
2118
- --drop=abstract
19+
- repo: https://github.com/biomejs/pre-commit
20+
rev: v0.6.1
21+
hooks:
22+
- id: biome-format
23+
additional_dependencies: ["@biomejs/[email protected]"]
24+
- repo: https://github.com/ComPWA/taplo-pre-commit
25+
rev: v0.9.3
26+
hooks:
27+
- id: taplo-format
2228
- repo: https://github.com/pre-commit/pre-commit-hooks
2329
rev: v5.0.0
2430
hooks:
@@ -34,6 +40,3 @@ repos:
3440
- id: detect-private-key
3541
- id: no-commit-to-branch
3642
args: ["--branch=main"]
37-
38-
ci:
39-
autofix_prs: false

.taplo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[formatting]
2+
array_auto_collapse = false
3+
column_width = 120
4+
compact_arrays = false
5+
indent_string = ' '

.vscode/launch.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python: Build Documentation",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"module": "sphinx",
9+
"args": ["-M", "html", ".", "_build"],
10+
"cwd": "${workspaceFolder}/docs",
11+
"console": "internalConsole",
12+
"justMyCode": false,
13+
},
14+
{
15+
"name": "Python: Debug Test",
16+
"type": "debugpy",
17+
"request": "launch",
18+
"program": "${file}",
19+
"purpose": ["debug-test"],
20+
"console": "internalConsole",
21+
"justMyCode": false,
22+
"env": { "PYTEST_ADDOPTS": "--color=yes" },
23+
"presentation": { "hidden": true },
24+
},
25+
],
26+
}

.vscode/settings.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"[python][toml][json][jsonc]": {
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.organizeImports": "explicit",
6+
"source.fixAll": "explicit",
7+
},
8+
},
9+
"[python]": {
10+
"editor.defaultFormatter": "charliermarsh.ruff",
11+
},
12+
"[toml]": {
13+
"editor.defaultFormatter": "tamasfe.even-better-toml",
14+
},
15+
"[json][jsonc]": {
16+
"editor.defaultFormatter": "biomejs.biome",
17+
},
18+
"python.analysis.typeCheckingMode": "basic",
19+
"python.testing.pytestArgs": ["-vv", "--color=yes"],
20+
"python.testing.pytestEnabled": true,
21+
"python.terminal.activateEnvironment": true,
22+
}

biome.jsonc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"formatter": {
4+
"indentStyle": "space",
5+
"indentWidth": 4,
6+
},
7+
"overrides": [
8+
{
9+
"include": ["./.vscode/*.json", "**/*.jsonc", "**/asv.conf.json"],
10+
"json": {
11+
"formatter": {
12+
"trailingCommas": "all",
13+
},
14+
"parser": {
15+
"allowComments": true,
16+
"allowTrailingCommas": true,
17+
},
18+
},
19+
},
20+
],
21+
}

hatch.toml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[envs.default]
22
installer = "uv"
3-
features = ["dev"]
3+
features = [ "dev" ]
44

55
[envs.docs]
6-
features = ["doc"]
6+
features = [ "doc" ]
77
scripts.build = "sphinx-build -M html docs docs/_build -W --keep-going {args}"
88
scripts.open = "python3 -m webbrowser -t docs/_build/html/index.html"
99
scripts.clean = "git clean -fdX -- {args:docs}"
@@ -14,23 +14,23 @@ scripts.build = "python3 ci/scripts/towncrier_automation.py {args}"
1414
scripts.clean = "git restore --source=HEAD --staged --worktree -- docs/release-notes"
1515

1616
[envs.hatch-test]
17-
default-args = []
18-
features = ["test", "dask-ml"]
19-
extra-dependencies = ["ipykernel"]
17+
default-args = [ ]
18+
features = [ "test", "dask-ml" ]
19+
extra-dependencies = [ "ipykernel" ]
2020
overrides.matrix.deps.env-vars = [
21-
{ if = ["pre"], key = "UV_PRERELEASE", value = "allow" },
22-
{ if = ["min"], key = "UV_CONSTRAINT", value = "ci/scanpy-min-deps.txt" },
21+
{ if = [ "pre" ], key = "UV_PRERELEASE", value = "allow" },
22+
{ if = [ "min" ], key = "UV_CONSTRAINT", value = "ci/scanpy-min-deps.txt" },
2323
]
2424
overrides.matrix.deps.pre-install-commands = [
25-
{ if = ["min"], value = "uv run ci/scripts/min-deps.py pyproject.toml --all-extras -o ci/scanpy-min-deps.txt" },
25+
{ if = [ "min" ], value = "uv run ci/scripts/min-deps.py pyproject.toml --all-extras -o ci/scanpy-min-deps.txt" },
2626
]
2727
overrides.matrix.deps.python = [
28-
{ if = ["min"], value = "3.10" },
29-
{ if = ["stable", "full", "pre"], value = "3.12" },
28+
{ if = [ "min" ], value = "3.10" },
29+
{ if = [ "stable", "full", "pre" ], value = "3.12" },
3030
]
3131
overrides.matrix.deps.features = [
32-
{ if = ["full"], value = "test-full" },
32+
{ if = [ "full" ], value = "test-full" },
3333
]
3434

3535
[[envs.hatch-test.matrix]]
36-
deps = ["stable", "full", "pre", "min"]
36+
deps = [ "stable", "full", "pre", "min" ]

pyproject.toml

+45-45
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
[build-system]
22
build-backend = "hatchling.build"
3-
requires = ["hatchling", "hatch-vcs"]
3+
requires = [ "hatchling", "hatch-vcs" ]
44

55
[project]
66
name = "scanpy"
77
description = "Single-Cell Analysis in Python."
88
requires-python = ">=3.10"
99
license = "BSD-3-clause"
1010
authors = [
11-
{name = "Alex Wolf"},
12-
{name = "Philipp Angerer"},
13-
{name = "Fidel Ramirez"},
14-
{name = "Isaac Virshup"},
15-
{name = "Sergei Rybakov"},
16-
{name = "Gokcen Eraslan"},
17-
{name = "Tom White"},
18-
{name = "Malte Luecken"},
19-
{name = "Davide Cittaro"},
20-
{name = "Tobias Callies"},
21-
{name = "Marius Lange"},
22-
{name = "Andrés R. Muñoz-Rojas"},
11+
{ name = "Alex Wolf" },
12+
{ name = "Philipp Angerer" },
13+
{ name = "Fidel Ramirez" },
14+
{ name = "Isaac Virshup" },
15+
{ name = "Sergei Rybakov" },
16+
{ name = "Gokcen Eraslan" },
17+
{ name = "Tom White" },
18+
{ name = "Malte Luecken" },
19+
{ name = "Davide Cittaro" },
20+
{ name = "Tobias Callies" },
21+
{ name = "Marius Lange" },
22+
{ name = "Andrés R. Muñoz-Rojas" },
2323
]
2424
maintainers = [
25-
{name = "Philipp Angerer", email = "[email protected]"},
26-
{name = "Ilan Gold"},
27-
{name = "Severin Dicks"},
25+
{ name = "Philipp Angerer", email = "[email protected]" },
26+
{ name = "Ilan Gold", email = "[email protected]" },
27+
{ name = "Severin Dicks" },
2828
]
2929
readme = "README.md"
3030
classifiers = [
@@ -56,7 +56,7 @@ dependencies = [
5656
"tqdm",
5757
"scikit-learn>=1.1,<1.6.0",
5858
"statsmodels>=0.13",
59-
"patsy!=1.0.0", # https://github.com/pydata/patsy/issues/215
59+
"patsy!=1.0.0", # https://github.com/pydata/patsy/issues/215
6060
"networkx>=2.7",
6161
"natsort",
6262
"joblib",
@@ -65,10 +65,10 @@ dependencies = [
6565
"pynndescent>=0.5",
6666
"packaging>=21.3",
6767
"session-info2",
68-
"legacy-api-wrap>=1.4", # for positional API deprecations
68+
"legacy-api-wrap>=1.4", # for positional API deprecations
6969
"typing-extensions; python_version < '3.13'",
7070
]
71-
dynamic = ["version"]
71+
dynamic = [ "version" ]
7272

7373
# https://docs.pypi.org/project_metadata/#project-urls
7474
[project.urls]
@@ -120,13 +120,13 @@ doc = [
120120
"sphinx-design",
121121
"sphinx-tabs",
122122
"readthedocs-sphinx-search",
123-
"sphinxext-opengraph", # for nice cards when sharing on social
123+
"sphinxext-opengraph", # for nice cards when sharing on social
124124
"sphinx-copybutton",
125125
"nbsphinx>=0.9",
126-
"ipython>=7.20", # for nbsphinx code highlighting
126+
"ipython>=7.20", # for nbsphinx code highlighting
127127
"matplotlib!=3.6.1",
128128
"sphinxcontrib-bibtex",
129-
"setuptools", # undeclared dependency of sphinxcontrib-bibtex→pybtex
129+
"setuptools", # undeclared dependency of sphinxcontrib-bibtex→pybtex
130130
# TODO: remove necessity for being able to import doc-linked classes
131131
"scanpy[paga,dask-ml]",
132132
"sam-algorithm",
@@ -139,22 +139,22 @@ dev = [
139139
"towncrier",
140140
]
141141
# Algorithms
142-
paga = ["igraph"]
143-
louvain = ["igraph", "louvain>=0.6.0,!=0.6.2"] # Louvain community detection
144-
leiden = ["igraph>=0.10", "leidenalg>=0.9.0"] # Leiden community detection
145-
bbknn = ["bbknn"] # Batch balanced KNN (batch correction)
146-
magic = ["magic-impute>=2.0"] # MAGIC imputation method
147-
skmisc = ["scikit-misc>=0.1.3"] # highly_variable_genes method 'seurat_v3'
148-
harmony = ["harmonypy"] # Harmony dataset integration
149-
scanorama = ["scanorama"] # Scanorama dataset integration
150-
scrublet = ["scikit-image"] # Doublet detection with automatic thresholds
142+
paga = [ "igraph" ]
143+
louvain = [ "igraph", "louvain>=0.6.0,!=0.6.2" ] # Louvain community detection
144+
leiden = [ "igraph>=0.10", "leidenalg>=0.9.0" ] # Leiden community detection
145+
bbknn = [ "bbknn" ] # Batch balanced KNN (batch correction)
146+
magic = [ "magic-impute>=2.0" ] # MAGIC imputation method
147+
skmisc = [ "scikit-misc>=0.1.3" ] # highly_variable_genes method 'seurat_v3'
148+
harmony = [ "harmonypy" ] # Harmony dataset integration
149+
scanorama = [ "scanorama" ] # Scanorama dataset integration
150+
scrublet = [ "scikit-image" ] # Doublet detection with automatic thresholds
151151
# Acceleration
152-
rapids = ["cudf>=0.9", "cuml>=0.9", "cugraph>=0.9"] # GPU accelerated calculation of neighbors
153-
dask = ["dask[array]>=2022.09.2,<2024.8.0"] # Use the Dask parallelization engine
154-
dask-ml = ["dask-ml", "scanpy[dask]"] # Dask-ML for sklearn-like API
152+
rapids = [ "cudf>=0.9", "cuml>=0.9", "cugraph>=0.9" ] # GPU accelerated calculation of neighbors
153+
dask = [ "dask[array]>=2022.09.2,<2024.8.0" ] # Use the Dask parallelization engine
154+
dask-ml = [ "dask-ml", "scanpy[dask]" ] # Dask-ML for sklearn-like API
155155

156156
[tool.hatch.build.targets.wheel]
157-
packages = ["src/testing", "src/scanpy"]
157+
packages = [ "src/testing", "src/scanpy" ]
158158
[tool.hatch.version]
159159
source = "vcs"
160160
raw-options.version_scheme = "release-branch-semver"
@@ -169,8 +169,8 @@ addopts = [
169169
"-ptesting.scanpy._pytest",
170170
"--pyargs",
171171
]
172-
testpaths = ["./tests", "./ci", "scanpy"]
173-
norecursedirs = ["tests/_images"]
172+
testpaths = [ "./tests", "./ci", "scanpy" ]
173+
norecursedirs = [ "tests/_images" ]
174174
xfail_strict = true
175175
nunit_attach_on = "fail"
176176
markers = [
@@ -203,12 +203,12 @@ filterwarnings = [
203203

204204
[tool.coverage.run]
205205
data_file = "test-data/coverage"
206-
source_pkgs = ["scanpy"]
207-
omit = ["tests/*", "src/testing/*"]
206+
source_pkgs = [ "scanpy" ]
207+
omit = [ "tests/*", "src/testing/*" ]
208208
[tool.coverage.xml]
209209
output = "test-data/coverage.xml"
210210
[tool.coverage.paths]
211-
source = [".", "**/site-packages"]
211+
source = [ ".", "**/site-packages" ]
212212
[tool.coverage.report]
213213
exclude_also = [
214214
"if __name__ == .__main__.:",
@@ -218,7 +218,7 @@ exclude_also = [
218218
]
219219

220220
[tool.ruff]
221-
src = ["src"]
221+
src = [ "src" ]
222222

223223
[tool.ruff.format]
224224
docstring-code-format = true
@@ -254,10 +254,10 @@ ignore = [
254254
]
255255
[tool.ruff.lint.per-file-ignores]
256256
# Do not assign a lambda expression, use a def
257-
"src/scanpy/tools/_rank_genes_groups.py" = ["E731"]
257+
"src/scanpy/tools/_rank_genes_groups.py" = [ "E731" ]
258258
[tool.ruff.lint.isort]
259-
known-first-party = ["scanpy", "testing.scanpy"]
260-
required-imports = ["from __future__ import annotations"]
259+
known-first-party = [ "scanpy", "testing.scanpy" ]
260+
required-imports = [ "from __future__ import annotations" ]
261261
[tool.ruff.lint.flake8-tidy-imports.banned-api]
262262
"pytest.importorskip".msg = "Use the “@needs” decorator/mark instead"
263263
"pandas.api.types.is_categorical_dtype".msg = "Use isinstance(s.dtype, CategoricalDtype) instead"
@@ -267,7 +267,7 @@ required-imports = ["from __future__ import annotations"]
267267
"numba.jit".msg = "Use `scanpy._compat.njit` instead"
268268
"numba.njit".msg = "Use `scanpy._compat.njit` instead"
269269
[tool.ruff.lint.flake8-type-checking]
270-
exempt-modules = []
270+
exempt-modules = [ ]
271271
strict = true
272272

273273
[tool.towncrier]
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
{"spot_diameter_fullres": 89.42751063343188, "tissue_hires_scalef": 0.150015, "fiducial_diameter_fullres": 144.45982486939, "tissue_lowres_scalef": 0.045004502}
1+
{
2+
"spot_diameter_fullres": 89.42751063343188,
3+
"tissue_hires_scalef": 0.150015,
4+
"fiducial_diameter_fullres": 144.45982486939,
5+
"tissue_lowres_scalef": 0.045004502
6+
}

0 commit comments

Comments
 (0)