FastPluggy 0.4.62__tar.gz → 0.4.73__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/PKG-INFO +8 -3
  2. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/README.md +7 -2
  3. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/pyproject.toml +1 -1
  4. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/FastPluggy.egg-info/PKG-INFO +8 -3
  5. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/FastPluggy.egg-info/SOURCES.txt +3 -0
  6. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/auth/auth_interface.py +58 -0
  7. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/base_module_manager.py +19 -12
  8. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/config.py +14 -0
  9. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/core_metrics.py +17 -1
  10. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/database.py +71 -1
  11. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/error/degraded_mode_handler.py +8 -0
  12. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/error/degraded_mode_middleware.py +18 -2
  13. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/events/bus.py +64 -2
  14. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/menu/decorator.py +18 -0
  15. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/menu/menu_manager.py +45 -0
  16. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/menu/schema.py +3 -1
  17. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/admin.py +26 -1
  18. fastpluggy-0.4.73/src/fastpluggy/core/routers/ready.py +142 -0
  19. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/fastpluggy.py +23 -8
  20. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/base.html.j2 +7 -4
  21. fastpluggy-0.4.73/tests/test_database_driver.py +129 -0
  22. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_degraded_mode.py +49 -1
  23. fastpluggy-0.4.73/tests/test_event_bus_ownership.py +154 -0
  24. fastpluggy-0.4.73/tests/test_sys_path_reload.py +50 -0
  25. fastpluggy-0.4.62/src/fastpluggy/core/routers/ready.py +0 -21
  26. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/setup.cfg +0 -0
  27. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/FastPluggy.egg-info/dependency_links.txt +0 -0
  28. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/FastPluggy.egg-info/requires.txt +0 -0
  29. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/FastPluggy.egg-info/top_level.txt +0 -0
  30. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/__init__.py +0 -0
  31. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/cli_utils.py +0 -0
  32. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/__init__.py +0 -0
  33. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/auth/__init__.py +0 -0
  34. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/auth/anonymous.py +0 -0
  35. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/auth/delegating_backend.py +0 -0
  36. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/auth/middleware.py +0 -0
  37. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/dependency.py +0 -0
  38. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/error/__init__.py +0 -0
  39. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/error/exception.py +0 -0
  40. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/events/__init__.py +0 -0
  41. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/events/event.py +0 -0
  42. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/events/spec.py +0 -0
  43. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/flash.py +0 -0
  44. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/global_registry.py +0 -0
  45. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/menu/__init__.py +0 -0
  46. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/menu/override_service.py +0 -0
  47. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/metrics.py +0 -0
  48. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models.py +0 -0
  49. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models_tools/__init__.py +0 -0
  50. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models_tools/base.py +0 -0
  51. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models_tools/callable.py +0 -0
  52. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models_tools/pydantic.py +0 -0
  53. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models_tools/shared.py +0 -0
  54. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/models_tools/sqlalchemy.py +0 -0
  55. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/module_base.py +0 -0
  56. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/plugin/__init__.py +0 -0
  57. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/plugin/dependency_resolver.py +0 -0
  58. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/plugin/repository.py +0 -0
  59. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/plugin/service.py +0 -0
  60. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/plugin/validator.py +0 -0
  61. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/plugin_state.py +0 -0
  62. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/repository/__init__.py +0 -0
  63. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/repository/app_settings.py +0 -0
  64. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/__init__.py +0 -0
  65. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/actions/__init__.py +0 -0
  66. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/actions/modules.py +0 -0
  67. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/admin_menu.py +0 -0
  68. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/app_static.py +0 -0
  69. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/base_module.py +0 -0
  70. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/home.py +0 -0
  71. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/service_worker.py +0 -0
  72. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/routers/settings.py +0 -0
  73. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/static.py +0 -0
  74. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/__init__.py +0 -0
  75. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/fastapi.py +0 -0
  76. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/fs_tools.py +0 -0
  77. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/inspect_tools.py +0 -0
  78. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/install.py +0 -0
  79. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/jinja_tools.py +0 -0
  80. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/lock.py +0 -0
  81. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/serialize_tools.py +0 -0
  82. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/system.py +0 -0
  83. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/tools/threads_tools.py +0 -0
  84. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/topbar.py +0 -0
  85. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/view_builder/__init__.py +0 -0
  86. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/view_builder/builder.py +0 -0
  87. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/view_builder/form_builder.py +0 -0
  88. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/view_builder/pagination.py +0 -0
  89. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/__init__.py +0 -0
  90. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/base.py +0 -0
  91. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/__init__.py +0 -0
  92. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/custom.py +0 -0
  93. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/__init__.py +0 -0
  94. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/debug.py +0 -0
  95. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/model.py +0 -0
  96. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/raw.py +0 -0
  97. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/table.py +0 -0
  98. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/table_model.py +0 -0
  99. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/data/traceback.py +0 -0
  100. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/__init__.py +0 -0
  101. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/alert.py +0 -0
  102. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/card.py +0 -0
  103. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/code.py +0 -0
  104. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/custom.py +0 -0
  105. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/progress.py +0 -0
  106. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/display/stats.py +0 -0
  107. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/input/__init__.py +0 -0
  108. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/input/button.py +0 -0
  109. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/input/button_list.py +0 -0
  110. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/input/form.py +0 -0
  111. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/layout/__init__.py +0 -0
  112. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/layout/grid.py +0 -0
  113. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/categories/layout/tabbed.py +0 -0
  114. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/fastpluggy_integration.py +0 -0
  115. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/mixins.py +0 -0
  116. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/core/widgets/render_field_tools.py +0 -0
  117. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/01-tokens.css +0 -0
  118. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/02-tabler-bridge.css +0 -0
  119. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/03-layout.css +0 -0
  120. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/04-components.css +0 -0
  121. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/05-admin.css +0 -0
  122. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/06-widgets.css +0 -0
  123. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/07-responsive.css +0 -0
  124. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/08-json-modal.css +0 -0
  125. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/__init__.py +0 -0
  126. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/fastpluggy.css +0 -0
  127. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/css/styles.css +0 -0
  128. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/favicon.svg +0 -0
  129. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/js/__init__.py +0 -0
  130. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/js/scripts.js +0 -0
  131. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/js/sw-register.js +0 -0
  132. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/service-worker-base.js +0 -0
  133. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/all.min.css +0 -0
  134. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-brands-400.ttf +0 -0
  135. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-brands-400.woff2 +0 -0
  136. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-regular-400.ttf +0 -0
  137. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-regular-400.woff2 +0 -0
  138. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-solid-900.ttf +0 -0
  139. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-solid-900.woff2 +0 -0
  140. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-v4compatibility.ttf +0 -0
  141. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/fontawesome-6.0.0/webfonts/fa-v4compatibility.woff2 +0 -0
  142. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-1.4.0/css/tabler-themes.min.css +0 -0
  143. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-1.4.0/css/tabler-themes.min.css.map +0 -0
  144. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-1.4.0/css/tabler.min.css +0 -0
  145. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-1.4.0/css/tabler.min.css.map +0 -0
  146. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-1.4.0/js/tabler.min.js +0 -0
  147. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-1.4.0/js/tabler.min.js.map +0 -0
  148. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-icons/fonts/tabler-icons.eot +0 -0
  149. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-icons/fonts/tabler-icons.ttf +0 -0
  150. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-icons/fonts/tabler-icons.woff +0 -0
  151. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-icons/fonts/tabler-icons.woff2 +0 -0
  152. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/static/vendor/tabler-icons/tabler-icons.min.css +0 -0
  153. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/403.html.j2 +0 -0
  154. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/404.html.j2 +0 -0
  155. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/__init__.py +0 -0
  156. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/admin/admin_menu.html.j2 +0 -0
  157. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/admin/capabilities.html.j2 +0 -0
  158. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/admin/events.html.j2 +0 -0
  159. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/admin/module_overview.html.j2 +0 -0
  160. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/auth/__init__.py +0 -0
  161. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/components/__init__.py +0 -0
  162. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/components/table_filter_component.html.j2 +0 -0
  163. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/degraded_mode.html.j2 +0 -0
  164. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/error.html.j2 +0 -0
  165. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/error_base.html.j2 +0 -0
  166. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/flash_messages.html.j2 +0 -0
  167. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/generic_page.html.j2 +0 -0
  168. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/index.html.j2 +0 -0
  169. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/menu.html.j2 +0 -0
  170. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/plugin_load_error.html.j2 +0 -0
  171. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/data/debug.html.j2 +0 -0
  172. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/data/table.html.j2 +0 -0
  173. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/data/traceback.html.j2 +0 -0
  174. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/data/view_model.html.j2 +0 -0
  175. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/display/alert.html.j2 +0 -0
  176. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/display/card.html.j2 +0 -0
  177. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/display/code.html.j2 +0 -0
  178. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/display/progress.html.j2 +0 -0
  179. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/display/stats.html.j2 +0 -0
  180. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/display/status.html.j2 +0 -0
  181. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/input/button.html.j2 +0 -0
  182. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/input/button_list.html.j2 +0 -0
  183. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/input/form.html.j2 +0 -0
  184. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/layout/grid.html.j2 +0 -0
  185. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/layout/tabbed.html.j2 +0 -0
  186. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/partials/card_header.html.j2 +0 -0
  187. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/partials/pagination_macros.html.j2 +0 -0
  188. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/src/fastpluggy/templates/widgets/widget_renderer.html.j2 +0 -0
  189. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_app.py +0 -0
  190. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_app_static.py +0 -0
  191. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_auth.py +0 -0
  192. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_core_metrics.py +0 -0
  193. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_database_pool.py +0 -0
  194. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_domain_module_manager.py +0 -0
  195. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_dynamic_settings.py +0 -0
  196. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_ensure_index.py +0 -0
  197. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_event_bus.py +0 -0
  198. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_execute_removed.py +0 -0
  199. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_fast_pluggy_init.py +0 -0
  200. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_flash.py +0 -0
  201. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_metrics.py +0 -0
  202. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_module_base_router_guard.py +0 -0
  203. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_simple_example.py +0 -0
  204. {fastpluggy-0.4.62 → fastpluggy-0.4.73}/tests/test_topbar.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FastPluggy
