Skip to content

Commit

Permalink
Merge branch 'main' into cla_v5
Browse files Browse the repository at this point in the history
  • Loading branch information
trexfeathers authored Feb 22, 2024
2 parents 9cac3c9 + 9397c1d commit b7e73ab
Show file tree
Hide file tree
Showing 330 changed files with 10,050 additions and 7,719 deletions.
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Make sure any dependency changes are benchmarked (only changes to the locks
# make a material difference - changes to the Conda YAML files are not
# benchmarked).
benchmark_this:
- changed-files:
- any-glob-to-any-file: 'requirements/locks/*.lock'
6 changes: 3 additions & 3 deletions .github/workflows/benchmarks_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:

- name: Install ASV & Nox
run: |
pip install asv nox
pip install "asv!=0.6.2" nox
- name: Cache environment directories
id: cache-env-dir
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
.nox
Expand All @@ -56,7 +56,7 @@ jobs:

- name: Cache test data directory
id: cache-test-data
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ env.IRIS_TEST_DATA_PATH }}
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/ci-citation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ci-citation

on:
pull_request:
paths:
- "CITATION.cff"

push:
paths:
- "CITATION.cff"

workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
name: "validate"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "check CITATION.cff"
uses: citation-file-format/cffconvert-github-action@4cf11baa70a673bfdf9dad0acc7ee33b3f4b6084
with:
args: "--validate"
2 changes: 1 addition & 1 deletion .github/workflows/ci-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ concurrency:
jobs:
manifest:
name: "check-manifest"
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2023.12.1
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2024.02.0
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,5 @@ jobs:
nox --session ${{ matrix.session }} -- --verbose ${{ matrix.coverage }}
- name: Upload coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ matrix.coverage }}
15 changes: 15 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Reference
# - https://github.com/actions/labeler

name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
2 changes: 1 addition & 1 deletion .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ on:

jobs:
refresh_lockfiles:
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2023.12.1
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2024.02.0
secrets: inherit
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
- id: no-commit-to-branch

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.8"
rev: "v0.2.1"
hooks:
- id: ruff
types: [file, python]
Expand All @@ -45,7 +45,7 @@ repos:
additional_dependencies: [tomli]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
types: [file, python]
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2

