Skip to content

Commit 4ee33da

Browse files
authored
Merge pull request #296 from scverse/fix/warning
Fix IO warning
2 parents 58b2f5d + de335d6 commit 4ee33da

36 files changed

+309
-317
lines changed

.flake8

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/prepare_test_data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Download test datasets
2020
run: |

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
if: startsWith(github.ref, 'refs/tags/v')
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- name: Set up Python 3.12
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: "3.12"
1717
cache: pip

.github/workflows/test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
PYTHON: ${{ matrix.python }}
2727

2828
steps:
29-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
3030
- name: Set up Python ${{ matrix.python }}
31-
uses: actions/setup-python@v4
31+
uses: actions/setup-python@v5
3232
with:
3333
python-version: ${{ matrix.python }}
3434

@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
echo "::set-output name=dir::$(pip cache dir)"
3939
- name: Restore pip cache
40-
uses: actions/cache@v3
40+
uses: actions/cache@v4
4141
with:
4242
path: ${{ steps.pip-cache-dir.outputs.dir }}
4343
key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }}

.pre-commit-config.yaml

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,22 @@ default_stages:
66
- pre-push
77
minimum_pre_commit_version: 2.16.0
88
repos:
9-
- repo: https://github.com/psf/black
10-
rev: 25.1.0
11-
hooks:
12-
- id: black
139
- repo: https://github.com/rbubley/mirrors-prettier
1410
rev: v3.5.1
1511
hooks:
1612
- id: prettier
17-
- repo: https://github.com/asottile/blacken-docs
18-
rev: 1.19.1
19-
hooks:
20-
- id: blacken-docs
21-
- repo: https://github.com/PyCQA/isort
22-
rev: 6.0.0
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.11.2
2315
hooks:
24-
- id: isort
16+
- id: ruff
17+
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
18+
- id: ruff-format
2519
- repo: https://github.com/pre-commit/mirrors-mypy
2620
rev: v1.15.0
2721
hooks:
2822
- id: mypy
2923
additional_dependencies: [numpy, types-PyYAML]
3024
exclude: docs/
31-
- repo: https://github.com/asottile/yesqa
32-
rev: v1.5.0
33-
hooks:
34-
- id: yesqa
35-
additional_dependencies:
36-
- flake8-tidy-imports
37-
- flake8-docstrings
38-
- flake8-rst-docstrings
39-
- flake8-comprehensions
40-
- flake8-bugbear
41-
- flake8-blind-except
4225
- repo: https://github.com/pre-commit/pre-commit-hooks
4326
rev: v5.0.0
4427
hooks:
@@ -49,31 +32,6 @@ repos:
4932
args: [--fix=lf]
5033
- id: trailing-whitespace
5134
- id: check-case-conflict
52-
- repo: https://github.com/PyCQA/autoflake
53-
rev: v2.3.1
54-
hooks:
55-
- id: autoflake
56-
args:
57-
- --in-place
58-
- --remove-all-unused-imports
59-
- --remove-unused-variable
60-
- --ignore-init-module-imports
61-
- repo: https://github.com/PyCQA/flake8
62-
rev: 7.1.2
63-
hooks:
64-
- id: flake8
65-
additional_dependencies:
66-
- flake8-tidy-imports
67-
- flake8-docstrings
68-
- flake8-rst-docstrings
69-
- flake8-comprehensions
70-
- flake8-bugbear
71-
- flake8-blind-except
72-
- repo: https://github.com/asottile/pyupgrade
73-
rev: v3.19.1
74-
hooks:
75-
- id: pyupgrade
76-
args: [--py3-plus, --py310-plus, --keep-runtime-typing]
7735
- repo: local
7836
hooks:
7937
- id: forbid-to-commit
@@ -83,7 +41,3 @@ repos:
8341
Fix the merge conflicts manually and remove the .rej files.
8442
language: fail
8543
files: '.*\.rej$'
86-
- repo: https://github.com/PyCQA/doc8
87-
rev: v1.1.2
88-
hooks:
89-
- id: doc8

.readthedocs.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# https://docs.readthedocs.io/en/stable/config-file/v2.html
21
version: 2
32
build:
4-
os: ubuntu-20.04
3+
os: ubuntu-24.04
54
tools:
6-
python: "3.10"
5+
python: "3.12"
76
sphinx:
87
configuration: docs/conf.py
98
fail_on_warning: true

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from datetime import datetime
1010
from importlib.metadata import metadata
1111
from pathlib import Path
12+
1213
import spatialdata_io.experimental
1314

1415
_ = spatialdata_io.experimental