3
- Version: 0.4.62
3
+ Version: 0.4.73
4
4
  Summary: A FastAPI-based framework with plugin management.
5
5
  Project-URL: Homepage, https://fastpluggy.xyz
6
6
  Project-URL: Documentation, https://docs.fastpluggy.xyz
@@ -43,11 +43,16 @@ Requires-Dist: beautifulsoup4; extra == "tests"
43
43
  ## Features
44
44
 
45
45
  - **Plugin Management**: Easily manage, enable, disable, and configure plugins.
46
- - **Database Integration**: Supports SQLAlchemy for database handling.
46
+ - **Database Integration**: Supports SQLAlchemy for database handling with connection pooling and health checks.
47
+ - **Event Bus**: Plugin-to-plugin communication via typed events with ownership-scoped subscriptions.
47
48
  - **Static Files and Templates**: Serve static files and Jinja2 templates seamlessly.
49
+ - **Menu Management**: Runtime control over the navigation menu — hide items, reorder, override labels, and role-gate entries from the admin UI.
50
+ - **Topbar Actions**: Plugin-configurable icon buttons in the admin topbar.
51
+ - **Authentication & Authorization**: Pluggable auth backends with role-based access control and custom role-check seams.
52
+ - **Health Probes**: Built-in `/health` (liveness) and `/ready` (readiness) endpoints for orchestrators and monitoring.
48
53
  - **Extensibility**: Use FastPluggy as a library to extend your FastAPI applications.