build:
os: ubuntu-20.04
os: "ubuntu-22.04"
tools:
python: mambaforge-4.10
python: "mambaforge-22.9"
jobs:
post_checkout:
# The SciTools/iris repository is shallow i.e., has a .git/shallow,
Expand Down
27 changes: 1 addition & 26 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ lint.ignore = [
# pycodestyle (E, W)
# https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"E",
"W",

# mccabe (C90)
# https://docs.astral.sh/ruff/rules/#mccabe-c90
Expand All @@ -26,22 +25,10 @@ lint.ignore = [
# (D-1) Permanent
"D105", # Missing docstring in magic method
# (D-2) Temporary, to be removed when we are more compliant. Rare cases mmove to (1).
"D417", # Missing argument descriptions in the docstring
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D104", # Missing docstring in public package
"D106", # Missing docstring in public nested class
# (D-3) Temporary, before an initial review, either fix ocurrenvces or move to (2).
"D100", # Missing docstring in public module
# (D-3) Temporary, before an initial review, either fix ocurrences or move to (2).
"D103", # Missing docstring in public function
"D200", # One-line docstring should fit on one line
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary line and description
"D401", # First line of docstring should be in imperative mood: ...
"D404", # First word of the docstring should not be "This"
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
"D407", # Missing dashed underline after section

# pyupgrade (UP)
# https://docs.astral.sh/ruff/rules/#pyupgrade-up
Expand Down Expand Up @@ -71,10 +58,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"A",

# flake8-copyright (CPY)
# https://docs.astral.sh/ruff/rules/#flake8-copyright-cpy
"CPY",

# flake8-comprehensions (C4)
# https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"C4",
Expand All @@ -91,10 +74,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
"FA",

# flake8-implicit-str-concat (ISC)
# https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
"ISC",

# flake8-logging-format (G)
# https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"G",
Expand Down Expand Up @@ -187,10 +166,6 @@ lint.ignore = [
# https://docs.astral.sh/ruff/rules/#flynt-fly
"FLY",

# Airflow (AIR)
# https://docs.astral.sh/ruff/rules/#airflow-air
"AIR",

# Perflint (PERF)
# https://docs.astral.sh/ruff/rules/#perflint-perf
"PERF",
Expand Down
23 changes: 23 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cff-version: 1.2.0
message: "If Iris played an important part in your research then please add us to your reference list by using the references below."
title: "Iris"
keywords:
- "cf-metadata"
- "data-analysis"
- "earth-science"
- "grib"
- "netcdf"
- "meteorology"
- "oceanography"
- "space-weather"
- "ugrid"
- "visualisation"
authors:
- name: "Iris contributors"
abstract: "A powerful, format-agnostic, and community-driven Python package for analysing and visualising Earth science data"
license: "BSD-3-Clause"
license-url: "https://spdx.org/licenses/BSD-3-Clause.html"
doi: "10.5281/zenodo.595182"
url: "http://scitools.org.uk/"
repository-code: "https://github.com/SciTools/iris"
type: "software"
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ exclude .ruff.toml
exclude CHANGES
exclude CODE_OF_CONDUCT.md
exclude codecov.yml
include COPYING
include COPYING.LESSER
include CITATION.cff
include LICENSE
exclude Makefile
exclude noxfile.py
Expand Down
9 changes: 6 additions & 3 deletions benchmarks/asv_delegated_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""ASV plug-in providing an alternative :class:`asv.plugins.conda.Conda`
subclass that manages the Conda environment via custom user scripts.
"""ASV plug-in providing an alternative :class:`asv.plugins.conda.Conda` subclass.
Manages the Conda environment via custom user scripts.
"""

Expand Down Expand Up @@ -42,7 +43,9 @@ def __init__(
requirements: dict,
tagged_env_vars: dict,
) -> None:
"""Parameters
"""__init__.
Parameters
----------
conf : Config instance
Expand Down
12 changes: 8 additions & 4 deletions benchmarks/benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def disable_repeat_between_setup(benchmark_object):
"""Decorator for benchmarks where object persistence would be inappropriate.
"""Benchmarks where object persistence would be inappropriate (decorator).
E.g:
* Benchmarking data realisation
Expand All @@ -36,7 +36,9 @@ def disable_repeat_between_setup(benchmark_object):


class TrackAddedMemoryAllocation:
"""Context manager which measures by how much process resident memory grew,
"""Measures by how much process resident memory grew, during execution.
Context manager which measures by how much process resident memory grew,
during execution of its enclosed code block.
Obviously limited as to what it actually measures : Relies on the current
Expand Down Expand Up @@ -84,7 +86,7 @@ def addedmem_mb(self):

@staticmethod
def decorator(decorated_func):
"""Decorates this benchmark to track growth in resident memory during execution.
"""Benchmark to track growth in resident memory during execution.
Intended for use on ASV ``track_`` benchmarks. Applies the
:class:`TrackAddedMemoryAllocation` context manager to the benchmark
Expand All @@ -105,7 +107,9 @@ def _wrapper(*args, **kwargs):


def on_demand_benchmark(benchmark_object):
"""Decorator. Disables these benchmark(s) unless ON_DEMAND_BENCHARKS env var is set.
"""Disables these benchmark(s) unless ON_DEMAND_BENCHARKS env var is set.
This is a decorator.
For benchmarks that, for whatever reason, should not be run by default.
E.g:
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/benchmarks/aux_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""AuxFactory benchmark tests.
"""
"""AuxFactory benchmark tests."""

import numpy as np

Expand All @@ -18,7 +16,9 @@ class FactoryCommon:
# * make class an ABC
# * remove NotImplementedError
# * combine setup_common into setup
"""A base class running a generalised suite of benchmarks for any factory.
"""Run a generalised suite of benchmarks for any factory.
A base class running a generalised suite of benchmarks for any factory.
Factory to be specified in a subclass.
ASV will run the benchmarks within this class for any subclasses.
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/benchmarks/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Coord benchmark tests.
"""
"""Coord benchmark tests."""

import numpy as np

Expand All @@ -25,7 +23,9 @@ class CoordCommon:
# * make class an ABC
# * remove NotImplementedError
# * combine setup_common into setup
"""A base class running a generalised suite of benchmarks for any coord.
"""Run a generalised suite of benchmarks for any coord.
A base class running a generalised suite of benchmarks for any coord.
Coord to be specified in a subclass.
ASV will run the benchmarks within this class for any subclasses.
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/benchmarks/cperf/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
#
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Equality benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project.
"""
"""Equality benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project."""
from .. import on_demand_benchmark
from . import SingleDiagnosticMixin


class EqualityMixin(SingleDiagnosticMixin):
r"""Uses :class:`SingleDiagnosticMixin` as the realistic case will be comparing
r"""Use :class:`SingleDiagnosticMixin` as the realistic case.
Uses :class:`SingleDiagnosticMixin` as the realistic case will be comparing
:class:`~iris.cube.Cube`\\ s that have been loaded from file.
"""

# Cut down the parent parameters.
Expand All @@ -24,9 +26,7 @@ def setup(self, file_type, three_d=False, three_times=False):

@on_demand_benchmark
class CubeEquality(EqualityMixin):
r"""Benchmark time and memory costs of comparing LFRic and UM
:class:`~iris.cube.Cube`\\ s.
"""
r"""Benchmark time & memory costs of comparing LFRic & UM :class:`~iris.cube.Cube`\\ s."""

def _comparison(self):
_ = self.cube == self.other_cube
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/benchmarks/cperf/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
#
# This file is part of Iris and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""File loading benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project.
"""
"""File loading benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project."""
from .. import on_demand_benchmark
from . import SingleDiagnosticMixin


@on_demand_benchmark
class SingleDiagnosticLoad(SingleDiagnosticMixin):
def time_load(self, _, __, ___):
"""The 'real world comparison'
"""Perform a 'real world comparison'.
* UM coords are always realised (DimCoords).
* LFRic coords are not realised by default (MeshCoords).
Expand All @@ -26,7 +26,7 @@ def time_load(self, _, __, ___):
assert coord.has_lazy_bounds() == expecting_lazy_coords

def time_load_w_realised_coords(self, _, __, ___):
"""A valuable extra comparison where both UM and LFRic coords are realised."""
"""Valuable extra comparison where both UM and LFRic coords are realised."""
cube = self.load()
for coord_name in "longitude", "latitude":
coord = cube.coord(coord_name)
Expand Down
Loading

0 comments on commit b7e73ab

Please sign in to comment.