docs/extensions/typed_returns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def _process_return(lines):
1111
m = re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
1212
if m:
1313
# Once this is in scanpydoc, we can use the fancy hover stuff
14-
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
14+
yield f"-{m['param']} (:class:`~{m['type']}`)"
1515
else:
1616
yield line
1717

pyproject.toml

Lines changed: 101 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,108 @@ addopts = [
7878
"--import-mode=importlib", # allow using test files with same name
7979
]
8080

81-
[tool.isort]
82-
include_trailing_comma = true
83-
multi_line_output = 3
84-
profile = "black"
85-
skip_glob = ["docs/*"]
86-
87-
[tool.black]
81+
[tool.ruff]
8882
line-length = 120
89-
target-version = ['py310']
90-
include = '\.pyi?$'
91-
exclude = '''
92-
(
93-
/(
94-
\.eggs
95-
| \.git
96-
| \.hg
97-
| \.mypy_cache
98-
| \.tox
99-
| \.venv
100-
| _build
101-
| buck-out
102-
| build
103-
| dist
104-
)/
105-
)
106-
'''
83+
exclude = [
84+
".git",
85+
".tox",
86+
"__pycache__",
87+
"build",
88+
"docs/_build",
89+
"dist",
90+
"setup.py",
91+
]
92+
lint.select = [
93+
"F", # Errors detected by Pyflakes
94+
"E", # Error detected by Pycodestyle
95+
"W", # Warning detected by Pycodestyle
96+
"I", # isort
97+
"D", # pydocstyle
98+
"B", # flake8-bugbear
99+
"TID", # flake8-tidy-imports
100+
"C4", # flake8-comprehensions
101+
"BLE", # flake8-blind-except
102+
"UP", # pyupgrade
103+
"RUF100", # Report unused noqa directives
104+
"TCH", # Typing imports
105+
"NPY", # Numpy specific rules
106+
# "PTH", # Use pathlib
107+
# "S" # Security
108+
]
109+
lint.ignore = [
110+
# Do not catch blind exception: `Exception`
111+
"BLE001",
112+
# Errors from function calls in argument defaults. These are fine when the result is immutable.
113+
"B008",
114+
# line too long -> we accept long comment lines; black gets rid of long code lines
115+
"E501",
116+
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
117+
"E731",
118+
# allow I, O, l as variable names -> I is the identity matrix
119+
"E741",
120+
# Missing docstring in public module
121+
"D100",
122+
# undocumented-public-class
123+
"D101",
124+
# Missing docstring in public method
125+
"D102",
126+
# Missing docstring in public function
127+
"D103",
128+
# Missing docstring in public package
129+
"D104",
130+
# __magic__ methods are are often self-explanatory, allow missing docstrings
131+
"D105",
132+
# Missing docstring in public nested class
133+
"D106",
134+
# Missing docstring in __init__
135+
"D107",
136+
## Disable one in each pair of mutually incompatible rules
137+
# We don’t want a blank line before a class docstring
138+
"D203",
139+
# 1 blank line required after class docstring
140+
"D204",
141+
# first line should end with a period [Bug: doesn't work with single-line docstrings]
142+
# We want docstrings to start immediately after the opening triple quote
143+
"D213",
144+
# Section underline is over-indented ("{name}")
145+
"D215",
146+
# First line should be in imperative mood; try rephrasing
147+
"D401",
148+
# First word of the first line should be capitalized: {} -> {}
149+
"D403",
150+
# First word of the docstring should not be "This"
151+
"D404",
152+
# Section name should end with a newline ("{name}")
153+
"D406",
154+
# Missing dashed underline after section ("{name}")
155+
"D407",
156+
# Section underline should be in the line following the section's name ("{name}")
157+
"D408",
158+
# Section underline should match the length of its name ("{name}")
159+
"D409",
160+
# No blank lines allowed between a section header and its content ("{name}")
161+
"D412",
162+
# Missing blank line after last section ("{name}")
163+
"D413",
164+
# Missing argument description in the docstring
165+
"D417",
166+
# camcelcase imported as lowercase
167+
"N813",
168+
# module import not at top level of file
169+
"E402",
170+
# open()` should be replaced by `Path.open()
171+
"PTH123",
172+
# subprocess` call: check for execution of untrusted input - https://github.com/PyCQA/bandit/issues/333
173+
"S603",
174+
# Starting a process with a partial executable path
175+
"S607",
176+
# Prefer absolute imports over relative imports from parent modules
177+
"TID252",
178+
# Standard pseudo-random generators are not suitable for cryptographic purposes
179+
"S311",
180+
# Unused imports
181+
"F401",
182+
]
107183

108184
[tool.jupytext]
109185
formats = "ipynb,md"

0 commit comments

Comments
 (0)