duckdb.experimental.spark fails to import without typing_extensions, which is not a runtime dependency
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
Rechercherichtung
Die drei fehlerhaften Importe befinden sich in duckdb/experimental/spark/_globals.py:36, duckdb/experimental/spark/sql/types.py:14 und duckdb/experimental/spark/_typing.py:22. Reproduziere zuerst in einer sauberen venv mit nur duckdb und numpy, und importiere danach duckdb.experimental.spark.sql. Vergleiche mit duckdb/polars_io.py für das vorhandene Guard-Muster. Fertig ist, wenn diese Module nur mit dem Standardbibliotheksmodul typing importiert werden können und der Spark-Import ohne installiertes typing_extensions gelingt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- Python
- Sterne
- 191
- Forks
- 120
- Ø Merge
- 14 Std. 1 Min.
- Gemergte PRs (30 T.)
- 23
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus duckdb/duckdb-python
-
Type stubs omit the `connection` keyword on module-level `read_json` and `write_csv`Evtl. vergeben @tojacob03 hat das vor 16 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
duckdb/duckdb-python#627 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`read_json` accepts a list of paths at runtime but the type stub only allows a single path.Evtl. vergeben @aleks-drozy hat das vor 74 Tagen übernommen. Offenneeds triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
duckdb/duckdb-python#576 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Possible reference leak of the argument tuple in `FunctionCall()`Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenneeds triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
duckdb/duckdb-python#534 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Missing ROW_GROUPS_PER_FILE argument in write_parquet functionEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenneeds triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
duckdb/duckdb-python#386 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
duckdb/duckdb-python#667 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in duckdb/duckdb-python
Ähnliche Issues
-
area:core-platform effort:S priority:P3 status:in-review type:test
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 80/100
randomparity/kdive#3246 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton massOffenbug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
nf-core/metaboigniter#130 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
common-workflow-language/cwl-utils#477 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add dependabotOffenfeat
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
open-nudge/opentemplate#204 ·
Maintainer antworten meist innerhalb von 1 Tag
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limitEvtl. vergeben @VascoSch92 hat das heute übernommen. Offenpriority:medium ready-for-dev
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
OpenHands/extensions#781 ·
Maintainer antworten meist innerhalb von 1 Tag