54
+ - **Customization**: Configure app branding (name, subtitle, logo icon) via settings or environment variables.
49
55
  - **Simple Setup**: Configure your project with a single class, easy initialization.
50
- - **Menu Management**: Runtime control over the navigation menu — hide items, reorder, override labels, and RBAC-gate entries from the admin UI.
51
56
 
52
57
  ## Installation
53
58
 
@@ -10,11 +10,16 @@
10
10
  ## Features
11
11
 
12
12
  - **Plugin Management**: Easily manage, enable, disable, and configure plugins.
13
- - **Database Integration**: Supports SQLAlchemy for database handling.
13
+ - **Database Integration**: Supports SQLAlchemy for database handling with connection pooling and health checks.
14
+ - **Event Bus**: Plugin-to-plugin communication via typed events with ownership-scoped subscriptions.
14
15
  - **Static Files and Templates**: Serve static files and Jinja2 templates seamlessly.
16
+ - **Menu Management**: Runtime control over the navigation menu — hide items, reorder, override labels, and role-gate entries from the admin UI.
17
+ - **Topbar Actions**: Plugin-configurable icon buttons in the admin topbar.
18
+ - **Authentication & Authorization**: Pluggable auth backends with role-based access control and custom role-check seams.
19
+ - **Health Probes**: Built-in `/health` (liveness) and `/ready` (readiness) endpoints for orchestrators and monitoring.
15
20
  - **Extensibility**: Use FastPluggy as a library to extend your FastAPI applications.
21
+ - **Customization**: Configure app branding (name, subtitle, logo icon) via settings or environment variables.
16
22
  - **Simple Setup**: Configure your project with a single class, easy initialization.
17
- - **Menu Management**: Runtime control over the navigation menu — hide items, reorder, override labels, and RBAC-gate entries from the admin UI.
18
23
 
19
24
  ## Installation
20
25
 
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "FastPluggy"
9
- version = "0.4.62"
9
+ version = "0.4.73"
10
10
  description = "A FastAPI-based framework with plugin management."
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FastPluggy
3
- Version: 0.4.62
3
+ Version: 0.4.73
4
4
  Summary: A FastAPI-based framework with plugin management.
5
5
  Project-URL: Homepage, https://fastpluggy.xyz
6
6
  Project-URL: Documentation, https://docs.fastpluggy.xyz
@@ -43,11 +43,16 @@ Requires-Dist: beautifulsoup4; extra == "tests"
43
43
  ## Features
44
44
 
45
45
  - **Plugin Management**: Easily manage, enable, disable, and configure plugins.
46
- - **Database Integration**: Supports SQLAlchemy for database handling.
46
+ - **Database Integration**: Supports SQLAlchemy for database handling with connection pooling and health checks.
47
+ - **Event Bus**: Plugin-to-plugin communication via typed events with ownership-scoped subscriptions.
47
48
  - **Static Files and Templates**: Serve static files and Jinja2 templates seamlessly.
49
+ - **Menu Management**: Runtime control over the navigation menu — hide items, reorder, override labels, and role-gate entries from the admin UI.
50
+ - **Topbar Actions**: Plugin-configurable icon buttons in the admin topbar.
51
+ - **Authentication & Authorization**: Pluggable auth backends with role-based access control and custom role-check seams.
52
+ - **Health Probes**: Built-in `/health` (liveness) and `/ready` (readiness) endpoints for orchestrators and monitoring.
48
53
  - **Extensibility**: Use FastPluggy as a library to extend your FastAPI applications.
54
+ - **Customization**: Configure app branding (name, subtitle, logo icon) via settings or environment variables.
49
55
  - **Simple Setup**: Configure your project with a single class, easy initialization.
50
- - **Menu Management**: Runtime control over the navigation menu — hide items, reorder, override labels, and RBAC-gate entries from the admin UI.
51
56
 
52
57
  ## Installation
53
58
 
@@ -183,16 +183,19 @@ tests/test_app.py
183
183
  tests/test_app_static.py
184
184
  tests/test_auth.py
185
185
  tests/test_core_metrics.py
186
+ tests/test_database_driver.py
186
187
  tests/test_database_pool.py
187
188
  tests/test_degraded_mode.py
188
189
  tests/test_domain_module_manager.py
189
190
  tests/test_dynamic_settings.py
190
191
  tests/test_ensure_index.py
191
192
  tests/test_event_bus.py
193
+ tests/test_event_bus_ownership.py
192
194
  tests/test_execute_removed.py
193
195
  tests/test_fast_pluggy_init.py
194
196
  tests/test_flash.py
195
197
  tests/test_metrics.py
196
198
  tests/test_module_base_router_guard.py
197
199
  tests/test_simple_example.py
200
+ tests/test_sys_path_reload.py
198
201
  tests/test_topbar.py
@@ -48,6 +48,64 @@ class AuthInterface(AuthenticationBackend):
48
48
  """
49
49
  pass
50
50
 
51
+ #: Roles that see every menu item regardless of the item's ``required_role``.
52
+ #: The admin / super-user is a master key by default; override this attribute
53
+ #: (or ``user_has_role`` itself) to change the policy.
54
+ super_user_roles: frozenset[str] = frozenset({"fp_admin", "admin"})
55
+
56
+ def user_has_role(self, request: Request, role: str) -> bool:
57
+ """Decide whether the current request may see an item gated on ``role``.
58
+
59
+ This is the single, pluggable role-check seam. The menu renderer calls it
60
+ for every item carrying a ``required_role``; route guards can call it too.
61
+ Rather than hardcoding a comparison against a legacy roles array, the
62
+ default policy is:
63
+
64
+ 1. **Super-user is a master key.** A user holding any of
65
+ ``super_user_roles`` (``fp_admin``/``admin`` by default, or ``is_admin``
66
+ on the user object) sees everything — the admin console must never be
67
+ able to hide an item from the admin who configures it.
68
+ 2. Otherwise, **scope membership**: ``role in request.auth.scopes``. Scopes
69
+ are produced by :meth:`authenticate`, so each app already controls how a
70
+ user's attributes map to roles (bool columns, DB roles, LDAP groups…)
71
+ without touching this method.
72
+
73
+ Apps wanting richer semantics — role hierarchies (``admin`` implies
74
+ ``editor``), wildcards, a permission→role map — override just this method.
75
+ """
76
+ if role is None:
77
+ return True
78
+
79
+ # 1. Super-user short-circuit — the admin sees all.
80
+ user = getattr(getattr(request, "state", None), "current_user", None)
81
+ if user is not None and getattr(user, "is_admin", False):
82
+ return True
83
+ if role in self.super_user_roles:
84
+ # A non-admin can still legitimately *hold* the fp_admin scope.
85
+ return self._role_in_scopes(request, role)
86
+
87
+ # 2. Default policy: scope membership.
88
+ return self._role_in_scopes(request, role)
89
+
90
+ @staticmethod
91
+ def _role_in_scopes(request: Request, role: str) -> bool:
92
+ """Membership test tolerant of where the scopes live.
93
+
94
+ ``request.auth.scopes`` is the modern source (set by starlette's
95
+ ``AuthenticationMiddleware`` from the ``AuthCredentials`` returned by
96
+ :meth:`authenticate`). Fall back to ``request.state.roles`` — which
97
+ ``CurrentUserMiddleware`` sets to that same ``AuthCredentials`` object —
98
+ and finally to a plain sequence, so a caller passing a bare list works too.
99
+ """
100
+ auth = getattr(request, "auth", None)
101
+ scopes = getattr(auth, "scopes", None)
102
+ if scopes is None:
103
+ roles = getattr(getattr(request, "state", None), "roles", None)
104
+ if roles is None:
105
+ return False
106
+ scopes = getattr(roles, "scopes", roles)
107
+ return role in scopes
108
+
51
109
  def get_user_menu_entries(self, request: Request) -> list:
52
110
  """
53
111
  Returns menu items for the user dropdown based on whether a user is logged in.
@@ -226,9 +226,13 @@ class BaseModuleManager(ABC):
226
226
  folder_path = Path(folder)
227
227
 
228
228
  if folder_path.exists():
229
- # Add folder to module search path
230
- domain_path = folder_path.resolve()
231
- sys.path.append(str(domain_path))
229
+ # Add folder to module search path, once: discover_plugins() re-runs on
230
+ # every load_app() (settings save, enable/disable, reload), and an
231
+ # unconditional append grew sys.path by one entry per folder each time
232
+ # (fast_pluggy#33).
233
+ domain_path = str(folder_path.resolve())
234
+ if domain_path not in sys.path:
235
+ sys.path.append(domain_path)
232
236
 
233
237
  logger.info(f"🔍 Discovering {module_type} modules in {domain_path}")
234
238
 
@@ -522,15 +526,18 @@ class BaseModuleManager(ABC):
522
526
  logger.debug(f"🔧 Calling '{hook_name}' for plugin '{plugin.module_name}'")
523
527
 
524
528
  from fastpluggy.fastpluggy import FastPluggy
525
- call_with_injection(
526
- func=hook,
527
- context_dict={
528
- FastPluggy: self.fast_pluggy,
529
- PluginState: plugin_state,
530
- # BaseModuleManager: self,
531
- },
532
- user_kwargs=kwargs
533
- )
529
+ # Attribute any event subscription made by the hook to this plugin, so
530
+ # load_app() can drop it before the hook runs again (fast_pluggy#30).
531
+ with self.fast_pluggy.events.owned_by(plugin.module_name):
532
+ call_with_injection(
533
+ func=hook,
534
+ context_dict={
535
+ FastPluggy: self.fast_pluggy,
536
+ PluginState: plugin_state,
537
+ # BaseModuleManager: self,
538
+ },
539
+ user_kwargs=kwargs
540
+ )
534
541
 
