snapmaker-studio icon indicating copy to clipboard operation
snapmaker-studio copied to clipboard

Non-editable install (pip/pipx/wheel) ships no snapstudio_core/data → ModuleNotFoundError

Open MGEB-droid opened this issue 1 week ago • 0 comments

Version: v1.7.0 source tarball, Linux, Python 3.14, pip 26.2.2 (default build isolation, setuptools from PyPI)

A regular (non-editable) install of the backend ships none of the files in snapstudio_core/data/, so the CLI breaks at runtime:

$ pip install ./backend        # or: pip wheel ./backend, pipx install ...
$ u1convert doctor some_project.3mf
...
ModuleNotFoundError: No module named 'snapstudio_core.data'

Cause: backend/pyproject.toml declares no package data, there is no MANIFEST.in, and data/ has no __init__.py. The built wheel snapmaker_studio-1.7.0-py3-none-any.whl contains 0 of the 11 data files. The code still loads them via importlib.resources.files("snapstudio_core.data") (filaments.py, optimize.py, …) and Path(__file__).parent / "data" (ecosystem.py).

Why CI doesn't catch it: ci.yml, linux-ci.yml, release.yml and release-linux.yml all use pip install -e, which reads the source tree. The desktop sidecar passes --collect-data snapstudio_core explicitly (desktop/scripts/build-sidecar.sh), so the installers are fine. Only users who install the CLI with pip/pipx are affected.

Fix (tested): add to backend/pyproject.toml

[tool.setuptools.package-data]
snapstudio_core = ["data/**/*"]

With this line, the wheel contains all 11 data files. Installed into a fresh venv, u1convert doctor runs normally. Without it, the same command fails with the error above.

Suggestion: a CI step that builds the wheel, installs it non-editable into a clean venv and runs u1convert selfcheck. That would catch this class of bug.

MGEB-droid avatar Nov 23 '26 12:11 MGEB-droid