From d3aef79a6c6b3052eb7a396dd1e004ee37b71fc9 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Wed, 9 Sep 2026 10:07:48 +0200 Subject: [PATCH 1/3] Enable PR02 check --- python/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/python/pyproject.toml b/python/pyproject.toml index 68c1a807dd51..1007295d2ff0 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -69,6 +69,7 @@ test = [ checks = [ "GL10", "PR01", + "PR02", "PR03", "PR04", "PR05", From e8a24531c3d04ee75091221e27d7bbfadfa2f8b6 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Wed, 9 Sep 2026 10:58:52 +0200 Subject: [PATCH 2/3] Enable PR02 check 2/2 --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index 5cf62a13aa20..0f30dcef93c0 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1556,7 +1556,7 @@ services: ["/arrow/ci/scripts/cpp_build.sh /arrow /build && /arrow/ci/scripts/python_build.sh /arrow /build && pip install -e /arrow/dev/archery[numpydoc] && - archery numpydoc --allow-rule GL10,PR01,PR03,PR04,PR05,PR10,RT03,YD01 && + archery numpydoc --allow-rule GL10,PR01,PR02,PR03,PR04,PR05,PR10,RT03,YD01 && /arrow/ci/scripts/python_test.sh /arrow && /arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"] From d17342fa66b7db730688d4ba6c0843d0b0e056c5 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Wed, 9 Sep 2026 14:33:40 +0200 Subject: [PATCH 3/3] Skip PR01,PR02,PR03 when no signature --- dev/archery/archery/lang/python.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dev/archery/archery/lang/python.py b/dev/archery/archery/lang/python.py index f73a2ce44b46..723c9f07d027 100644 --- a/dev/archery/archery/lang/python.py +++ b/dev/archery/archery/lang/python.py @@ -93,6 +93,10 @@ class NumpyDoc: EnumMeta: ["PR01"] } + # When there's no signature (like for Cython classes where it can't parse + # __init__), numpydoc sees zero parameters and reports "Unknown parameters" + PARAMETER_CHECKS = ("PR01", "PR02", "PR03") + def __init__(self, symbols=None): if not have_numpydoc: raise RuntimeError( @@ -203,6 +207,13 @@ def callback(obj): logger.warning(f"Unable to validate `{symbol}` due to `{e}`") return + try: + inspect.signature(obj) + except (TypeError, ValueError): + has_signature = False + else: + has_signature = True + errors = [] for errcode, errmsg in result.get('errors', []): if allow_rules and errcode not in allow_rules: @@ -213,6 +224,9 @@ def callback(obj): for obj_type, errcode_list in NumpyDoc.IGNORE_VALIDATION_ERRORS_FOR_TYPE.items()): continue + if (not has_signature and + errcode in NumpyDoc.PARAMETER_CHECKS): + continue errors.append((errcode, errmsg)) if len(errors):