Documented editable install breaks three unit-test suites: inference_models resolves as an empty namespace package from the repo root
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 66/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- devtools, testing-qa
Direzione di ricerca
Leggi le istruzioni di installazione in AGENTS.md riga 28 e .github/CONTRIBUTING.md riga 76. Aggiorna il comando per l’installazione editable di ./inference_models usando la modalità di compatibilità verificata e spiega perché è necessaria. Conferma che il comando documentato funziona dalla root del repository con le tre suite di pytest interessate indicate nell’issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
AGENTS.md (line 28) and .github/CONTRIBUTING.md (line 76) tell contributors to set up a dev environment with
pip install -e ./inference_models -e ./workflows -e ./stream_vision -e .
and to run development commands from the repository root. Doing exactly that, these suites fail at collection:
python -m pytest tests/inference_cli/unit_tests
python -m pytest tests/workflows/unit_tests
python -m pytest tests/inference/unit_tests
ImportError while importing test module '.../tests/workflows/unit_tests/core_steps/common/query_language/operations/test_classification_results_operations.py'.
E ImportError: cannot import name 'ClassificationPrediction' from 'inference_models' (unknown location)
tests/inference_sdk/unit_tests and (cd workflows && pytest tests/unit_tests tests/isolation) are fine.
Why
python -m pytest puts the repo root on sys.path. The repo root contains the inference_models/ project folder (pyproject, README, docs — no __init__.py), which shares its name with the inference_models package inside it. With the default setuptools editable install, the real package is served by an __editable___inference_models_*_finder.py meta-path hook, so the path-based finder sees only the project folder and resolves inference_models as an empty namespace package:
$ python -c "import inference_models as m; print(m.__path__, m.__file__)"
['/.../inference/inference_models'] None # from repo root: wrong
$ cd /tmp && python -c "import inference_models as m; print(m.__file__)"
/.../inference/inference_models/inference_models/__init__.py # elsewhere: right
CI is unaffected because the workflows use pip install --no-deps ./inference_models (non-editable), which installs a regular package into site-packages, and a regular package wins over a namespace portion.
workflows/ and stream_vision/ don't hit this because their package names (roboflow_workflows, streamvision) differ from their folder names.
Verified fix
pip install --config-settings editable_mode=compat -e ./inference_models
This installs via a plain .pth path entry, so the path-based finder finds the real package. After that, from the repo root:
| Suite | Before | After |
|---|---|---|
tests/inference_cli/unit_tests |
collection error | 241 passed |
tests/workflows/unit_tests |
collection error | 1344 passed, 30 skipped |
tests/inference/unit_tests |
collection error | 5304 passed, 11 skipped |
Also checked:
--config-settings editable_mode=strictworks too (it installs a link tree via.pth), but new files then need a reinstall to be picked up, socompatis the friendlier default for development.- Using the
pytestconsole script instead ofpython -m pytestdoes not help: pytest's defaultprependimport mode inserts the repo root anyway. - Installing non-editably (
pip install ./inference_models, as CI does) also works, at the cost of reinstalling after every change.
Environment
macOS 15 (arm64), Python 3.12.13, pip via uv 0.10.8, setuptools default editable mode, main @ 9f67071d3.
Proposal
Happy to open a small PR. Options, smallest first:
- Update the install line in
AGENTS.mdand.github/CONTRIBUTING.mdto use--config-settings editable_mode=compatfor./inference_models(or install it non-editably like CI does), with one sentence on why. - Additionally, a guard in
tests/conftest.pythat fails fast with a clear message wheninference_models.__file__ is None, so the next person gets "your editable install is shadowed" instead of a confusingImportError.
Which would you prefer?
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 340
- Merge medio
- 2g 11h
- PR unite (30g)
- 92
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di roboflow/inference
-
Allow Pillow 13 in inference-sdkForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
roboflow/inference#3335 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
roboflow/inference#2993 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Add context manager (__enter__ / __exit__) support to InferencePipelineForse già presa @KushagraKanaujia l’ha presa 67 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
roboflow/inference#2744 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
roboflow/inference#1913 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
onnxruntime CoreML execution provider leaks ~70-78 KB per inference on macOS (RF-DETR default config)Forse già presa @Nishant-ZFYII l’ha presa 14 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
roboflow/inference#3302 · 13 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di roboflow/inference
Issue simili
-
area:core-platform effort:S priority:P3 risk:night-safe status:ready type:test
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
randomparity/kdive#3620 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
FinanceFlash/unvibecode#760 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
google-research/google-research#3470 ·
I maintainer di solito rispondono entro 21 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
mrvautin/ha-workouts#11 ·