Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IO warning #296

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
62 changes: 0 additions & 62 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/prepare_test_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Download test datasets
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand All @@ -37,7 +37,7 @@ jobs:
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Restore pip cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }}
Expand Down
56 changes: 5 additions & 51 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,22 @@ default_stages:
- pre-push
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.5.1
hooks:
- id: prettier
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
- repo: https://github.com/PyCQA/isort
rev: 6.0.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.2
hooks:
- id: isort
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
additional_dependencies: [numpy, types-PyYAML]
exclude: docs/
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
additional_dependencies:
- flake8-tidy-imports
- flake8-docstrings
- flake8-rst-docstrings
- flake8-comprehensions
- flake8-bugbear
- flake8-blind-except
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand All @@ -49,31 +32,6 @@ repos:
args: [--fix=lf]
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --remove-unused-variable
- --ignore-init-module-imports
- repo: https://github.com/PyCQA/flake8
rev: 7.1.2
hooks:
- id: flake8
additional_dependencies:
- flake8-tidy-imports
- flake8-docstrings
- flake8-rst-docstrings
- flake8-comprehensions
- flake8-bugbear
- flake8-blind-except
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py3-plus, --py310-plus, --keep-runtime-typing]
- repo: local
hooks:
- id: forbid-to-commit
Expand All @@ -83,7 +41,3 @@ repos:
Fix the merge conflicts manually and remove the .rej files.
language: fail
files: '.*\.rej$'
- repo: https://github.com/PyCQA/doc8
rev: v1.1.2
hooks:
- id: doc8
5 changes: 2 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# 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"
sphinx:
configuration: docs/conf.py
fail_on_warning: true
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ Marconato, L., Palla, G., Yamauchi, K.A. et al. SpatialData: an open and univers
[link-docs]: https://spatialdata.scverse.org/projects/io/en/latest/
[link-api]: https://spatialdata.scverse.org/projects/io/en/latest/api.html
[link-cli]: https://spatialdata.scverse.org/projects/io/en/latest/cli.html

[//]: # (numfocus-fiscal-sponsor-attribution)
[//]: # "numfocus-fiscal-sponsor-attribution"

spatialdata-io is part of the scverse® project ([website](https://scverse.org), [governance](https://scverse.org/about/roles)) and is fiscally sponsored by [NumFOCUS](https://numfocus.org/).
If you like scverse® and want to support our mission, please consider making a tax-deductible [donation](https://numfocus.org/donate-to-scverse) to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from datetime import datetime
from importlib.metadata import metadata
from pathlib import Path

import spatialdata_io.experimental

_ = spatialdata_io.experimental
Expand Down
2 changes: 1 addition & 1 deletion docs/extensions/typed_returns.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def _process_return(lines):
m = re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
if m:
# Once this is in scanpydoc, we can use the fancy hover stuff
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
yield f"-{m['param']} (:class:`~{m['type']}`)"
else:
yield line

Expand Down
126 changes: 101 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,108 @@ addopts = [
"--import-mode=importlib", # allow using test files with same name
]

[tool.isort]
include_trailing_comma = true
multi_line_output = 3
profile = "black"
skip_glob = ["docs/*"]

[tool.black]
[tool.ruff]
line-length = 120
target-version = ['py310']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
)
'''
exclude = [
".git",
".tox",
"__pycache__",
"build",
"docs/_build",
"dist",
"setup.py",
]
lint.select = [
"F", # Errors detected by Pyflakes
"E", # Error detected by Pycodestyle
"W", # Warning detected by Pycodestyle
"I", # isort
"D", # pydocstyle
"B", # flake8-bugbear
"TID", # flake8-tidy-imports
"C4", # flake8-comprehensions
"BLE", # flake8-blind-except
"UP", # pyupgrade
"RUF100", # Report unused noqa directives
"TCH", # Typing imports
"NPY", # Numpy specific rules
# "PTH", # Use pathlib
# "S" # Security
]
lint.ignore = [
# Do not catch blind exception: `Exception`
"BLE001",
# Errors from function calls in argument defaults. These are fine when the result is immutable.
"B008",
# line too long -> we accept long comment lines; black gets rid of long code lines
"E501",
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
"E731",
# allow I, O, l as variable names -> I is the identity matrix
"E741",
# Missing docstring in public module
"D100",
# undocumented-public-class
"D101",
# Missing docstring in public method
"D102",
# Missing docstring in public function
"D103",
# Missing docstring in public package
"D104",
# __magic__ methods are are often self-explanatory, allow missing docstrings
"D105",
# Missing docstring in public nested class
"D106",
# Missing docstring in __init__
"D107",
## Disable one in each pair of mutually incompatible rules
# We don’t want a blank line before a class docstring
"D203",
# 1 blank line required after class docstring
"D204",
# first line should end with a period [Bug: doesn't work with single-line docstrings]
# We want docstrings to start immediately after the opening triple quote
"D213",
# Section underline is over-indented ("{name}")
"D215",
# First line should be in imperative mood; try rephrasing
"D401",
# First word of the first line should be capitalized: {} -> {}
"D403",
# First word of the docstring should not be "This"
"D404",
# Section name should end with a newline ("{name}")
"D406",
# Missing dashed underline after section ("{name}")
"D407",
# Section underline should be in the line following the section's name ("{name}")
"D408",
# Section underline should match the length of its name ("{name}")
"D409",
# No blank lines allowed between a section header and its content ("{name}")
"D412",
# Missing blank line after last section ("{name}")
"D413",
# Missing argument description in the docstring
"D417",
# camcelcase imported as lowercase
"N813",
# module import not at top level of file
"E402",
# open()` should be replaced by `Path.open()
"PTH123",
# subprocess` call: check for execution of untrusted input - https://github.com/PyCQA/bandit/issues/333
"S603",
# Starting a process with a partial executable path
"S607",
# Prefer absolute imports over relative imports from parent modules
"TID252",
# Standard pseudo-random generators are not suitable for cryptographic purposes
"S311",
# Unused imports
"F401",
]

[tool.jupytext]
formats = "ipynb,md"
Expand Down
Loading
Loading