splent-framework 1.4.3__tar.gz → 1.4.4__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 (94) hide show
  1. {splent_framework-1.4.3/src/splent_framework.egg-info → splent_framework-1.4.4}/PKG-INFO +1 -1
  2. {splent_framework-1.4.3 → splent_framework-1.4.4}/pyproject.toml +1 -1
  3. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/blueprints/base_blueprint.py +29 -0
  4. splent_framework-1.4.4/src/splent_framework/refinement/__init__.py +73 -0
  5. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/services/service_locator.py +28 -0
  6. {splent_framework-1.4.3 → splent_framework-1.4.4/src/splent_framework.egg-info}/PKG-INFO +1 -1
  7. splent_framework-1.4.3/src/splent_framework/utils/__init__.py +0 -0
  8. {splent_framework-1.4.3 → splent_framework-1.4.4}/LICENSE +0 -0
  9. {splent_framework-1.4.3 → splent_framework-1.4.4}/README.md +0 -0
  10. {splent_framework-1.4.3 → splent_framework-1.4.4}/setup.cfg +0 -0
  11. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/_init__.py +0 -0
  12. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/app_factory.py +0 -0
  13. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/blueprints/__init__.py +0 -0
  14. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/bootstraps/__init__.py +0 -0
  15. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/bootstraps/locustfile_bootstrap.py +0 -0
  16. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/configuration/__init__.py +0 -0
  17. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/configuration/configuration.py +0 -0
  18. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/configuration/default_config.py +0 -0
  19. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/context/__init__.py +0 -0
  20. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/context/context_manager.py +0 -0
  21. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/db.py +0 -0
  22. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/decorators/__init__.py +0 -0
  23. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/decorators/decorators.py +0 -0
  24. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/environment/__init__.py +0 -0
  25. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/environment/host.py +0 -0
  26. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/fixtures/__init__.py +0 -0
  27. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/fixtures/fixtures.py +0 -0
  28. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/helpers/__init__.py +0 -0
  29. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/helpers/test_helpers_auth.py +0 -0
  30. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/hooks/__init__.py +0 -0
  31. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/hooks/template_hooks.py +0 -0
  32. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/locust/__init__.py +0 -0
  33. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/locust/common.py +0 -0
  34. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/__init__.py +0 -0
  35. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/config_manager.py +0 -0
  36. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/db_manager.py +0 -0
  37. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/error_handler_manager.py +0 -0
  38. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/feature_loader.py +0 -0
  39. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/feature_manager.py +0 -0
  40. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/feature_order.py +0 -0
  41. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/jinja_manager.py +0 -0
  42. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/locale_manager.py +0 -0
  43. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/logging_manager.py +0 -0
  44. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/migration_manager.py +0 -0
  45. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/namespace_manager.py +0 -0
  46. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/session_manager.py +0 -0
  47. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/managers/task_queue_manager.py +0 -0
  48. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/migrations/__init__.py +0 -0
  49. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/migrations/feature_env.py +0 -0
  50. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/namespaces/__init__.py +0 -0
  51. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/refinement/model_extender.py +0 -0
  52. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/refinement/parser.py +0 -0
  53. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/refinement/registry.py +0 -0
  54. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/refinement/validator.py +0 -0
  55. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/repositories/BaseRepository.py +0 -0
  56. {splent_framework-1.4.3/src/splent_framework/refinement → splent_framework-1.4.4/src/splent_framework/repositories}/__init__.py +0 -0
  57. {splent_framework-1.4.3/src/splent_framework/repositories → splent_framework-1.4.4/src/splent_framework/resources}/__init__.py +0 -0
  58. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/resources/generic_resource.py +0 -0
  59. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/seeders/BaseSeeder.py +0 -0
  60. {splent_framework-1.4.3/src/splent_framework/resources → splent_framework-1.4.4/src/splent_framework/seeders}/__init__.py +0 -0
  61. {splent_framework-1.4.3/src/splent_framework/seeders → splent_framework-1.4.4/src/splent_framework/selenium}/__init__.py +0 -0
  62. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/selenium/common.py +0 -0
  63. {splent_framework-1.4.3/src/splent_framework/selenium → splent_framework-1.4.4/src/splent_framework/serialisers}/__init__.py +0 -0
  64. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/serialisers/serializer.py +0 -0
  65. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/services/BaseService.py +0 -0
  66. {splent_framework-1.4.3/src/splent_framework/serialisers → splent_framework-1.4.4/src/splent_framework/services}/__init__.py +0 -0
  67. {splent_framework-1.4.3/src/splent_framework/services → splent_framework-1.4.4/src/splent_framework/signals}/__init__.py +0 -0
  68. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/signals/registry.py +0 -0
  69. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/signals/signal_utils.py +0 -0
  70. {splent_framework-1.4.3/src/splent_framework/signals → splent_framework-1.4.4/src/splent_framework/utils}/__init__.py +0 -0
  71. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/utils/app_loader.py +0 -0
  72. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/utils/feature_utils.py +0 -0
  73. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/utils/path_utils.py +0 -0
  74. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework/utils/pyproject_reader.py +0 -0
  75. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework.egg-info/SOURCES.txt +0 -0
  76. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework.egg-info/dependency_links.txt +0 -0
  77. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework.egg-info/requires.txt +0 -0
  78. {splent_framework-1.4.3 → splent_framework-1.4.4}/src/splent_framework.egg-info/top_level.txt +0 -0
  79. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_base_blueprint_security.py +0 -0
  80. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_base_repository.py +0 -0
  81. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_config_manager.py +0 -0
  82. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_config_manager_return.py +0 -0
  83. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_context_manager.py +0 -0
  84. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_default_config.py +0 -0
  85. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_error_handler_manager.py +0 -0
  86. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_feature_manager_parse.py +0 -0
  87. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_feature_order.py +0 -0
  88. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_feature_utils.py +0 -0
  89. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_generic_resource.py +0 -0
  90. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_migration_manager.py +0 -0
  91. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_namespace_manager.py +0 -0
  92. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_pyproject_reader.py +0 -0
  93. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_pyproject_reader_env.py +0 -0
  94. {splent_framework-1.4.3 → splent_framework-1.4.4}/tests/test_refinement.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splent_framework