535
542
  except PluginLoadError as e:
536
543
  # Expected load failure — clean message, no traceback
@@ -82,6 +82,13 @@ class BaseDatabaseSettings(BaseSettings):
82
82
 
83
83
  class FastPluggyConfig(BaseDatabaseSettings):
84
84
  app_name: Optional[str] = 'FastPluggy'
85
+ # Sidebar brand subtitle under app_name, and the Tabler icon class for the
86
+ # brand glyph. Defaults reproduce the built-in "FastPluggy / Admin Console"
87
+ # puzzle-piece brand, so existing deployments are unchanged; override (env
88
+ # var or settings UI) to rebrand the console — e.g. a single-purpose
89
+ # dashboard that isn't the generic FastPluggy admin.
90
+ app_subtitle: Optional[str] = 'Admin Console'
91
+ app_logo_icon: Optional[str] = 'ti ti-puzzle'
85
92
  debug: Optional[bool] = False
86
93
 
87
94
  # admin config
@@ -94,6 +101,13 @@ class FastPluggyConfig(BaseDatabaseSettings):
94
101
  menu_promote_single_parent: bool = True
95
102
  install_module_requirement_at_start: Optional[bool] = True
96
103
 
104
+ # Show the dismissible "No authentication enabled" banner when no auth
105
+ # manager is loaded. Default True (nudge unsecured deployments to install
106
+ # an auth plugin). Set False on a deployment where running without auth is
107
+ # a deliberate, understood choice — e.g. a read-only dashboard on a trusted
108
+ # LAN — so the banner does not nag on every page.
109
+ show_no_auth_warning: bool = True
110
+
97
111
  session_secret_key: str = INSECURE_DEFAULT_SESSION_SECRET_KEY
98
112
 
99
113
  # Mark the `fp_session` cookie `Secure`. Default False for back-compat and
@@ -5,7 +5,9 @@ Registered in GlobalRegistry under "core_metrics_provider" so the metrics
5
5
  plugin can discover it and include core metrics in /api/metrics.
6
6
 
7
7
  Note: the metrics router auto-prefixes names with ``fp_core_``, so metric
