Skip to content

Commit

Permalink
Update pre-commit hooks and dependencies in configuration files (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersy005 authored Jan 7, 2025
1 parent a32815d commit 02bfda6
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 148 deletions.
29 changes: 3 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,16 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
- id: mixed-line-ending

- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
args:
- "--py39-plus"

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.0"
rev: "v0.8.6"
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -40,14 +23,8 @@ repos:
hooks:
- id: prettier

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: nbqa-ruff
args: ["--fix", "--config=pyproject.toml"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies: [
Expand Down
238 changes: 116 additions & 122 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,155 +1,149 @@

[build-system]
requires = ["setuptools>=64", "setuptools-scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
requires = ["setuptools-scm[toml]>=6.2", "setuptools>=64", "wheel"]

[project]
name = "ndpyramid"
description = "A small utility for generating ND array pyramids using Xarray and Zarr"
readme = "README.md"
license = { text = "MIT" }
authors = [{ name = "CarbonPlan", email = "[email protected]" }]
requires-python = ">=3.10"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",

"Topic :: Scientific/Engineering",
]
dynamic = ["version"]


dependencies = [
"cf_xarray>=0.8.0",
"xarray[complete]>=2024.10.0",
"zarr",
"pydantic>=1.10",
"pyproj",
"rasterio",
"numpy",
]
authors = [{ name = "CarbonPlan", email = "[email protected]" }]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python",

"Topic :: Scientific/Engineering",
]
description = "A small utility for generating ND array pyramids using Xarray and Zarr"
dynamic = ["version"]
license = { text = "MIT" }
name = "ndpyramid"
readme = "README.md"
requires-python = ">=3.10"

dependencies = [
"cf_xarray>=0.8.0",
"numpy",
"pydantic>=1.10",
"pyproj",
"rasterio",
"xarray[complete]>=2024.10.0",
"zarr",
]

[project.optional-dependencies]
complete = [
"ndpyramid[dask,jupyter,xesmf]",
"mercantile",
"cftime",
"scipy",
"rioxarray",
]
dask = ["dask[complete]", "pyresample"]
jupyter = ['notebook', 'ipytree>=0.2.2', 'ipywidgets>=8.0.0', 'matplotlib']
xesmf = ["xesmf>=0.8"]

test = [
"ndpyramid[complete]",
"pre-commit",
"pytest-benchmark",
"pytest-codspeed",
"pytest-cov",
"pytest-mypy",
"pytest",
]

complete = [
"cftime",
"mercantile",
"ndpyramid[dask,jupyter,xesmf]",
"rioxarray",
"scipy",
]
dask = ["dask[complete]", "pyresample"]
jupyter = ['ipytree>=0.2.2', 'ipywidgets>=8.0.0', 'matplotlib', 'notebook']
xesmf = ["xesmf>=0.8"]

test = [
"ndpyramid[complete]",
"pre-commit",
"pytest",
"pytest-benchmark",
"pytest-codspeed",
"pytest-cov",
"pytest-mypy",
]

[project.urls]
repository = "https://github.com/carbonplan/ndpyramid"
repository = "https://github.com/carbonplan/ndpyramid"

[tool.setuptools.packages.find]
include = ["ndpyramid*"]
include = ["ndpyramid*"]

[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "node-and-date"
fallback_version = "999"
write_to = "ndpyramid/_version.py"
write_to_template = '__version__ = "{version}"'


# [tool.setuptools.dynamic]
# version = { attr = "ndpyramid.__version__" }
fallback_version = "999"
local_scheme = "node-and-date"
version_scheme = "post-release"
write_to = "ndpyramid/_version.py"
write_to_template = '__version__ = "{version}"'

# [tool.setuptools.dynamic]
# version = { attr = "ndpyramid.__version__" }

[tool.black]
line-length = 100
target-version = ['py310']
skip-string-normalization = true

line-length = 100
skip-string-normalization = true
target-version = ['py310']

[tool.ruff]

line-length = 100
target-version = "py310"
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",
]
builtins = ["ellipsis"]
extend-include = ["*.ipynb"]
line-length = 100
target-version = "py310"
# 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",
]

[tool.ruff.lint]
# 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",
"Q",
"W",
# isort
"I",
# Pyupgrade
"UP",
]
# 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",
"Q",
"W",
# isort
"I",
# Pyupgrade
"UP",
]

[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
multiline-quotes = "double"
docstring-quotes = "double"
docstring-quotes = "double"
inline-quotes = "double"
multiline-quotes = "double"

[tool.ruff.lint.mccabe]
max-complexity = 18
max-complexity = 18

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

known-first-party = ["ndpyramid"]

# Notebook ruff config
[tool.ruff.lint.per-file-ignores]
"*.ipynb" = ["D100", "E402", "F401"]

"*.ipynb" = ["D100", "E402", "F401"]

[tool.pytest.ini_options]
console_output_style = "count"
addopts = "--cov=./ --cov-report=xml --verbose"
addopts = "--cov=./ --cov-report=xml --verbose"
console_output_style = "count"

[tool.mypy]
ignore_missing_imports = true
no_implicit_optional = false
ignore_missing_imports = true
no_implicit_optional = false

0 comments on commit 02bfda6

Please sign in to comment.