Skip to content

users/hosting import 'settings.registration' at boot but simple_module_settings isn't a declared dep — ModuleNotFoundError #107

Description

@antosubash

Summary

A freshly-scaffolded host app crashes on first boot with ModuleNotFoundError: No module named 'settings'. The cause is that users/module.py and simple_module_hosting/app_builder.py both call importlib.import_module(\"settings.registration\") at startup, but simple_module_settings (which provides the settings top-level package) is not in the scaffold's default dependency list, and isn't pulled in transitively by simple_module_hosting or simple_module_users either.

Reproduction

uvx --from simple_module_cli sm new my-app --db sqlite --preset standard -y --no-install
cd my-app
# (after working around #105 and #106)
make install
make migrate
uv run python -c "from main import app"

Failure tail:

File ".../site-packages/users/module.py", line 55, in register_settings
register_module_settings = importlib.import_module(
^^^^^^^^^^^^^^^^^^^^^^^^
File ".../python3.12/importlib/__init__.py", line 90, in _gcd_import
ModuleNotFoundError: No module named 'settings'

Source references

simple_module_hosting/app_builder.py:209-219

# We resolve `settings.registration` via importlib rather than a plain# `from settings.registration import ...`: ..._register_module_settings=importlib.import_module(
"settings.registration"
).register_module_settings

users/module.py:55-58 does the same.

simple_module_settings==0.0.6 is published on PyPI (pip index versions simple-module-settings → 0.0.6) and provides settings/registration.py, so it's clearly the intended provider — it's just not declared.

Generated pyproject.toml deps (no simple_module_settings)

dependencies = [
"simple_module_hosting==0.0.6",
"simple_module_auth==0.0.6",
"simple_module_users==0.0.6",
"simple_module_dashboard==0.0.6",
"simple_module_permissions==0.0.6",
]

Suggested fix

Either:

  1. Make simple_module_hosting declare simple_module_settings as a runtime dependency (cleanest — every host needs it because hosting itself imports it), or
  2. Have sm new add simple_module_settings to the host's dependency list.

(1) is more robust because every module that uses register_module_settings (e.g. users) would otherwise need to depend on it individually.

Workaround

uv add simple_module_settings==0.0.6

Environment

  • simple_module_cli, simple_module_hosting, simple_module_users all at 0.0.6
  • uv 0.7.5
  • macOS 25.4.0 (arm64), Python 3.12.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions