Skip to content

[Archery][CI][Doc] archery numpydoc fails with latest Cython 3.1.1 #46516

@raulcd

Description

@raulcd

Describe the bug, including details regarding any error messages, version, and platform.

It seems that the new version of Cython (3.1.1) released yesterday breaks our code to validate docstrings from the Cython generated code. Our code:

# Is it a Cython-generated method? If so, try to detect
# whether it only has a implicitly-generated docstring,
# and no user-defined docstring following it.
# The generated docstring would lack description of method
# parameters and therefore fail Numpydoc validation.
if hasattr(member, '__objclass__'):
doc = getattr(member, '__doc__', None)
# The Cython-generated docstring would be a one-liner,
# such as "ReadOptions.equals(self, ReadOptions other)".
if (doc and '\n' not in doc and f'.{name}(' in doc):
continue
todo.append(member)

I've been able to reproduce locally the failures on https://github.com/apache/arrow/actions/runs/15135088392/job/42544918301?pr=46511 via installing the newer Cython, building pyarrow and running:
archery numpydoc --allow-rule GL10,PR01,PR03,PR04,PR05,PR10,RT03,YD01
with the following failure:

...
pyarrow.lib.FixedSizeBufferWriter.set_memcopy_blocksize
-> pyarrow.lib.FixedSizeBufferWriter.set_memcopy_blocksize(self, int64_t blocksize)
PR01: Parameters {'blocksize'} not documented

pyarrow._json.ReadOptions.equals
-> pyarrow._json.ReadOptions.equals(self, ReadOptions other)
PR01: Parameters {'other'} not documented

pyarrow._json.ParseOptions.equals
-> pyarrow._json.ParseOptions.equals(self, ParseOptions other)
PR01: Parameters {'other'} not documented

Total number of docstring violations: 39

While debugging I can see that our check is not working anymore:

> /home/raulcd/code/arrow/dev/archery/archery/lang/python.py(172)traverse()
-> if hasattr(member, '__objclass__'):
(Pdb) hasattr(member, '__objclass__')
False
(Pdb) module
'pyarrow._csv'
(Pdb) name
'ReadOptions'
(Pdb) member
<class 'pyarrow._csv.ReadOptions'>

Component(s)

Continuous Integration, Documentation, Archery

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions