Skip to content

Commit

Permalink
Linters refresh (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky authored Dec 25, 2024
1 parent df56dd1 commit 9d7eaed
Show file tree
Hide file tree
Showing 25 changed files with 216 additions and 149 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
pull_request:
branches: ['*']
branches: ["*"]

defaults:
run:
Expand All @@ -20,7 +20,6 @@ jobs:
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
environment-file: ci/requirements-docs.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
pull_request:
branches: ['*']
branches: ["*"]

jobs:
checks:
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
pull_request:
branches: ['*']
branches: ["*"]
workflow_dispatch: # allows you to trigger manually

# When this workflow is queued, automatically cancel any previous running
Expand All @@ -19,61 +19,62 @@ defaults:

jobs:
build:
name: ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.requirements }}
name:
${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.requirements }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
requirements: [latest]
include:
# Test on macos and windows (first and last version of python only)
- os: macos
python-version: '3.8'
python-version: "3.8"
requirements: latest
- os: macos
python-version: '3.12'
python-version: "3.13"
requirements: latest
- os: windows
python-version: '3.8'
python-version: "3.8"
requirements: latest
- os: windows
python-version: '3.12'
python-version: "3.13"
requirements: latest
# Test on minimal requirements
- os: ubuntu
python-version: '3.8'
python-version: "3.8"
requirements: minimal
# Old builds are not available on osx-arm64
# - os: macos
# python-version: '3.8'
# requirements: minimal
- os: windows
python-version: '3.8'
python-version: "3.8"
requirements: minimal
# Test without any optional dependencies
- os: ubuntu
python-version: '3.8'
python-version: "3.8"
requirements: no_optionals
- os: ubuntu
python-version: '3.12'
python-version: "3.13"
requirements: no_optionals
- os: macos
python-version: '3.8'
python-version: "3.8"
requirements: no_optionals
- os: macos
python-version: '3.12'
python-version: "3.13"
requirements: no_optionals
- os: windows
python-version: '3.8'
python-version: "3.8"
requirements: no_optionals
- os: windows
python-version: '3.12'
python-version: "3.13"
requirements: no_optionals
# Test on nightly builds of requirements
- os: ubuntu
python-version: '3.12'
python-version: "3.13"
requirements: upstream

steps:
Expand All @@ -85,7 +86,6 @@ jobs:
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
python-version: ${{ matrix.python-version }}
Expand All @@ -95,9 +95,6 @@ jobs:
- name: Install nightly builds
if: ${{ matrix.requirements == 'upstream' }}
run: |
# Pick up https://github.com/mamba-org/mamba/pull/2903
mamba install -n base 'mamba>=1.5.2'
mamba uninstall --force numpy pandas scipy pyarrow
python -m pip install --no-deps --pre --prefer-binary \
--extra-index-url https://pypi.fury.io/arrow-nightlies/ \
Expand Down
61 changes: 52 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
name: absolufy-imports
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
language_version: python3
args:
- --target-version=py38

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
hooks:
- id: shellcheck

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.30.0"
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.14.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ conda:
environment: ci/requirements-docs.yml

python:
install:
- method: pip
path: .
install:
- method: pip
path: .

sphinx:
builder: html
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
recursive_diff
=============
# recursive_diff

[![doc-badge](https://github.com/crusaderky/recursive_diff/actions/workflows/docs.yml/badge.svg)](https://github.com/crusaderky/recursive_diff/actions)
[![pre-commit-badge](https://github.com/crusaderky/recursive_diff/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/crusaderky/recursive_diff/actions)
[![pytest-badge](https://github.com/crusaderky/recursive_diff/actions/workflows/pytest.yml/badge.svg)](https://github.com/crusaderky/recursive_diff/actions)
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: recursive_diff-docs
channels:
- conda-forge
dependencies:
- python=3.12
- python=3.13
- sphinx
- sphinx_rtd_theme

Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ dependencies:

- xarray
- dask
- h5netcdf # NetCDF engine
- scipy # NetCDF engine
- h5netcdf # NetCDF engine
- scipy # NetCDF engine
2 changes: 1 addition & 1 deletion ci/requirements-no_optionals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ dependencies:
- packaging

- xarray
- pyarrow # Only needed to suppress warnings; remove when pandas 3.0 is released
- pyarrow # Only needed to suppress warnings; remove when pandas 3.0 is released
4 changes: 2 additions & 2 deletions ci/requirements-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ dependencies:

- xarray
- dask
- h5netcdf # NetCDF engine
- scipy # NetCDF engine
- h5netcdf # NetCDF engine
- scipy # NetCDF engine

- pip
- pip:
Expand Down
8 changes: 4 additions & 4 deletions doc/_static/style.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@import url("theme.css");

.wy-side-nav-search>a img.logo,
.wy-side-nav-search .wy-dropdown>a img.logo {
width: 12rem
.wy-side-nav-search > a img.logo,
.wy-side-nav-search .wy-dropdown > a img.logo {
width: 12rem;
}

.wy-side-nav-search {
background-color: #eee;
}

.wy-side-nav-search>div.version {
.wy-side-nav-search > div.version {
display: none;
}

Expand Down
4 changes: 2 additions & 2 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{% extends "!layout.html" %}
{% set css_files = css_files + ["_static/style.css"] %}
{% extends "!layout.html" %} {% set css_files = css_files +
["_static/style.css"] %}
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

# General information about the project.
project = "recursive_diff"
copyright = "2018-%s, recursive_diff Developers" % datetime.datetime.now().year
copyright = f"2018-{datetime.datetime.now().year}, recursive_diff Developers"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
2 changes: 1 addition & 1 deletion doc/extend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ collections, will be recursively descended into::

>>> list(recursive_diff(
... Rectangle(1, 2), Rectangle(1.1, 2.7), abs_tol=.5))
['[h]: 2.0 != 2.7 (abs: 7.0e-01, rel: 3.5e-01)']
['[h]: 2.0 != 2.7 (abs: 7.0e-01, rel: 3.5e-01)']
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ problem arises when you want to compare two large JSON data structures, because
operator will tell you if the two structures differ *somewhere*, but won't tell you
where*. Additionally, if the structures contain floating-point numbers, == won't allow
to set a tolerance: 1.00000000000001 is different from 1.0, which is majorly problematic
as floating point arithmetics are naturally characterised by noise around the 15th
as floating point arithmetic is naturally characterised by noise around the 15th
decimal position (the size of the double-precision mantissa). Tests on floating point
numbers are typically performed with :func:`math.isclose` or :func:`numpy.isclose`,
which however are not usable if the numbers to be tested lie deep inside a nested
Expand Down
Loading

0 comments on commit 9d7eaed

Please sign in to comment.