8
- names here should NOT start with ``fp_``.
8
+ names here should NOT start with ``fp_``. ``build_info`` below is therefore
9
+ exposed as ``fp_core_build_info`` — NOT ``fastpluggy_build_info``, which is the
10
+ name fast_pluggy#29 proposed before this prefixing convention was checked.
9
11
  """
10
12
 
11
13
  from __future__ import annotations
@@ -13,6 +15,7 @@ from __future__ import annotations
13
15
  from typing import TYPE_CHECKING
14
16
 
15
17
  from .metrics import MetricEntry, MetricsResult
18
+ from .routers.ready import build_identifier
16
19
 
17
20
  if TYPE_CHECKING:
18
21
  from fastpluggy.fastpluggy import FastPluggy
@@ -54,6 +57,19 @@ class CoreMetricsProvider:
54
57
  labels={"plugin": name},
55
58
  ))
56
59
 
60
+ # Build identity (fast_pluggy#29), the standard `*_build_info` shape: a
61
+ # constant 1 whose LABELS carry the information, so it can be joined onto
62
+ # any other series ("alert when the running build != the expected one") in
63
+ # a way a JSON body on /health can never be. Emitted only when the
64
+ # deployment sets the variable — same rule as the probe.
65
+ build = build_identifier()
66
+ if build:
67
+ gauges.append(MetricEntry(
68
+ name="build_info", value=1, type="gauge",
69
+ help="Build identity of the running process, always 1.",
70
+ labels={"build": build},
71
+ ))
72
+
57
73
  counters = [
58
74
  MetricEntry(name="events_dispatched_total",
59
75
  value=getattr(events, 'events_dispatched', 0),
@@ -1,6 +1,8 @@
1
1
  import os
2
2
  import re
3
3
  import time
4
+
5
+ from sqlalchemy import __version__ as sqlalchemy_version
4
6
  from contextlib import contextmanager
5
7
  from typing import Any, Callable, Dict, Generator, Optional
6
8
 
@@ -15,6 +17,7 @@ from sqlalchemy import (
15
17
  text,
16
18
  )
17
19
  from sqlalchemy import create_engine
20
+ from sqlalchemy.engine import make_url
18
21
  from sqlalchemy.orm import Session, sessionmaker, DeclarativeBase
19
22
 
20
23
  # ——— Function to get the database URL dynamically ———
@@ -44,6 +47,60 @@ def _env_bool(name: str, default: bool) -> bool:
44
47
  return raw.strip().lower() in ("1", "true", "yes", "on")
45
48
 
46
49
 
50
+ def redact_database_url(url: str | None) -> str:
51
+ """``url`` with the password masked, safe to log or show on an error page.
52
+
53
+ Falls back to a fixed placeholder when the URL cannot be parsed, so no raw
54
+ credentials leak out of an unparseable ``DATABASE_URL``.
55
+ """
56
+ if not url:
57
+ return repr(url)
58
+ try:
59
+ return make_url(url).render_as_string(hide_password=True)
60
+ except Exception: # noqa: BLE001 — unparseable URL: show nothing of it
61
+ return "<unparseable DATABASE_URL>"
62
+
63
+
64
+ class DatabaseDriverMissingError(ModuleNotFoundError):
65
+ """The DBAPI module that ``DATABASE_URL`` resolves to is not installed.
66
+
67
+ A configuration error, not a transient one: :func:`wait_for_database` gives
68
+ up at once, where it would otherwise retry for about 170s.
69
+ """
70
+
71
+
72
+ def _driver_hint(url: str, exc: ModuleNotFoundError) -> str:
73
+ """Explain a missing DBAPI module in terms of the ``DATABASE_URL`` that asked for it."""
74
+ try:
75
+ u = make_url(url)
76
+ backend, driver = u.get_backend_name(), u.get_driver_name()
77
+ explicit = "+" in u.drivername
78
+ except Exception: # noqa: BLE001
79
+ return f"Database driver module {exc.name!r} is not installed ({exc})."
80
+ msg = (
81
+ f"DATABASE_URL {redact_database_url(url)!r} uses the {backend!r} dialect with the "
82
+ f"{driver!r} driver, but its module {exc.name!r} is not installed."
83
+ )
84
+ if not explicit:
85
+ msg += (
86
+ f" The URL names no driver ('{backend}://'), so SQLAlchemy "
87
+ f"{sqlalchemy_version} picked its default, {driver!r}. Name the driver you "
88
+ f"ship explicitly, e.g. '{backend}+<driver>://...'"
89
+ )
90
+ if backend == "postgresql":
91
+ msg += (
92
+ " ('postgresql+psycopg2://' for psycopg2-binary, "
93
+ "'postgresql+psycopg://' for psycopg v3)."
94
+ " SQLAlchemy 2.1 changed the bare postgresql:// default from psycopg2 "
95
+ "to psycopg v3."
96
+ )
97
+ else:
98
+ msg += "."
99
+ else:
100
+ msg += f" Install the package that provides {exc.name!r}, or change the driver in the URL."
101
+ return msg
102
+
103
+
47
104
  # ——— Module-level Engine & SessionLocal ———
48
105
  def _build_engine(url: str):
49
106
  # Pool sizing is per-process: each app process (e.g. each uvicorn worker /
@@ -52,6 +109,15 @@ def _build_engine(url: str):
52
109
  # hardcoded pool_size=100 was far larger than most apps need and could
53
110
  # exhaust a shared DB's max_connections; these are now env-configurable with
54
111
  # smaller, saner defaults. Raise DATABASE_POOL_SIZE for high-concurrency apps.
112
+ try:
113
+ return _create_engine(url)
114
+ except ModuleNotFoundError as exc:
115
+ # A missing DBAPI is raised straight out of create_engine() as a bare
116
+ # "No module named 'psycopg'", with no hint that the URL chose it.
117
+ raise DatabaseDriverMissingError(_driver_hint(url, exc), name=exc.name) from exc
118
+
119
+
120
+ def _create_engine(url: str):
55
121
  return create_engine(
56
122
  url,
57
123
  connect_args={"check_same_thread": False} if url.startswith("sqlite") else {},
@@ -72,7 +138,7 @@ except Exception as exc:
72
138
  # makes create_engine raise at import time. Don't crash the whole app —
73
139
  # leave the engine unset so the failure surfaces later through
74
140
  # ensure_engine() where it can be caught and rendered as an error page.
75
- logger.error(f"Failed to create database engine for {DATABASE_URL!r}: {exc}")
141
+ logger.error(f"Failed to create database engine for {redact_database_url(DATABASE_URL)}: {exc}")
76
142
  _engine = None
77
143
 
78
144
 
@@ -167,6 +233,10 @@ def wait_for_database(
167
233
  if attempt > 1:
168
234
  logger.info(f"Database connected after {attempt} attempts (~{waited:.0f}s)")
169
235
  return None
236
+ except DatabaseDriverMissingError as e:
237
+ # Configuration, not readiness: no amount of waiting installs a driver.
238
+ logger.error(f"Database driver missing, not retrying: {e}")
239
+ return e
170
240
  except Exception as e: # noqa: BLE001 — any driver error means "not ready yet"
171
241
  last_exc = e
172
242
  if attempt < max_retries:
@@ -30,7 +30,15 @@ class DegradedModeHandler:
30
30
 
31
31
  @property
32
32
  def suggestions(self) -> list[str]:
33
+ from fastpluggy.core.database import DatabaseDriverMissingError
34
+
33
35
  msg = self.error_message.lower()
36
+ if isinstance(self.exception, DatabaseDriverMissingError):
37
+ return [
38
+ "The database driver named by DATABASE_URL is not installed. The message above names the missing module.",
39
+ "Name the driver you ship in the URL, e.g. postgresql+psycopg2:// (psycopg2-binary) or postgresql+psycopg:// (psycopg v3).",
40
+ "This is a configuration error: restarting will not help until the URL or the installed packages change.",
41
+ ]
34
42
  if "no such table" in msg:
35
43
  return ["Run database migrations to create missing tables."]
36
44
  elif any(
@@ -18,18 +18,34 @@ class DegradedModeMiddleware:
18
18
  succeeds.
19
19
 
20
20
  While ``not fastpluggy.is_ready`` every path serves the degraded-mode page
21
- directly — this doubles as a readiness signal a container healthcheck can
21
+ directly — this doubles as a READINESS signal a container healthcheck can
22
22
  already poll (any path, no dedicated endpoint needed). Recovering is just
23
23
  flipping ``is_ready`` back to ``True``: nothing was ever removed from the
24
24
  app, so there is nothing to rebuild.
25
+
26
+ ``/health`` is the one exemption, and it is not a special case so much as the
27
+ other half of the same idea. This middleware answers "can the app serve?";
28
+ liveness answers "is the process there at all?". Gating liveness behind
29
+ readiness collapses the two, and an orchestrator that restarts on a failed
30
+ liveness probe would then kill a degraded app on every check — including one
31
+ that is seconds away from self-healing, which is exactly what the
32
+ degraded-mode reprobe exists to do.
25
33
  """
