-
Notifications
You must be signed in to change notification settings - Fork 117
/
.pre-commit-config.yaml
101 lines (101 loc) · 3.13 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.8.1'
hooks:
# Run the formatter.
- id: ruff-format
# Run the linter.
- id: ruff
args: [--fix]
- id: ruff
alias: check-docstrings
entry: python utils/check_docstrings.py
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0'
hooks:
- id: mypy
additional_dependencies: ['polars==1.4.1', 'pytest==8.3.2']
files: ^(narwhals|tests)/
- repo: https://github.com/codespell-project/codespell
rev: 'v2.3.0'
hooks:
- id: codespell
files: \.(py|rst|md)$
args: [--ignore-words-list=ser]
exclude: ^docs/api-completeness.md$
- repo: https://github.com/pycqa/flake8
rev: '7.1.1' # todo: remove once https://github.com/astral-sh/ruff/issues/458 is addressed
hooks:
- id: flake8
additional_dependencies: [darglint==1.8.1, Flake8-pyproject]
entry: flake8 --select DAR --ignore DAR101,DAR402,DAR401
exclude: |
(?x)^(
tests/.*|
# TODO: gradually enable
narwhals/series\.py|
# TODO: gradually enable
narwhals/dataframe\.py|
# TODO: gradually enable
narwhals/dependencies\.py|
# private, so less urgent to document too well
narwhals/_.*|
^utils/.*
)$
- repo: local
hooks:
- id: check-api-reference
name: check-api-reference
pass_filenames: false
entry: python -m utils.check_api_reference
language: python
additional_dependencies: [polars]
- id: imports-are-banned
name: import are banned (use `get_pandas` instead of `import pandas`)
entry: python utils/import_check.py
language: python
files: ^narwhals/
exclude: ^narwhals/dependencies\.py
- id: dtypes-import
name: don't import from narwhals.dtypes (use `import_dtypes_module` instead)
entry: |
(?x)
import\ narwhals.dtypes|
from\ narwhals\ import\ dtypes|
from\ narwhals.dtypes\ import\ [^D_]+|
import\ narwhals.stable.v1.dtypes|
from\ narwhals.stable.v1\ import\ dtypes|
from\ narwhals.stable.v1.dtypes\ import
language: pygrep
files: ^narwhals/
exclude: |
(?x)
^(
narwhals/utils\.py|
narwhals/stable/v1/_dtypes.py|
narwhals/.*__init__.py|
narwhals/.*typing\.py
)
- id: pull-request-target
name: don't use `pull_request_target`
entry: pull_request_target
language: pygrep
files: ^\.github/workflows/
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.19.1" # replace with latest tag on GitHub
hooks:
- id: blacken-docs
args: [--skip-errors]
additional_dependencies:
- black==22.12.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: name-tests-test
exclude: ^tests/utils\.py
- id: no-commit-to-branch
- id: end-of-file-fixer
exclude: .svg$