Skip to content

Commit

Permalink
update CI checks with ruff (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
norlandrhagen authored Mar 27, 2024
1 parent a48d19f commit 970d354
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 44 deletions.
15 changes: 0 additions & 15 deletions .flake8

This file was deleted.

22 changes: 5 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,12 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
# isort should run before black as black sometimes tweaks the isort output
- repo: https://github.com/PyCQA/isort
rev: 5.13.2

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
hooks:
- id: isort
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- id: ruff
args: ["--fix"]
# - repo: https://github.com/Carreau/velin
# rev: 0.0.8
# hooks:
Expand Down
11 changes: 5 additions & 6 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ channels:
- nodefaults
dependencies:
- python>=3.9
- netcdf4
- pytest
- flake8
- black
- codecov
- pytest-cov
- h5netcdf
- kerchunk
- ujson
- netcdf4
- pydantic
- pytest
- pytest-cov
- ruff
- ujson
- pip:
- git+https://github.com/TomNicholas/xarray.git@concat-no-indexes#egg=xarray
44 changes: 38 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,45 @@ exclude = ["docs", "tests", "tests.*", "docs.*"]
[tool.setuptools.package-data]
datatree = ["py.typed"]

[tool.isort]
profile = "black"
skip_gitignore = true
float_to_top = true
default_section = "THIRDPARTY"
known_first_party = "virtualizarr"


[mypy]
files = "virtualizarr/**/*.py"
show_error_codes = true





[tool.ruff]
line-length = 100
target-version = "py39"

exclude = [
"docs",
".eggs"]


[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"]
per-file-ignores = {}

# E402: module level import not at top of file
# E731: do not assign a lambda expression, use a def
# W503: line break before binary operator - not implimeted by ruff due to conflict with PEP8.

ignore = ["E402", "E731"]

[tool.ruff.format]
# Indent with spaces, rather than tabs.
indent-style = "space"
# Respect magic trailing commas.
skip-magic-trailing-comma = false
# Automatically detect the appropriate line ending.
line-ending = "auto"

[tool.ruff.lint.isort]
known-first-party = ["virtualizarr"]

0 comments on commit 970d354

Please sign in to comment.