Skip to content

Commit

Permalink
Merge pull request #157 from ajdawson/updates-to-pre-commit-and-pypro…
Browse files Browse the repository at this point in the history
…ject

Updates to checks in pre-commit config
  • Loading branch information
ajdawson authored Nov 15, 2024
2 parents a6c2f35 + 949bb03 commit e44e56c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.12.0
rev: v2.5.0
hooks:
- id: pyproject-fmt

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
hooks:
- id: ruff
- id: ruff
8 changes: 6 additions & 2 deletions lib/eofs/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def __init__(self, dataset, weights=None, center=True, ddof=1):
raise ValueError('missing values detected in different '
'locations at different times')
if has_dask:
nonMissingIndex = dask.array.where(np.logical_not(np.isnan(self._data[0])))[0]
nonMissingIndex = dask.array.where(
np.logical_not(np.isnan(self._data[0]))
)[0]
else:
nonMissingIndex = np.where(np.logical_not(np.isnan(self._data[0])))[0]
# Remove missing values from the design matrix.
Expand Down Expand Up @@ -744,7 +746,9 @@ def projectField(self, field, neofs=None, eofscaling=0, weighted=True):
raise ValueError('missing values detected in different '
'locations at different times')
if has_dask:
nonMissingIndex = dask.array.where(np.logical_not(np.isnan(self._data[0])))[0] # lee1043 testing
nonMissingIndex = dask.array.where(
np.logical_not(np.isnan(self._data[0]))
)[0]
else:
nonMissingIndex = np.where(np.logical_not(np.isnan(field_flat[0])))[0]
try:
Expand Down
43 changes: 21 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools_scm",
"setuptools-scm",
"wheel",
]

[project]
name = "eofs"
description = "EOF analysis in Python"
license = {text = "GPL-3.0"}
license = { text = "GPL-3.0" }
authors = [
{name = "Andrew Dawson", email = "[email protected]"},
{ name = "Andrew Dawson", email = "[email protected]" },
]
requires-python = ">=3.8"
classifiers = [
Expand All @@ -21,52 +21,51 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = [
"version",
"readme",
"version",
]
dependencies = [
"numpy",
]
[project.optional-dependencies]
iris = ["scitools-iris"]
xarray = ["xarray"]
[project.urls]
documentation = "https://ajdawson.github.io/eofs"
homepage = "https://github.com/ajdawson/eofs"
repository = "https://github.com/ajdawson/eofs"
optional-dependencies.iris = [
"scitools-iris",
]
optional-dependencies.xarray = [
"xarray",
]
urls.documentation = "https://ajdawson.github.io/eofs"
urls.homepage = "https://github.com/ajdawson/eofs"
urls.repository = "https://github.com/ajdawson/eofs"

[tool.setuptools]
license-files = ["COPYING"]
license-files = [ "COPYING" ]
include-package-data = true
[tool.setuptools.packages.find]
where = ["lib"]
where = [ "lib" ]
[tool.setuptools.package-data]
eofs_examples = [
"example_data/*",
]
eofs_tests = ["data/*"]
eofs_tests = [ "data/*" ]
[tool.setuptools.dynamic]
readme = {file = "README.md", content-type = "text/markdown"}
readme = { file = "README.md", content-type = "text/markdown" }

[tool.setuptools_scm]
write_to = "lib/eofs/_version.py"
write_to_template = "__version__ = '{version}'"
tag_regex = "^(?P<prefix>v)?(?P<version>[^\\+]+)(?P<suffix>.*)?$"

[tool.ruff]
select = [
"E", # pycodecstyle
lint.select = [
"E", # pycodecstyle
]
[tool.ruff.per-file-ignores]
"doc/conf.py" = [
lint.per-file-ignores."doc/conf.py" = [
"E401",
"E402",
]
"doc/devguide/gitwash_dumper.py" = [
"E714",
]

[tool.pytest.ini_options]
addopts = "-vrsx"
Expand Down

0 comments on commit e44e56c

Please sign in to comment.