duckdb.experimental.spark fails to import without typing_extensions, which is not a runtime dependency
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 82/100
Direção de pesquisa
As três importações problemáticas estão em duckdb/experimental/spark/_globals.py:36, duckdb/experimental/spark/sql/types.py:14 e duckdb/experimental/spark/_typing.py:22. Reproduza primeiro em um venv limpo com apenas duckdb e numpy e, em seguida, importe duckdb.experimental.spark.sql. Compare com duckdb/polars_io.py para ver o padrão de guarda existente. Está concluído quando esses módulos forem importados apenas com o módulo typing da biblioteca padrão e a importação do spark funcionar sem typing_extensions instalado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 191
- Forks
- 120
- Merge médio
- 14h 1min
- PRs com merge (30d)
- 23
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de duckdb/duckdb-python
-
Type stubs omit the `connection` keyword on module-level `read_json` and `write_csv`Talvez já em andamento @tojacob03 assumiu há 16 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 90/100
duckdb/duckdb-python#627 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`read_json` accepts a list of paths at runtime but the type stub only allows a single path.Talvez já em andamento @aleks-drozy assumiu há 74 dias. Abertaneeds triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
duckdb/duckdb-python#576 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Possible reference leak of the argument tuple in `FunctionCall()`Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaneeds triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
duckdb/duckdb-python#534 ·
Mantenedores costumam responder em até 1 dia
-
Missing ROW_GROUPS_PER_FILE argument in write_parquet functionTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaneeds triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
duckdb/duckdb-python#386 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 30/100
duckdb/duckdb-python#667 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de duckdb/duckdb-python
Issues semelhantes
-
Path subtraction removes repeated suffix characters instead of one suffixTalvez já em andamento @Gwerdonatus assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
joke2k/django-environ#671 ·
-
good first issue help wanted windows
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
-
test_pgbouncer deploys the server under test from Charmhub instead of the local build (track/1.31)Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
canonical/temporal-k8s-operator#195 · 1 comentário ·
Mantenedores costumam responder em até 4 dias
-
`burr` fails to start when the Python path has a space in itTalvez já em andamento @enekoreto assumiu hoje. Abertastatus/needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 5 dias
-
device support request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
zigpy/zha-device-handlers#5461 ·
Mantenedores costumam responder em até 4 dias