26
34
 
35
+ #: Paths that must answer even while the app is degraded. Liveness only —
36
+ #: anything that reads state belongs behind the gate.
37
+ LIVENESS_PATHS = frozenset({"/health"})
38
+
27
39
  def __init__(self, app: ASGIApp, fastpluggy: "FastPluggy"):
28
40
  self.app = app
29
41
  self._fastpluggy = fastpluggy
30
42
 
31
43
  async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
32
- if scope["type"] != "http" or self._fastpluggy.is_ready:
44
+ if (
45
+ scope["type"] != "http"
46
+ or self._fastpluggy.is_ready
47
+ or scope.get("path") in self.LIVENESS_PATHS
48
+ ):
33
49
  await self.app(scope, receive, send)
34
50
  return
35
51
 
@@ -2,6 +2,7 @@
2
2
  FastPluggyEventBus — lightweight, thread-safe, string-keyed event bus.
3
3
  """
4
4
  import asyncio
5
+ import contextvars
5
6
  import inspect
6
7
  import threading
7
8
  import traceback
@@ -24,6 +25,15 @@ class _Sub:
24
25
  priority: int = 0
25
26
  once: bool = False
26
27
  predicate: Callable[[Event], bool] | None = None
28
+ owner: str | None = None
29
+
30
+
31
+ # Name of the plugin whose lifecycle hook is currently running (set by the module
32
+ # manager via ``FastPluggyEventBus.owned_by``). Subscriptions made while it is set
33
+ # are tagged with that owner so a reload can drop them before the hook re-runs.
34
+ _current_owner: contextvars.ContextVar[str | None] = contextvars.ContextVar(
35
+ "fastpluggy_event_owner", default=None
36
+ )
27
37
 
28
38
 
29
39
  # ---------------------------------------------------------------------------
@@ -118,7 +128,8 @@ class FastPluggyEventBus:
118
128
  predicate: Called before the listener; skip if it returns ``False``.
119
129
  """
120
130
  def _register(fn: Callable) -> Callable:
121
- sub = _Sub(fn, priority=priority, once=once, predicate=predicate)
131
+ sub = _Sub(fn, priority=priority, once=once, predicate=predicate,
132
+ owner=_current_owner.get())
122
133
  with self._lock:
123
134
  arr = self._listeners.setdefault(event_name, [])
124
135
  arr.append(sub)
@@ -158,7 +169,8 @@ class FastPluggyEventBus:
158
169
 
159
170
  fast_pluggy.events.on_namespace("user", audit_handler)
