Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 86 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,107 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# See https://pre-commit.ci/#configuration
# See https://github.com/scientific-python/cookie#sp-repo-review

ci:
autofix_prs: false
autoupdate_commit_msg: "chore: update pre-commit hooks"


# Alphabetised, for lack of a better order.
files: |
(?x)(
docs\/.+\.py|
pyproject\.toml|
setup\.py|
src\/.+\.py
)
minimum_pre_commit_version: 1.21.0

repos:

# Hook for pre-commit's built-in checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: v5.0.0
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
# Check whether files parse as valid Python.
- id: check-ast
# Check for file name conflicts on case-insensitive filesystems.
- id: check-case-conflict
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ `breakpoint()` calls in python source.
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
- id: debug-statements
# Don't commit to master branch.
# Check TOML file syntax.
- id: check-toml
# Check YAML file syntax.
- id: check-yaml
# Makes sure files end in a newline and only a newline.
# Duplicates Ruff W292 but also works on non-Python files.
- id: end-of-file-fixer
# Replaces or checks mixed line ending.
- id: mixed-line-ending
# Don't commit to main branch.
- id: no-commit-to-branch
# Trims trailing whitespace.
# Duplicates Ruff W291 but also works on non-Python files.
- id: trailing-whitespace

# Hooks from all other repos
# NOTE : keep these in hook-name (aka 'id') order

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
types: [file, rst]

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
hooks:
- id: codespell
types_or: [asciidoc, python, markdown, rst]
additional_dependencies: [tomli]

- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0'
hooks:
- id: black
- id: mypy
exclude: 'noxfile\.py|docs/conf\.py'

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0
hooks:
- id: numpydoc-validation
types: [file, python]
args: [--config=./pyproject.toml]

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.4"
hooks:
- id: flake8
- id: ruff
types: [file, python]
args: [--fix, --show-fixes]
- id: ruff-format
types: [file, python]

- repo: https://github.com/aio-libs/sort-all
rev: v1.3.0
hooks:
- id: sort-all
types: [file, python]
args: [--config=./.flake8]

- repo: https://github.com/scientific-python/cookie
rev: 2024.08.19
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
args: ["--show=errskip"]
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
args: ["--show=errskip"]

- repo: https://github.com/abravalheri/validate-pyproject
# More exhaustive than Ruff RUF200.
rev: "v0.23"
hooks:
- id: validate-pyproject

26 changes: 13 additions & 13 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
#
# tephi documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 26 15:24:09 2014.
#
"""Tephi documentation build configuration file."""

# created by sphinx-quickstart on Thu Jun 26 15:24:09 2014
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
Expand All @@ -11,7 +9,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from datetime import datetime
from __future__ import annotations

from datetime import datetime, timedelta, timezone
import os
import pathlib
import sys
Expand All @@ -21,7 +21,7 @@
os.environ["PYTHONPATH"] = str(root)
sys.path.insert(0, str(root))

import tephi
import tephi # noqa: E402

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -62,8 +62,8 @@

# General information about the project.
project = "tephi"
copyright = f"2014-{datetime.now().year}, British Crown Copyright, Met Office"

tzone = timezone(timedelta())
copyright_info = f"2014-{datetime.now(tzone).year}, British Crown Copyright, Met Office"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
Expand Down Expand Up @@ -190,7 +190,7 @@

# -- Options for LaTeX output --------------------------------------------------

latex_elements = {}
latex_elements: dict[str, str] = {}
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

Expand All @@ -203,7 +203,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
("index", "tephi.tex", "tephi Documentation", copyright, "manual"),
("index", "tephi.tex", "tephi Documentation", copyright_info, "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -231,7 +231,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "tephi", "tephi Documentation", [copyright], 1)]
man_pages = [("index", "tephi", "tephi Documentation", [copyright_info], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -247,7 +247,7 @@
"index",
"tephi",
"tephi Documentation",
copyright,
copyright_info,
"tephi",
"One line description of project.",
"Miscellaneous",
Expand Down
12 changes: 5 additions & 7 deletions docs/source/plot/barbs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""An example to show barbs being plotted."""

import matplotlib.pyplot as plt
import numpy as np

Expand Down Expand Up @@ -27,7 +29,7 @@
}

color = "blue"
kwargs = dict(length=8, color=color)
kwargs = {"length": 8, "color": color}
lsx = 1
rsx = 3
ly = 23
Expand All @@ -42,16 +44,12 @@
for i, u in enumerate(range(5, 50, 5)):
y = ly - (i + 2) * 2
plt.barbs(lsx, y, u, 0, **kwargs)
plt.text(
lsx + delta, y, knots[np.searchsorted(_BARB_BINS, u, side="right")]
)
plt.text(lsx + delta, y, knots[np.searchsorted(_BARB_BINS, u, side="right")])

for i, u in enumerate(range(50, 105, 5)):
y = ly - i * 2
plt.barbs(rsx, y, u, 0, **kwargs)
plt.text(
rsx + delta, y, knots[np.searchsorted(_BARB_BINS, u, side="right")]
)
plt.text(rsx + delta, y, knots[np.searchsorted(_BARB_BINS, u, side="right")])

ax = plt.gca()
ax.set_xlim(0, 5)
Expand Down
Loading
Loading