Skip to content

Commit

Permalink
ci: add canceling old CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-eschle committed Oct 8, 2024
1 parent 6a2b20d commit 2237e3e
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 72 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
name: Tests for Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
Expand Down
147 changes: 76 additions & 71 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,91 @@
ci:
autoupdate_schedule: quarterly
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
args: [ '--maxkb=1000' ]
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: detect-private-key
- id: fix-byte-order-marker
- id: check-ast
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
args: [ '--maxkb=1000' ]
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: detect-private-key
- id: fix-byte-order-marker
- id: check-ast

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
args: [ -r, --in-place, --wrap-descriptions, '120', --wrap-summaries, '120', -- ]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
args: [ -r, --in-place, --wrap-descriptions, '120', --wrap-summaries, '120', -- ]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- id: python-check-mock-methods
- id: python-no-eval
# - id: rst-backticks # TODO: false positives with coding blocks?
- id: rst-directive-colons
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- id: python-check-mock-methods
- id: python-no-eval
# - id: rst-backticks # TODO: false positives with coding blocks?
- id: rst-directive-colons

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [ --py38-plus ]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [ --py38-plus ]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt

# Notebook formatting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-isort
additional_dependencies: [ isort ]
# Notebook formatting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-isort
additional_dependencies: [ isort ]

- id: nbqa-pyupgrade
additional_dependencies: [ pyupgrade]
args: [ --py38-plus ]
- id: nbqa-pyupgrade
additional_dependencies: [ pyupgrade ]
args: [ --py38-plus ]

- repo: https://github.com/mgedmin/check-manifest
rev: '0.49'
hooks:
- id: check-manifest
stages: [ manual ]
- repo: https://github.com/mgedmin/check-manifest
rev: '0.49'
hooks:
- id: check-manifest
stages: [ manual ]


- repo: https://github.com/roy-ht/pre-commit-jupyter
rev: v1.2.1
hooks:
- id: jupyter-notebook-cleanup
- repo: https://github.com/roy-ht/pre-commit-jupyter
rev: v1.2.1
hooks:
- id: jupyter-notebook-cleanup

- repo: https://github.com/sondrelg/pep585-upgrade
rev: 'v1.0'
hooks:
- id: upgrade-type-hints
args: [ '--futures=true' ]
- repo: https://github.com/sondrelg/pep585-upgrade
rev: 'v1.0'
hooks:
- id: upgrade-type-hints
args: [ '--futures=true' ]

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.0"
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix, --unsafe-fixes, --show-fixes , --line-length=120 ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,58 @@ requires = [
]

build-backend = "setuptools.build_meta"

[tool.ruff]
#src = ["src"]
line-length = 120
exclude = [
".tox/*",
"*/test*",
"*/__init__.py",
"*/_version.py",
]
[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
]
ignore = [
"UP007", # type annotation upgrade, breaks pydantic for Python 3.9 (remove once above)
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"ISC001", # Conflicts with formatter
"RET505", # This is sometimes wanted, protets against accidental intendation
"PD901", # "avoid using `df[...].values`" -> no, this is a very good name if there is only one df
"PD011", # "replace `df[...].values` with `df[...].to_numpy()`" -> not yet, it's not deprecated.
# Prefer to have a single way to access the data if we don't care about whether it's a numpy array or not.
"PLW0603", # updating global variables with a function is bad, but we use it for
"PLW2901", # "for loop overwritten by assignment" -> we use this to update the loop variable
"PD013", # "melt over stack": df function, but triggers on tensors
"NPY002", # "Use rnd generator in numpy" -> we use np.random for some legacy stuff but do use the new one where we can
"T201", # Removes prints, we use for output (maybe change to stdout or similar?)

]
isort.required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["T20"]
"noxfile.py" = ["T20"]

0 comments on commit 2237e3e

Please sign in to comment.