Skip to content

Commit f4d0bbc

Browse files
committed
update
1 parent a358067 commit f4d0bbc

File tree

3 files changed

+227
-55
lines changed

3 files changed

+227
-55
lines changed

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
fail_fast: false
2+
default_language_version:
3+
python: python3
4+
default_stages:
5+
- commit
6+
- push
7+
minimum_pre_commit_version: 2.16.0
8+
repos:
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.3.5
11+
hooks:
12+
- id: ruff
13+
types_or: [python, pyi, jupyter]
14+
args: [--fix, --exit-non-zero-on-fix]
15+
- id: ruff-format
16+
types_or: [python, pyi, jupyter]
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.5.0
19+
hooks:
20+
- id: detect-private-key
21+
- id: check-ast
22+
- id: end-of-file-fixer
23+
- id: mixed-line-ending
24+
args: [--fix=lf]
25+
- id: trailing-whitespace
26+
- id: check-case-conflict
27+
# Check that there are no merge conflicts (could be generated by template sync)
28+
- id: check-merge-conflict
29+
args: [--assume-in-merge]
30+
- repo: local
31+
hooks:
32+
- id: forbid-to-commit
33+
name: Don't commit rej files
34+
entry: |
35+
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
36+
Fix the merge conflicts manually and remove the .rej files.
37+
language: fail
38+
files: '.*\.rej$'

pyproject.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,62 @@ repository = "https://github.com/vitessce/vitessce-python"
9595

9696
[tool.setuptools]
9797
packages = ["vitessce", "vitessce.data_utils"]
98+
99+
[tool.ruff]
100+
line-length = 120
101+
src = ["src"]
102+
extend-include = ["*.ipynb"]
103+
104+
[tool.ruff.format]
105+
docstring-code-format = true
106+
107+
[tool.ruff.lint]
108+
select = [
109+
"F", # Errors detected by Pyflakes
110+
"E", # Error detected by Pycodestyle
111+
"W", # Warning detected by Pycodestyle
112+
"I", # isort
113+
"D", # pydocstyle
114+
"B", # flake8-bugbear
115+
"TID", # flake8-tidy-imports
116+
"C4", # flake8-comprehensions
117+
"BLE", # flake8-blind-except
118+
"UP", # pyupgrade
119+
"RUF100", # Report unused noqa directives
120+
]
121+
ignore = [
122+
# line too long -> we accept long comment lines; formatter gets rid of long code lines
123+
"E501",
124+
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
125+
"E731",
126+
# allow I, O, l as variable names -> I is the identity matrix
127+
"E741",
128+
# Missing docstring in public package
129+
"D104",
130+
# Missing docstring in public module
131+
"D100",
132+
# Missing docstring in __init__
133+
"D107",
134+
# Errors from function calls in argument defaults. These are fine when the result is immutable.
135+
"B008",
136+
# __magic__ methods are are often self-explanatory, allow missing docstrings
137+
"D105",
138+
# first line should end with a period [Bug: doesn't work with single-line docstrings]
139+
"D400",
140+
# First line should be in imperative mood; try rephrasing
141+
"D401",
142+
## Disable one in each pair of mutually incompatible rules
143+
# We don’t want a blank line before a class docstring
144+
"D203",
145+
# We want docstrings to start immediately after the opening triple quote
146+
"D213",
147+
]
148+
149+
[tool.ruff.lint.pydocstyle]
150+
convention = "numpy"
151+
152+
[tool.ruff.lint.per-file-ignores]
153+
"docs/*" = ["I"]
154+
"vitessce/constants.py" = ["D"]
155+
"tests/*" = ["D"]
156+
"*/__init__.py" = ["F401"]

0 commit comments

Comments
 (0)