Skip to content

Commit

Permalink
ci(ruff): replace black/isort/flake8 by ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
probberechts committed Jun 22, 2024
1 parent e19f847 commit b4d8cf6
Show file tree
Hide file tree
Showing 81 changed files with 2,262 additions and 2,375 deletions.
3 changes: 3 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[darglint]
docstring_style = numpy
strictness = long
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{py,toml}]
indent_style = space
indent_size = 4

[*.yml,yaml,json]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto eol=lf
public-notebooks/*.ipynb linguist-documentation
26 changes: 10 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: local
hooks:
- id: black
name: black
entry: black
- id: ruff-format
name: ruff-format
entry: ruff format --force-exclude
language: system
types: [python]
types_or: [python, pyi]
require_serial: true
- id: check-added-large-files
name: Check for added large files
Expand Down Expand Up @@ -33,33 +33,27 @@ repos:
language: system
types: [text]
stages: [commit, push, manual]
- id: flake8
name: flake8
entry: flake8
- id: ruff
name: ruff
entry: ruff check --force-exclude
language: system
types: [python]
types_or: [python, pyi]
require_serial: true
args: [--darglint-ignore-regex, .*]
args: ["--fix"]
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
entry: pyupgrade
language: system
types: [python]
args: [--py39-plus]
- id: isort
name: Reorder python imports
entry: isort
require_serial: true
language: system
types: [python]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v4.0.0-alpha.8
hooks:
- id: prettier
1 change: 0 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ pre-commit hooks.
Docstrings are to follow the `numpydoc guidelines`_.

.. _PEP 8: https://pep8.org/
.. _black: https://black.readthedocs.io/en/stable/
.. _numpydoc guidelines: https://numpydoc.readthedocs.io/en/latest/format.html

Submitting changes
Expand Down
54 changes: 27 additions & 27 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))


# -- Project information -----------------------------------------------------

project = 'socceraction'
copyright = '2020, DTAI KU Leuven'
author = 'Tom Decroos'
project = "socceraction"
copyright = "2020, DTAI KU Leuven"
author = "Tom Decroos"

# The full version, including alpha/beta/rc tags
release = '1.5.1'
release = "1.5.1"


# -- General configuration ---------------------------------------------------
Expand All @@ -28,50 +28,50 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.napoleon',
'sphinx.ext.autodoc',
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
]
autodoc_member_order = 'bysource'
autodoc_member_order = "bysource"
autosummary_generate = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'
pygments_style = 'friendly'
html_theme = "furo"
pygments_style = "friendly"

html_logo = '_static/logo_white.png'
html_favicon = '_static/favicon.png'
html_logo = "_static/logo_white.png"
html_favicon = "_static/favicon.png"
html_theme_options = {
'sidebar_hide_name': True,
'light_css_variables': {
'color-brand-primary': '#26b079',
'color-brand-content': '#26b079',
'color-api-highlight-on-target': '#e5fff5',
"sidebar_hide_name": True,
"light_css_variables": {
"color-brand-primary": "#26b079",
"color-brand-content": "#26b079",
"color-api-highlight-on-target": "#e5fff5",
},
'dark_css_variables': {
'color-brand-primary': '#26b079',
'color-brand-content': '#26b079',
'color-api-highlight-on-target': '#e5fff5',
"dark_css_variables": {
"color-brand-primary": "#26b079",
"color-brand-content": "#26b079",
"color-api-highlight-on-target": "#e5fff5",
},
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = ['custom.css']
html_static_path = ["_static"]
html_css_files = ["custom.css"]
17 changes: 10 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Nox sessions."""

import shutil
import sys
from pathlib import Path
Expand Down Expand Up @@ -90,17 +91,12 @@ def precommit(session: Session) -> None:
"--show-diff-on-failure",
]
session.install(
"black",
"darglint",
"flake8",
"flake8-bugbear",
"flake8-docstrings",
"flake8-rst-docstrings",
"ruff",
"pep8-naming",
"pre-commit",
"pre-commit-hooks",
"pyupgrade",
"isort",
)
session.run("pre-commit", *args)
if args and args[0] == "install":
Expand All @@ -125,7 +121,14 @@ def tests(session: Session) -> None:
session.install("coverage[toml]", "pytest", "pygments", "pytest-mock")
try:
session.run(
"coverage", "run", "--parallel", "-m", "pytest", "-m", "not e2e", *session.posargs
"coverage",
"run",
"--parallel",
"-m",
"pytest",
"-m",
"not e2e",
*session.posargs,
)
finally:
if session.interactive:
Expand Down
Loading

0 comments on commit b4d8cf6

Please sign in to comment.