This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new dfac0ccdba GH-46546: [CI][Dev][Python] Use pre-commit for numpydoc
(#46595)
dfac0ccdba is described below
commit dfac0ccdba379692b29a74f09c62827df3ba2f3c
Author: Sutou Kouhei <[email protected]>
AuthorDate: Mon Jun 2 16:29:46 2025 +0900
GH-46546: [CI][Dev][Python] Use pre-commit for numpydoc (#46595)
### Rationale for this change
We want to migrate to pre-commit from `archery lint`.
### What changes are included in this PR?
Use pre-commit for numpydoc but this doesn't support Cython files.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* GitHub Issue: #46546
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
.pre-commit-config.yaml | 19 +++++++++++++++++++
python/pyproject.toml | 15 +++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c650bf1719..a907ecd611 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -168,6 +168,25 @@ repos:
?.pb\.(cc|h)$|
?^cpp/src/generated/|
)
+ - repo: https://github.com/numpy/numpydoc
+ rev: v1.8.0
+ hooks:
+ - id: numpydoc-validation
+ name: Python (NumPy doc) Lint
+ alias: python-doc-lint
+ args:
+ - "--config=python"
+ files: >-
+ ^python/pyarrow/
+ exclude: >-
+ (
+ ?^python/pyarrow/interchange/from_dataframe\.py$|
+ ?^python/pyarrow/jvm\.py$|
+ ?^python/pyarrow/pandas_compat\.py$|
+ ?^python/pyarrow/tests/|
+ ?^python/pyarrow/util\.py$|
+ ?^python/pyarrow/vendored/|
+ )
- repo: local
hooks:
- id: lintr
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 778e3508be..b573b8843e 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -65,6 +65,21 @@ test = [
'pandas'
]
+[tool.numpydoc_validation]
+checks = [
+ "GL10",
+ "PR01",
+ "PR03",
+ "PR04",
+ "PR05",
+ "PR10",
+ "RT03",
+ "YD01",
+]
+exclude = [
+ '\._.*$',
+]
+
[tool.setuptools]
zip-safe=false
include-package-data=true