duckdb.experimental.spark fails to import without typing_extensions, which is not a runtime dependency
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Ba import lỗi nằm tại duckdb/experimental/spark/_globals.py:36, duckdb/experimental/spark/sql/types.py:14 và duckdb/experimental/spark/_typing.py:22. Trước tiên, hãy tái hiện lỗi trong một venv sạch chỉ có duckdb và numpy, sau đó import duckdb.experimental.spark.sql. So sánh với duckdb/polars_io.py để xem mẫu guard hiện có. Hoàn thành khi các module này import được chỉ với module typing của thư viện chuẩn và phần import spark thành công mà không cài đặt typing_extensions.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens?
duckdb.experimental.spark imports typing_extensions at module import time, but typing-extensions is only listed in the stubdeps and test dependency groups in pyproject.toml, not as a runtime dependency and not in the all extra. In a clean environment with just duckdb and numpy (the dependency the all extra comment names for the spark module), importing the spark API fails.
The three imports are:
duckdb/experimental/spark/_globals.py:36—from typing_extensions import Selfduckdb/experimental/spark/sql/types.py:14—from typing_extensions import Selfduckdb/experimental/spark/_typing.py:22—from typing_extensions import Protocol, Self
Since the package requires Python >= 3.11, typing.Self and typing.Protocol are available from the standard library, so these can simply be from typing import Self / from typing import Protocol, Self. duckdb/polars_io.py and duckdb/experimental/spark/sql/_typing.py already guard their typing_extensions usage. The failure is masked when duckdb[all] is installed because typing_extensions arrives transitively through pandas/pyarrow.
Happy to send a PR if the from typing import ... change is the preferred fix.
To Reproduce
python -m venv v && . v/bin/activate
pip install --pre duckdb numpy
python -c "from duckdb.experimental.spark.sql import SparkSession"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../site-packages/duckdb/experimental/spark/__init__.py", line ...
File ".../site-packages/duckdb/experimental/spark/_globals.py", line 36, in <module>
from typing_extensions import Self
ModuleNotFoundError: No module named 'typing_extensions'
Same result on the 1.5.6 release.
OS:
macOS 15 (aarch64)
DuckDB Package Version:
2.0.0.dev2610011535 (nightly); also 1.5.6
Python Version:
3.12
Full Name:
Joaquin Hui Gomez
Affiliation:
Independent contributor
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a nightly build
Did you include all relevant data sets for reproducing the issue?
Not applicable - the reproduction does not require a data set
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
- Yes, I have
- Ngôn ngữ chính
- Python
- Star
- 191
- Fork
- 120
- Merge trung bình
- 15 giờ 14 phút
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của duckdb/duckdb-python
-
`overwrite` parameter in `to_parquet` does nothingCó thể đã có người làm @00200200 đã nhận 15 ngày trước. Đang mởneeds triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
duckdb/duckdb-python#633 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type stubs omit the `connection` keyword on module-level `read_json` and `write_csv`Có thể đã có người làm @tojacob03 đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
duckdb/duckdb-python#627 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`read_json` accepts a list of paths at runtime but the type stub only allows a single path.Có thể đã có người làm @aleks-drozy đã nhận 73 ngày trước. Đang mởneeds triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
duckdb/duckdb-python#576 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
duckdb/duckdb-python#534 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing ROW_GROUPS_PER_FILE argument in write_parquet functionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởneeds triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
duckdb/duckdb-python#386 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của duckdb/duckdb-python
Issue tương tự
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
btclib-org/btclib-node#1955 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation v0.9.2
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
khuisman/mcp-gee-sweet#1033 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ossf/cve-bin-tool#5966 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
write_iceberg ignores the table's write.parquet.compression-codec propertyCó thể đã có người làm @YuangGao đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Eventual-Inc/Daft#7606 ·
Maintainer thường phản hồi trong vòng 1 ngày