diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92d265b..83150c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -15,35 +15,18 @@ repos: - id: debug-statements - id: mixed-line-ending - - repo: https://github.com/asottile/pyupgrade - rev: v2.34.0 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.244' hooks: - - id: pyupgrade - args: - - '--py38-plus' + - id: ruff + args: ['--fix'] - - repo: https://github.com/psf/black - rev: 22.6.0 + - repo: https://github.com/keewis/blackdoc + rev: v0.3.8 hooks: - - id: black - - id: black-jupyter - - - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 - hooks: - - id: flake8 - - - repo: https://github.com/asottile/seed-isort-config - rev: v2.2.0 - hooks: - - id: seed-isort-config - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 - hooks: - - id: isort + - id: blackdoc - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + rev: v3.0.0-alpha.4 hooks: - id: prettier - language_version: system diff --git a/pyproject.toml b/pyproject.toml index 0efc9d9..96f3103 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,67 @@ [tool.black] line-length = 100 -target-version = ['py38'] +target-version = ['py39'] skip-string-normalization = true [build-system] -requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"] +requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] + + +[tool.ruff] +line-length = 100 +target-version = "py39" +builtins = ["ellipsis"] +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", +] +per-file-ignores = {} +# E402: module level import not at top of file +# E501: line too long - let black worry about that +# E731: do not assign a lambda expression, use a def +ignore = [ + "E402", + "E501", + "E731", +] +select = [ + # Pyflakes + "F", + # Pycodestyle + "E", + "W", + # isort + "I", + # Pyupgrade + "UP", +] + + +[tool.ruff.mccabe] +max-complexity = 18 + +[tool.ruff.isort] +known-first-party = ["ndpyramid"] + +[tool.pytest.ini_options] +console_output_style = "count" +addopts = "--cov=./ --cov-report=xml --verbose" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d3ded2f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[flake8] -exclude = docs -ignore = #Add error codes for lines you want flake8 to ignore. ex E203,E266, etc... -max-line-length = 100 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 -per-file-ignores = __init__.py:F401 - -[isort] -known_first_party=carbonplan -known_third_party=cf_xarray,datatree,numpy,pytest,setuptools,xarray,zarr -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -combine_as_imports=True -line_length=100 - -[mypy-datatree.*] -ignore_missing_imports = True -[mypy-rasterio.*] -ignore_missing_imports = True -[mypy-rioxarray.*] -ignore_missing_imports = True -[mypy-xesmf.*] -ignore_missing_imports = True - - -[tool:pytest] -console_output_style = count -addopts = --cov=./ --cov-report=xml --verbose