Copilot commented on code in PR #48622:
URL: https://github.com/apache/arrow/pull/48622#discussion_r3409971283
##########
python/pyarrow/fs.py:
##########
@@ -111,7 +111,7 @@ def _ensure_filesystem(filesystem, *, use_mmap=False):
else:
# handle fsspec-compatible filesystems
try:
- import fsspec
+ import fsspec # type: ignore[import-untyped]
Review Comment:
`fsspec` is an optional dependency (the code already handles `ImportError`),
but mypy will still report `import-not-found` for this import inside a `try`
block. The current ignore only suppresses `import-untyped`, so type checking
will still fail in environments without `fsspec`.
##########
python/pyarrow-stubs/pyarrow/_types.pyi:
##########
@@ -0,0 +1,768 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import datetime as dt # noqa: F401
+
+from collections.abc import Iterable, Iterator, Mapping, Sequence
+from decimal import Decimal # noqa: F401
+from typing import Any, Generic, Literal, Protocol, TypeAlias, overload
+
+import numpy as np
+import pandas as pd # type: ignore[import-not-found,import-untyped]
Review Comment:
`pandas` is not a required runtime dependency of `pyarrow`, but this stub
unconditionally imports it. The mypy-style `# type: ignore[...]` comment won’t
suppress missing-import diagnostics in pyright, so users running pyright
without pandas installed may see errors originating from pyarrow’s stubs.
##########
python/pyarrow-stubs/pyarrow/io.pyi:
##########
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Placeholder stub - complete annotations in future PR.
+# At runtime, these symbols are provided by the pyarrow.lib C extension.
+
+from typing import Any
+
+class Buffer: ...
+
+def __getattr__(name: str) -> Any: ...
Review Comment:
This stub adds a `pyarrow.io` module, but the source tree doesn’t define a
corresponding runtime module (there is no `python/pyarrow/io.py` or `io.pyx`;
`io.pxi` is included into `pyarrow.lib`). Shipping a stub for a non-importable
module can let `import pyarrow.io` type-check while failing at runtime.
##########
python/pyarrow-stubs/pyarrow/scalar.pyi:
##########
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Placeholder stub - complete annotations in future PR.
+# At runtime, these symbols are provided by the pyarrow.lib C extension.
+
+from typing import Any
+
+class ExtensionScalar: ...
+
+def __getattr__(name: str) -> Any: ...
Review Comment:
This stub adds a `pyarrow.scalar` module, but the source tree doesn’t define
a corresponding runtime module (there is no `python/pyarrow/scalar.py` or
`scalar.pyx`; `scalar.pxi` is included into `pyarrow.lib`). Shipping a stub for
a non-importable module can let `import pyarrow.scalar` type-check while
failing at runtime.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]