Skip to content

Commit

Permalink
Update pre-commit-config
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorkertesz committed Oct 11, 2024
1 parent 89f8736 commit f091f6e
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 58 deletions.
54 changes: 35 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: trailing-whitespace # Trailing whitespace checker
- id: end-of-file-fixer # Ensure files end in a newline
- id: check-json
- id: check-yaml
- id: check-yaml # Check YAML files for syntax errors only
args: [--unsafe, --allow-multiple-documents]
- id: check-toml
# - id: check-added-large-files
- id: debug-statements
- id: debug-statements # Check for debugger imports and py37+ breakpoint()
- id: mixed-line-ending
- id: no-commit-to-branch # Prevent committing to main / master
- id: check-merge-conflict # Check for files that contain merge conflict
exclude: /README\.rst$|^docs/.*\.rst$
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args:
- -l 120
- --force-single-line-imports
- --profile black
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 24.8.0
hooks:
- id: black
args: [--line-length=120]
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: blackdoc
additional_dependencies: [black==23.3.0]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: xr_engine_profile_rst\.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
exclude: '(dev/.*|.*_)\.py$'
args:
- --line-length=120
- --fix
- --exit-non-zero-on-fix
- --preview
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
hooks:
Expand All @@ -37,11 +53,11 @@ repos:
hooks:
- id: pretty-format-yaml
args: [--autofix, --preserve-quotes]
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/PyCQA/pydocstyle.git
rev: 6.1.1
hooks:
- id: pydocstyle
additional_dependencies: [toml]
exclude: tests|docs
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
- id: sphinx-lint
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.4"
hooks:
- id: pyproject-fmt
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ COV_REPORT := html
setup:
pre-commit install

default: qa unit-tests type-check
default: qa unit-tests

qa:
pre-commit run --all-files

unit-tests:
cd .. && python -m pytest earthkit -vv --cov=. --cov-report=$(COV_REPORT) && cd -

type-check:
python -m mypy .

conda-env-update:
$(CONDA) env update $(CONDAFLAGS) -f environment.yml

Expand Down
1 change: 0 additions & 1 deletion docs/examples/01_grib_file.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"source": [
"import io\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from earthkit import data, regrid\n",
"\n",
"fs = data.from_source(\"file\", \"tz_1000.grib\")"
Expand Down
1 change: 0 additions & 1 deletion docs/examples/02_grib_fdb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"source": [
"import io\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pyfdb\n",
"from earthkit import data, regrid"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/05_polytope_polygon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,8 @@
}
],
"source": [
"da = ds.to_xarray()\n",
"import earthkit.plots\n",
"da = ds.to_xarray()\n",
"chart = earthkit.plots.Map(domain=\"Portugal\")\n",
"chart.point_cloud(da['2t'], x=\"y\", y=\"x\")\n",
"\n",
Expand Down Expand Up @@ -2661,6 +2661,7 @@
],
"source": [
"import earthkit.data\n",
"import earthkit.plots\n",
" \n",
" \n",
"shape1 = [\n",
Expand Down Expand Up @@ -3076,7 +3077,6 @@
" ]\n",
" ]\n",
" \n",
"import earthkit.plots\n",
"chart = earthkit.plots.Map(domain=\"Europe\")\n",
" \n",
"request = {\n",
Expand Down
60 changes: 29 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,60 +1,58 @@
[build-system]
requires = ["setuptools>=61", "setuptools-scm>=8.0"]
requires = [ "setuptools>=61", "setuptools-scm>=8" ]

[project]
name = "earthkit"
description = "A format-agnostic Python interface for geospatial data"
readme = "README.md"
license = { text = "Apache License Version 2.0" }
authors = [
{name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "[email protected]"}
{ name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "[email protected]" },
]
requires-python = ">=3.8"

classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent"
]
dynamic = [ "version" ]
dependencies = [
"earthkit-data[all]>=0.10.2",
"earthkit-geo>=0.2.0",
"earthkit-geo>=0.2",
"earthkit-meteo>=0.1.1",
"earthkit-plots>=0.2.0",
"earthkit-plots>=0.2",
"earthkit-regrid>=0.3.4",
"earthkit-transforms>=0.3.3"
"earthkit-transforms>=0.3.3",
]
description = "A format-agnostic Python interface for geospatial data"
dynamic = ["version"]
license = {text = "Apache License Version 2.0"}
name = "earthkit"
readme = "README.md"
requires-python = ">= 3.8"

[project.optional-dependencies]
test = ["pytest"]
optional-dependencies.test = [ "pytest" ]
urls.Documentation = "https://earthkit.readthedocs.io/"
urls.Homepage = "https://github.com/ecmwf/earthkit/"
urls.Issues = "https://github.com/ecmwf/earthkit.issues"
urls.Repository = "https://github.com/ecmwf/earthkit/"

[project.urls]
Documentation = "https://earthkit.readthedocs.io/"
Homepage = "https://github.com/ecmwf/earthkit/"
Issues = "https://github.com/ecmwf/earthkit.issues"
Repository = "https://github.com/ecmwf/earthkit/"
[tool.setuptools.packages.find]
include = [ "earthkit", "earthkit.*" ]
where = [ "src/", "./" ]

[tool.coverage.run]
branch = "true"
[tool.setuptools_scm]
version_file = "src/earthkit/_version.py"

[tool.isort]
profile = "black"

[tool.coverage.run]
branch = "true"

[tool.pydocstyle]
add_ignore = ["D1", "D200", "D205", "D400", "D401"]
add_ignore = [ "D1", "D200", "D205", "D400", "D401" ]
convention = "numpy"

[tool.setuptools.packages.find]
include = ["earthkit", "earthkit.*"]
where = ["src/", "./"]

[tool.setuptools_scm]
version_file = "src/earthkit/_version.py"
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

0 comments on commit f091f6e

Please sign in to comment.