3
- Version: 1.4.3
3
+ Version: 1.4.4
4
4
  Summary: SPLENT-FRAMEWORK is a set of libraries for agile product development within SPLENT.
5
5
  Author-email: DiversoLab <diversolab@us.es>
6
6
  Project-URL: Homepage, https://github.com/diverso-lab/splent_framework
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "splent_framework"
7
- version = "1.4.3"
7
+ version = "1.4.4"
8
8
  description = "SPLENT-FRAMEWORK is a set of libraries for agile product development within SPLENT."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -5,6 +5,35 @@ import sys
5
5
  import importlib
6
6
 
7
7
 
8
+ def create_blueprint(import_name: str, **kwargs) -> "BaseBlueprint":
9
+ """Create a BaseBlueprint with the name inferred from the module.
10
+
11
+ Extracts the short name from the module path::
12
+
13
+ "splent_io.splent_feature_notes_tags" → "notes_tags"
14
+ "splent_io.splent_feature_auth" → "auth"
15
+
16
+ Parameters
17
+ ----------
18
+ import_name : str
19
+ Pass ``__name__`` from the feature's ``__init__.py``.
20
+ **kwargs
21
+ Extra arguments forwarded to :class:`BaseBlueprint`
22
+ (e.g. ``url_prefix``, ``static_folder``).
23
+
24
+ Returns
25
+ -------
26
+ BaseBlueprint
27
+ """
28
+ # "splent_io.splent_feature_notes_tags" → "splent_feature_notes_tags"
29
+ pkg = import_name.rsplit(".", 1)[-1]
30
+ # "splent_feature_notes_tags" → "notes_tags"
31
+ short = (
32
+ pkg.replace("splent_feature_", "") if pkg.startswith("splent_feature_") else pkg
33
+ )
34
+ return BaseBlueprint(short, import_name, **kwargs)
35
+
36
+
8
37
  class BaseBlueprint(Blueprint):
