Framework layout
Every package under framework/ (core, db, hosting, inertia, testing, cli, remote) follows this area layout alongside Module layout.
The goal is the same: find code by asking which subsystem owns it, while keeping top-level package imports (simple_module_db, simple_module_core, simple_module_hosting, simple_module_inertia, simple_module_test) and external submodule imports stable across a two-release deprecation window.
Package directory
framework/<project>/
├── <package>/ Python package organized into domain areas
├── tests/ Python tests mirroring package areas
├── tests-js/ Vitest tests, when present (hosting)
├── README.md, LICENSE, pyproject.tomlPackage root: lookup & wire paths
Only entries resolved by packaging metadata, CLI entry points, resource lookups, frozen outbox wire names, active deprecation shims, and declared domain area directories belong at the package root:
| Package | Allowed root entries (besides __init__.py, py.typed, areas, shims) | Reason |
|---|---|---|
simple_module_core | __main__.py, tenant_events.py, user_events.py | CLI diagnostics entry point; frozen durable outbox event wire names pinned by host/tests/test_durable_wire_names.py |
simple_module_db | — | Everything groups into domain areas; tenant_cleanup handler keeps its wire name via explicit subscribe_durable(..., name=...) |
simple_module_hosting | __main__.py, host_cli.py, admin_overview/, setup_wizard/, locales/, ui_locales/ | Host CLI entry point and discovery/package-data subpackages |
simple_module_inertia | — | Package root re-exports top-level public API; internals live in areas |
simple_module_remote | — | Everything groups into domain areas; the root __init__.py re-exports build_cli |
simple_module_test | plugin.py | pytest11 entry point registered in framework/testing/pyproject.toml |
simple_module_cli | cli.py, migration_recipes/, templates/, skills | smpy / simple-module script entry point, simple_module.data_upgrades entry points, and package data |
Domain areas per package
An area's __init__.py holds only a docstring, except explicit public facade packages such as framework/core/simple_module_core/diagnostics/. Private helpers keep a leading underscore inside the area they serve. Declared area names must not collide with any existing root .py module stem (including active shims). Every source module must import cleanly in a fresh Python interpreter (python -c "import <pkg>.<mod>"). The 300-line file cap applies to framework sources and tests.
framework/inertia(simple_module_inertia):protocol,rendering,assetsframework/cli(simple_module_cli):commands,scaffold,sources,updates,tooling,migrationsframework/core(simple_module_core):modules,access,eventing,settings,web,localization,mailer,runtime,diagnostics,migrationsframework/db(simple_module_db):engine,models,scoping,auditing,schema,queriesframework/hosting(simple_module_hosting):boot,config,pipeline,rate_limit,auth,error_handling,frontend,i18n,observability,lockingframework/testing(simple_module_test):app,db,web,fakes
framework/<project>/tests/
├── conftest.py # shared package fixtures (plus root _*_support.py / _*_models.py helpers)
├── <area>/test_*.py # mirrored area tests (or <area>/<feature>/test_*.py for large areas)Test directories contain no __init__.py and no flat tests/test_*.py files; pytest's --import-mode=importlib allows repeated test basenames across areas. Shared root test helper directories remain listed under [tool.pytest.ini_options].pythonpath in pyproject.toml.
Compatibility shims for moved paths
Any old framework submodule path imported outside its owning package (in modules/, host/, or downstream smpy_modules) keeps a sys.modules alias shim at the old root location with remove_in="0.0.52" (docs/framework/deprecations.md):
- Packages that depend on
simple_module_core(core,db,hosting,testing) usesimple_module_core.runtime.deprecation.deprecated_module. - Leaf packages (
inertia,cli) keep zero dependency oncoreby emitting stdlibDeprecationWarningbefore aliasingsys.modules[__name__]and registering the expiry target viadeprecate(...)in_register_all()ofhost/tests/test_deprecation_expiry.py.
host/tests/test_framework_layout.py enforces this contract unconditionally for all seven framework packages. host/tests/test_deprecation_expiry.py auto-discovers active framework alias shims and fails once the framework reaches remove_in.
Migration status
| Package | Source dir | Root .py (target excludes shims) | Flat tests/test_*.py | State |
|---|---|---|---|---|
inertia | simple_module_inertia | 1 | 0 | follows this layout |
cli | simple_module_cli | 2 | 0 | follows this layout |
core | simple_module_core | 4 | 0 | follows this layout |
db | simple_module_db | 1 | 0 | follows this layout |
hosting | simple_module_hosting | 3 | 0 | follows this layout |
testing | simple_module_test | 2 | 0 | follows this layout |
remote | simple_module_remote | 0 | 0 | follows this layout |