diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index bf4fd0a..69113a0 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -26,7 +26,7 @@ jobs: - name: Install build tools run: | - python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine + python -m pip install --upgrade pip build twine shell: bash diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d17d214..c3a4cf9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,12 +28,12 @@ repos: - id: blackdoc - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.254 + rev: v0.0.269 hooks: - id: ruff - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black language_version: python3 @@ -51,6 +51,6 @@ repos: - id: add-trailing-comma - repo: https://github.com/tox-dev/pyproject-fmt - rev: "0.9.2" + rev: "0.11.2" hooks: - id: pyproject-fmt diff --git a/oceans/datasets.py b/oceans/datasets.py index c52ce90..a5848e6 100644 --- a/oceans/datasets.py +++ b/oceans/datasets.py @@ -36,6 +36,7 @@ def _woa_url(variable, time_period, resolution): warnings.warn( f'The variable "{variable}" is only available at 1 degree resolution, ' f'annual time period, and "{pref}".', + stacklevel=2, ) return f"{base}/" f"{pref}/" f"{variable}_annual_1deg.nc" else: diff --git a/oceans/filters.py b/oceans/filters.py index 691d961..e053b3c 100644 --- a/oceans/filters.py +++ b/oceans/filters.py @@ -415,7 +415,10 @@ def medfilt1(x, L=3): >>> L = 103 >>> xout = medfilt1(x=x, L=L) >>> ax = plt.subplot(212) - >>> (l1, l2,) = ax.plot( + >>> ( + ... l1, + ... l2, + ... ) = ax.plot( ... x ... ), ax.plot(xout) >>> ax.grid(True) @@ -461,7 +464,7 @@ def medfilt1(x, L=3): Lwing = (L - 1) // 2 # NOTE: Use np.ndenumerate in case I expand to +1D case - for i, xi in enumerate(xin): + for i, _xi in enumerate(xin): if i < Lwing: # Left boundary. xout[i] = np.median(xin[0 : i + Lwing + 1]) # (0 to i + Lwing) elif i >= N - Lwing: # Right boundary. diff --git a/oceans/ocfis.py b/oceans/ocfis.py index 138c6c5..43e2173 100644 --- a/oceans/ocfis.py +++ b/oceans/ocfis.py @@ -768,7 +768,7 @@ def get_profile(x, y, f, xi, yi, mode="nearest", order=3): ) if conditions.any(): - warnings.warn("Warning! Extrapolation!!") + warnings.warn("Warning! Extrapolation!!", stacklevel=2) dx = x[0, 1] - x[0, 0] dy = y[1, 0] - y[0, 0] diff --git a/oceans/plotting.py b/oceans/plotting.py index 82b52ee..0dc5519 100644 --- a/oceans/plotting.py +++ b/oceans/plotting.py @@ -366,7 +366,7 @@ def key_press_callback(self, event): print("Insert point") # noqa xs = self.points.get_xdata() ex, ey = event.xdata, event.ydata - for i in range(len(xs) - 1): + for _i in range(len(xs) - 1): self.points.set_xdata(np.r_[self.points.get_xdata(), ex]) self.points.set_ydata(np.r_[self.points.get_ydata(), ey]) self.line.set_data(self.points.get_data()) diff --git a/pyproject.toml b/pyproject.toml index 3b93b06..b26ae6d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,10 +11,19 @@ name = "oceans" description = "Misc functions for oceanographic data analysis" readme = "README.md" license = {file = "LICENSE.txt"} -authors = [ - {name = "André Palóczy, Arnaldo Russo, Filipe Fernandes"}, +maintainers = [ + {name = "André Palóczy"}, + {name = "Arnaldo Russo"}, + {name = "Filipe Fernandes"}, ] requires-python = ">=3.8" +classifiers = [ + "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", +] dynamic = [ "version", ] @@ -58,15 +67,23 @@ markers = [ [tool.ruff] select = [ + "A", # flake8-builtins + "B", # flake8-bugbear + "C4", # flake8-comprehensions "F", # flakes "I", # import sorting - "U", # upgrade + "T20", # flake8-print + "UP", # upgrade ] target-version = "py311" line-length = 79 +ignore = [ + "B905", # zip ztrict arg, enable only for py310 +] [tool.ruff.per-file-ignores] -"docs/conf.py" = ["E402"] +"docs/source/conf.py" = ["E402", "A001"] +"oceans/plotting.py" = ["T201"] # `print` found [tool.interrogate] ignore-init-method = true @@ -76,7 +93,7 @@ ignore-semiprivate = false ignore-private = false ignore-module = false fail-under = 95 -exclude = ["setup.py", "docs", "tests"] +exclude = ["docs", "tests"] verbose = 1 quiet = false color = true