160
171
  """
161
- sub = _Sub(listener, priority=priority, once=once, predicate=predicate)
172
+ sub = _Sub(listener, priority=priority, once=once, predicate=predicate,
173
+ owner=_current_owner.get())
162
174
  with self._lock:
163
175
  self._ns_listeners.append((prefix, sub))
164
176
  self._ns_listeners.sort(key=lambda t: t[1].priority, reverse=True)
@@ -171,6 +183,56 @@ class FastPluggyEventBus:
171
183
  if not (p == prefix and s.fn is listener)
172
184
  ]
173
185
 
186
+ # ------------------------------------------------------------------
187
+ # Ownership (plugin reload hygiene)
188
+ # ------------------------------------------------------------------
189
+
190
+ @staticmethod
191
+ @contextmanager
192
+ def owned_by(owner: str):
193
+ """
194
+ Tag every subscription made inside the block with *owner*.
195
+
196
+ Core wraps each plugin lifecycle hook in this, so listeners a plugin
197
+ registers in ``on_load_complete`` are attributed to it and can be dropped
198
+ with :meth:`off_owner` / :meth:`clear_owned` before the hook runs again.
199
+ """
200
+ token = _current_owner.set(owner)
201
+ try:
202
+ yield
203
+ finally:
204
+ _current_owner.reset(token)
205
+
206
+ def off_owner(self, owner: str) -> int:
207
+ """Remove every listener (exact + namespace) registered by *owner*. Returns the count."""
208
+ return self._remove_where(lambda s: s.owner == owner)
209
+
210
+ def clear_owned(self) -> int:
211
+ """
212
+ Remove every listener registered by any plugin hook; keep core / unowned ones.
213
+
214
+ Called at the start of ``FastPluggy.load_app()``: a reload re-instantiates
215
+ plugins and re-runs ``on_load_complete``, so without this each settings
216
+ save / enable / disable stacks another copy of every plugin listener
217
+ (fast_pluggy#30). Returns the number of listeners removed.
218
+ """
219
+ return self._remove_where(lambda s: s.owner is not None)
220
+
221
+ def _remove_where(self, pred: Callable[[_Sub], bool]) -> int:
222
+ removed = 0
223
+ with self._lock:
224
+ for name in list(self._listeners):
225
+ kept = [s for s in self._listeners[name] if not pred(s)]
226
+ removed += len(self._listeners[name]) - len(kept)
227
+ if kept:
228
+ self._listeners[name] = kept
229
+ else:
230
+ del self._listeners[name]
231
+ kept_ns = [(p, s) for p, s in self._ns_listeners if not pred(s)]
232
+ removed += len(self._ns_listeners) - len(kept_ns)
233
+ self._ns_listeners = kept_ns
234
+ return removed
235
+
174
236
  @contextmanager
175
237
  def subscribed(
176
238
  self,
@@ -1,4 +1,5 @@
1
1
  from functools import wraps
2
+ import warnings
2
3
 
3
4
  def menu_entry(
4
5
  label: str,
@@ -9,6 +10,7 @@ def menu_entry(
9
10
  divider_before: bool = False,
10
11
  divider_after: bool = False,
11
12
  permission: str | None = None,
13
+ required_role: str | None = None,
12
14
  group: str | None = None,
13
15
  badge: str | None = None,
14
16
  badge_color: str | None = None,
@@ -19,6 +21,13 @@ def menu_entry(
19
21
 
20
22
  Args:
21
23
  group: Section group name for sidebar rendering (e.g. "Overview", "System").
24
+ permission: **Deprecated** — not enforced by core; use ``required_role`` instead.
25
+ Passing it emits a ``DeprecationWarning``. Retained (and still flows through
26
+ ``to_dict()``) only for backward compatibility.
27
+ required_role: Role the current user must hold for this item to render. The
28
+ check is delegated to the active auth backend's ``user_has_role`` (default:
29
+ scope membership, with the admin/super-user seeing every item), so the
30
+ semantics are customizable per app rather than hardcoded to a roles array.
22
31
  badge: Badge text displayed on the menu item (e.g. "3", "NEW", "●").
23
32
  badge_color: CSS color class for the badge: "success", "danger", "warning", "info".
24
33
  badge_animate: If True, the badge blinks (useful for live indicators).
@@ -34,6 +43,14 @@ def menu_entry(
34
43
  """
35
44
 
36
45
  def decorator(func):
46
+ if permission is not None:
47
+ warnings.warn(
48
+ "menu_entry(permission=...) is deprecated and not enforced by core; "
49
+ "use required_role=... instead (checked via the auth backend's "
50
+ "user_has_role). The permission field will be removed in a future release.",
51
+ DeprecationWarning,
52
+ stacklevel=2,
53
+ )
37
54
  func._menu_entry = {
38
55
  "label": label,
39
56
  "type": type,
@@ -43,6 +60,7 @@ def menu_entry(
43
60
  "divider_before": divider_before,
44
61
  "divider_after": divider_after,
45
62
  "permission": permission,
63
+ "required_role": required_role,
46
64
  "group": group,
47
65
  "badge": badge,
48
66
  "badge_color": badge_color,
@@ -241,6 +241,50 @@ class MenuManager:
241
241
 
242
242
  return sorted_flat
243
243
 
244
+ def get_hidden_items(self, menu_types: tuple[str, ...] = ("main", "user", "admin")) -> list[dict[str, Any]]:
245
+ """Return the navigable pages that a menu override has hidden.
246
+
247
+ ``get_menu``/``get_flat_menu`` drop an entry whose override has
248
+ ``hidden=True`` (and a hidden dropdown takes its children with it), so
249
+ the page becomes unreachable from the UI. This lists exactly those
250
+ pages so the admin can still open them (Manage Plugins page).
251
+
252
+ Each entry: ``label`` (label override applied), ``url``, ``icon``,
253
+ ``menu_type``. Items without a real URL (``#`` parents) are skipped;
254
+ URLs are de-duplicated; order follows the menu order.
255
+ """
256
+ hidden: list[dict[str, Any]] = []
257
+ seen: set[str] = set()
258
+
259
+ def _add(item: MenuItem, menu_type: str) -> None:
260
+ if not item.url or item.url == "#" or item.url in seen:
261
+ return
262
+ seen.add(item.url)
263
+ override = self._overrides.get((menu_type, item.url))
264
+ hidden.append({
265
+ "label": (override.label_override if override and override.label_override else item.label),
266
+ "url": item.url,
267
+ "icon": item.icon,
268
+ "menu_type": menu_type,
269
+ })
270
+
271
+ def _is_hidden(item: MenuItem, menu_type: str) -> bool:
272
+ override = self._overrides.get((menu_type, item.url or ""))
273
+ return bool(override and override.hidden)
274
+
275
+ for menu_type in menu_types:
276
+ for item in self.menus.get(menu_type, []):
277
+ if _is_hidden(item, menu_type):
278
+ _add(item, menu_type)
279
+ # A hidden dropdown hides all of its children with it.
280
+ for child in item.children:
281
+ _add(child, menu_type)
282
+ continue
283
+ for child in item.children:
284
+ if _is_hidden(child, menu_type):
285
+ _add(child, menu_type)
286
+ return hidden
287
+
244
288
  def update_menu_from_routes(self, app_routes: list[APIRoute],
245
289
  module_manager: BaseModuleManager, # <— now pass this in
246
290
  menu_type: str = "main", ):
@@ -308,6 +352,7 @@ class MenuManager:
308
352
  icon=entry.get("icon"),
309
353
  parent_name=parent,
310
354
  permission=entry.get("permission"),
355
+ required_role=entry.get("required_role"),
311
356
  position=entry.get("position"),
312
357
  section_title=entry.get("section_title"),
313
358
  divider_before=entry.get("divider_before", False),