9
38
  def __init__(
10
39
  self,
@@ -0,0 +1,73 @@
1
+ """
2
+ SPLENT Refinement API.
3
+
4
+ High-level helpers for refinement features. Use these in your
5
+ ``init_feature(app)`` instead of calling the lower-level internals directly.
6
+
7
+ Usage::
8
+
9
+ from splent_framework.refinement import refine_model, refine_service
10
+
11
+ from .models import NotesTagsMixin
12
+ from .services import NotesServiceWithTags
13
+
14
+ def init_feature(app):
15
+ refine_model("Notes", NotesTagsMixin)
16
+ refine_service(app, "NotesService", NotesServiceWithTags)
17
+ """
18
+
19
+ from splent_framework.refinement.model_extender import apply_model_mixin
20
+ from splent_framework.services.service_locator import (
21
+ get_service_class,
22
+ register_service,
23
+ )
24
+
25
+
26
+ def refine_model(model_name: str, mixin_cls: type) -> bool:
27
+ """Extend an existing model with a mixin.
28
+
29
+ Injects columns and methods from ``mixin_cls`` into the model
30
+ registered under ``model_name`` in SQLAlchemy's mapper registry.
31
+
32
+ Parameters
33
+ ----------
34
+ model_name : str
35
+ Name of the base model class (e.g. ``"Notes"``).
36
+ mixin_cls : type
37
+ Mixin class containing ``db.Column`` attributes and/or methods.
38
+
39
+ Returns
40
+ -------
41
+ bool
42
+ True if the mixin was applied successfully.
43
+ """
44
+ return apply_model_mixin(model_name, mixin_cls)
45
+
46
+
47
+ def refine_service(app, service_name: str, replacement_cls: type) -> None:
48
+ """Override a registered service with a replacement class.
49
+
50
+ Automatically resolves the base service, sets ``replacement_cls``
51
+ to inherit from it, and registers the replacement under the same name.
52
+
53
+ Parameters
54
+ ----------
55
+ app : Flask
56
+ The Flask application instance.
57
+ service_name : str
58
+ Name of the service to override (e.g. ``"NotesService"``).
59
+ replacement_cls : type
60
+ Replacement class. Will inherit from the base service at runtime.
61
+ """
62
+ base_cls = get_service_class(app, service_name)
63
+
64
+ # Build a class that inherits from the replacement first (so its
65
+ # methods win) and then from the base (so super() chains correctly).
66
+ # This preserves Python 3 implicit super() because the original
67
+ # replacement_cls stays in the MRO.
68
+ merged = type(
69
+ replacement_cls.__name__,
70
+ (replacement_cls, base_cls),
71
+ {},
72
+ )
73
+ register_service(app, service_name, merged)
@@ -59,3 +59,31 @@ def get_service_class(app: Flask, name: str) -> type:
59
59
  def get_all_services(app: Flask) -> dict[str, type]:
60
60
  """Return the full service registry (read-only snapshot)."""
61
61
  return dict(_ensure_registry(app))
62
+
63
+
64
+ def service_proxy(name: str):
65
+ """Return a proxy that resolves the service from the locator on every access.
66
+
67
+ Usage in routes::
68
+
69
+ from splent_framework.services.service_locator import service_proxy
70
+
71
+ notes_service = service_proxy("NotesService")
72
+
73
+ @bp.route("/notes/")
74
+ def index():
75
+ notes = notes_service.get_by_user(current_user.id)
76
+ ...
77
+
78
+ The proxy instantiates a fresh service on each attribute access,
79
+ so it always reflects the current registered class (including
80
+ refinement overrides). It only works inside a Flask request context.
81
+ """
82
+ from werkzeug.local import LocalProxy
83
+ from flask import current_app
84
+
85
+ def _lookup():
86
+ cls = get_service_class(current_app._get_current_object(), name)
87
+ return cls()
88
+
89
+ return LocalProxy(_lookup)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splent_framework
3
- Version: 1.4.3
3
+ Version: 1.4.4
4
4
  Summary: SPLENT-FRAMEWORK is a set of libraries for agile product development within SPLENT.
5
5
  Author-email: DiversoLab <diversolab@us.es>
6
6
  Project-URL: Homepage, https://github.com/diverso-lab/splent_framework