Skip to content

Design: the settings plugin module has become de facto framework; make the dependency explicit #500

Closed

Description

@antosubash

Tier 2: structural (needs a design note first)

Problem

SM009 forbids framework/* from importing plugin modules. Hosting depends on settings anyway, through string imports the AST check can't see:

  • _preapp_config.py:59: importlib.import_module("settings.constants")
  • _lifespan.py:49-50: "settings.service", "settings.store"
  • _hydrate_step.py:27: "settings.hydrate"
  • _secret_key.py:27,78: raw SQL into the settings module's table, with hard-coded column names

On the module side, settings/registration.py:25 (register_module_settings) is the settings-registration path for nine modules: api_tokens, background_tasks, branding (18 imports), file_storage, keycloak, site_lock, tenants, users, and others.

Cost

Options

  1. Move the settings registry, store and hydration into simple_module_core or simple_module_hosting behind a small SettingsBackend protocol. settings keeps only the admin UI.
  2. Accept that settings is a required framework dependency: import it statically, declare it, and drop the importlib indirection.

Option 1 is cleaner. Option 2 is honest and cheap. The current state is the worst of both.

Also

Extend SM009 to flag importlib.import_module("<plugin>...") string literals in framework/*.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions