rootlp 0.1.7__py3-none-any.whl

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 (36) hide show
  1. rootlp/__init__.py +23 -0
  2. rootlp/modules/Section_LP/Section.py +177 -0
  3. rootlp/modules/Section_LP/__init__.py +0 -0
  4. rootlp/modules/Section_LP/test_Section.py +44 -0
  5. rootlp/modules/__init__.py +0 -0
  6. rootlp/modules/getfunction_LP/__init__.py +0 -0
  7. rootlp/modules/getfunction_LP/getfunction.py +97 -0
  8. rootlp/modules/getfunction_LP/test_getfunction.py +79 -0
  9. rootlp/modules/main_LP/__init__.py +0 -0
  10. rootlp/modules/main_LP/main.py +437 -0
  11. rootlp/modules/main_LP/test_main.py +74 -0
  12. rootlp/modules/menu_LP/__init__.py +0 -0
  13. rootlp/modules/menu_LP/menu.py +78 -0
  14. rootlp/modules/menu_LP/test_menu.py +79 -0
  15. rootlp/modules/mo_LP/__init__.py +0 -0
  16. rootlp/modules/mo_LP/mo.py +23 -0
  17. rootlp/modules/mo_LP/test_mo.py +79 -0
  18. rootlp/modules/print_LP/__init__.py +0 -0
  19. rootlp/modules/print_LP/print.py +337 -0
  20. rootlp/modules/print_LP/test_print.py +109 -0
  21. rootlp/modules/project_server_LP/__init__.py +0 -0
  22. rootlp/modules/project_server_LP/project_server.py +86 -0
  23. rootlp/modules/project_server_LP/test_project_server.py +79 -0
  24. rootlp/modules/readme_string_LP/__init__.py +0 -0
  25. rootlp/modules/readme_string_LP/readme_string.py +53 -0
  26. rootlp/modules/readme_string_LP/test_readme_string.py +79 -0
  27. rootlp/modules/user_inputs_LP/__init__.py +0 -0
  28. rootlp/modules/user_inputs_LP/test_user_inputs.py +46 -0
  29. rootlp/modules/user_inputs_LP/user_inputs.py +103 -0
  30. rootlp/modules.json +56 -0
  31. rootlp/py.typed +0 -0
  32. rootlp/scripts/__init__.py +0 -0
  33. rootlp/scripts.json +1 -0
  34. rootlp-0.1.7.dist-info/METADATA +41 -0
  35. rootlp-0.1.7.dist-info/RECORD +36 -0
  36. rootlp-0.1.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-01-18
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : rootLP
7
+ # Module : readme_string
8
+
9
+ """
10
+ This module returns the readme file text as a string.
11
+ """
12
+
13
+
14
+
15
+ # %% Libraries
16
+ from pathlib import Path
17
+
18
+
19
+
20
+ # %% Function
21
+ def readme_string(file) :
22
+ '''
23
+ This module returns the readme file text as a string.
24
+
25
+ Parameters
26
+ ----------
27
+ file : str
28
+ __file__ attribute of the main script file.
29
+
30
+ Returns
31
+ -------
32
+ string : str
33
+ README text.
34
+
35
+ Examples
36
+ --------
37
+ >>> from rootlp import readme_string
38
+ ...
39
+ >>> readme_string(__file__) # returns text of the readme file
40
+ '''
41
+
42
+ file = Path(file)
43
+ main_folder = file.parents[1] # main_folder / notebooks / file.py
44
+ readme_file = main_folder / 'README.md'
45
+ if readme_file.exists() :
46
+ return readme_file.read_text()
47
+ raise ValueError(f"{readme_file} read-me file does not exist")
48
+
49
+
50
+ # %% Test function run
51
+ if __name__ == "__main__":
52
+ from corelp import test
53
+ test(__file__)
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-01-18
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : rootLP
7
+ # Module : readme_string
8
+
9
+ """
10
+ This file allows to test readme_string
11
+
12
+ readme_string : This module returns the readme file text as a string.
13
+ """
14
+
15
+
16
+
17
+ # %% Libraries
18
+ from corelp import print, debug
19
+ import pytest
20
+ from rootlp import readme_string
21
+ debug_folder = debug(__file__)
22
+
23
+
24
+
25
+ # %% Function test
26
+ def test_function() :
27
+ '''
28
+ Test readme_string function
29
+ '''
30
+ print('Hello world!')
31
+
32
+
33
+
34
+ # %% Instance fixture
35
+ @pytest.fixture()
36
+ def instance() :
37
+ '''
38
+ Create a new instance at each test function
39
+ '''
40
+ return readme_string()
41
+
42
+ def test_instance(instance) :
43
+ '''
44
+ Test on fixture
45
+ '''
46
+ pass
47
+
48
+
49
+ # %% Returns test
50
+ @pytest.mark.parametrize("args, kwargs, expected, message", [
51
+ #([], {}, None, ""),
52
+ ([], {}, None, ""),
53
+ ])
54
+ def test_returns(args, kwargs, expected, message) :
55
+ '''
56
+ Test readme_string return values
57
+ '''
58
+ assert readme_string(*args, **kwargs) == expected, message
59
+
60
+
61
+
62
+ # %% Error test
63
+ @pytest.mark.parametrize("args, kwargs, error, error_message", [
64
+ #([], {}, None, ""),
65
+ ([], {}, None, ""),
66
+ ])
67
+ def test_errors(args, kwargs, error, error_message) :
68
+ '''
69
+ Test readme_string error values
70
+ '''
71
+ with pytest.raises(error, match=error_message) :
72
+ readme_string(*args, **kwargs)
73
+
74
+
75
+
76
+ # %% Test function run
77
+ if __name__ == "__main__":
78
+ from corelp import test
79
+ test(__file__)
File without changes
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2025-11-30
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : rootLP
7
+ # Module : user_inputs
8
+
9
+ """
10
+ This file allows to test user_inputs
11
+
12
+ user_inputs : Gets last user inputs dictionnary from global variables.
13
+ """
14
+
15
+
16
+
17
+ # %% Libraries
18
+ from corelp import debug
19
+ import pytest
20
+ from corelp import user_inputs
21
+ debug_folder = debug(__file__)
22
+
23
+
24
+
25
+ # %% Function test
26
+ def test_user_inputs() :
27
+ '''
28
+ Test user_inputs function
29
+ '''
30
+ user_inputs() #init
31
+ a = 1
32
+ inputs = user_inputs()
33
+ if inputs != {'a': 1} :
34
+ raise ValueError(f'{inputs} should be dict(a=1)')
35
+ user_inputs() #init
36
+ b = 2
37
+ inputs = user_inputs()
38
+ if inputs != {'b': 2} :
39
+ raise ValueError(f'{inputs} should be dict(b=2)')
40
+
41
+
42
+
43
+ # %% Test function run
44
+ if __name__ == "__main__":
45
+ from corelp import test
46
+ test(__file__)
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2025-11-30
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : rootLP
7
+ # Module : user_inputs
8
+
9
+ """
10
+ Gets last user inputs dictionnary from global variables.
11
+ """
12
+
13
+
14
+
15
+ # %% Libraries
16
+ import inspect
17
+ import marimo as mo
18
+
19
+
20
+
21
+ # %% Function
22
+
23
+ def user_inputs(reset=False) :
24
+ r"""
25
+ Return a dictionary of variables defined by the user in the interactive environment.
26
+
27
+ Parameters
28
+ ----------
29
+ reset : bool or str
30
+ True to set as first call, String value to define a group of parameters
31
+
32
+ Returns
33
+ -------
34
+ dict
35
+ A dictionary containing the user's currently defined variables.
36
+
37
+ Examples
38
+ --------
39
+ >>> from corelp import user_inputs
40
+ >>> user_inputs(True) # First call (initializes and clears import-related variables)
41
+ None
42
+ >>> a = 1 # User defines a variable
43
+ >>> user_inputs() # Now returns: {'a': 1}
44
+ {'a': 1}
45
+ """
46
+ frame = inspect.currentframe().f_back
47
+ ns = {**frame.f_globals, **frame.f_locals}
48
+
49
+ # ---- Filter user variables (ignore internals starting with "_") ----
50
+ ns = {key: value for key, value in ns.items() if not key.startswith("_")}
51
+
52
+ # Validate status
53
+ if reset :
54
+ user_inputs.cache = None
55
+ if isinstance(reset, str) : # Group reset
56
+ user_inputs.current_group = reset
57
+ else :
58
+ user_inputs.current_group = None
59
+ user_inputs.groups_values = {}
60
+ user_inputs.groups_comments = {}
61
+
62
+
63
+ # Case when user_inputs is on top : cache = None
64
+ if user_inputs.cache is None :
65
+ user_inputs.cache = ns
66
+ return
67
+
68
+ # Case when user_inputs is at bottom : cache = dict
69
+ else :
70
+ updated = { key: value for key, value in ns.items() if key not in user_inputs.cache or user_inputs.cache[key] is not value}
71
+ values = {key: value for key, value in updated.items() if not key.endswith('_')}
72
+ comments = {key: value for key, value in updated.items() if key.endswith('_')}
73
+
74
+ # Group values
75
+ if user_inputs.current_group is not None :
76
+ user_inputs.groups_values[user_inputs.current_group] = values
77
+ user_inputs.groups_comments[user_inputs.current_group] = comments
78
+
79
+ # End
80
+ user_inputs.current_group = None
81
+ user_inputs.cache = None
82
+ return values
83
+
84
+ user_inputs.cache = None
85
+ user_inputs.current_group = None
86
+ user_inputs.groups_values = {}
87
+ user_inputs.groups_comments = {}
88
+ user_inputs.export = lambda: (
89
+ {key: value
90
+ for group in user_inputs.groups_values.values()
91
+ for key, value in group.items()},
92
+ mo.md("---\n\n## **Script user inputs**\n\n" + "".join(
93
+ f"### {group_name}\n\n"
94
+ + "".join(f"{ui}\n\n" for ui in group.values())
95
+ for group_name, group in user_inputs.groups_values.items()
96
+ ))
97
+ )
98
+
99
+
100
+ # %% Test function run
101
+ if __name__ == "__main__":
102
+ from corelp import test
103
+ test(__file__)
rootlp/modules.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "Section": {
3
+ "date": "2025-08-28",
4
+ "description": "This class defines decorator instances allowing to create section functions.",
5
+ "module": "modules/Section_LP/Section",
6
+ "object": "Section"
7
+ },
8
+ "getfunction": {
9
+ "date": "2026-01-11",
10
+ "description": "This function is to be used in a script source __init__ file It creates lazy imports of the module imported and defines __getattr__ and __all__ for this source.",
11
+ "module": "modules/getfunction_LP/getfunction",
12
+ "object": "getfunction"
13
+ },
14
+ "main": {
15
+ "date": "2025-08-28",
16
+ "description": "This function can decorate the main function of a script.",
17
+ "module": "modules/main_LP/main",
18
+ "object": "main"
19
+ },
20
+ "menu": {
21
+ "date": "2026-01-18",
22
+ "description": "This module creates a menu on the side of the marimo window.",
23
+ "module": "modules/menu_LP/menu",
24
+ "object": "menu"
25
+ },
26
+ "mo": {
27
+ "date": "2026-01-18",
28
+ "description": "Marimo library shortcut.",
29
+ "module": "modules/mo_LP/mo",
30
+ "object": "mo"
31
+ },
32
+ "print": {
33
+ "date": "2025-08-27",
34
+ "description": "This function overrides python built in print function to add functionnalities.",
35
+ "module": "modules/print_LP/print",
36
+ "object": "print"
37
+ },
38
+ "project_server": {
39
+ "date": "2026-01-18",
40
+ "description": "This module creates and run a custom marimo server for the project.",
41
+ "module": "modules/project_server_LP/project_server",
42
+ "object": "project_server"
43
+ },
44
+ "readme_string": {
45
+ "date": "2026-01-18",
46
+ "description": "This module returns the readme file text as a string.",
47
+ "module": "modules/readme_string_LP/readme_string",
48
+ "object": "readme_string"
49
+ },
50
+ "user_inputs": {
51
+ "date": "2025-11-30",
52
+ "description": "Gets last user inputs dictionnary from global variables.",
53
+ "module": "modules/user_inputs_LP/user_inputs",
54
+ "object": "user_inputs"
55
+ }
56
+ }
rootlp/py.typed ADDED
File without changes
File without changes
rootlp/scripts.json ADDED
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.3
2
+ Name: rootlp
3
+ Version: 0.1.7
4
+ Summary: A library that gathers root functions for custom script execution.
5
+ Requires-Dist: corelp
6
+ Requires-Dist: joblib
7
+ Requires-Dist: marimo
8
+ Requires-Dist: rich
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+
12
+ # rootLP
13
+
14
+ ```text
15
+ Author : Lancelot PINCET
16
+ GitHub : https://github.com/LancelotPincet/rootLP
17
+ HTTPS : https://github.com/LancelotPincet/rootLP.git
18
+ SSH : git@github.com:LancelotPincet/rootLP.git
19
+ PyPI : https://pypi.org/project/rootLP
20
+ Docs : https://rootLP.readthedocs.io
21
+ ```
22
+
23
+ **A library that gathers root functions for custom script execution.**
24
+
25
+ rootLP is available on [PyPI](https://pypi.org/project/rootLP) for pip installs.
26
+ For more information, do not hesitate to consult the [Documentation](https://rootLP.readthedocs.io).
27
+
28
+ ---
29
+
30
+ ## MIT License
31
+
32
+ <details>
33
+ <summary>details</summary>
34
+
35
+ Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
36
+
37
+ The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
38
+
39
+ The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
40
+
41
+ </details>
@@ -0,0 +1,36 @@
1
+ rootlp/__init__.py,sha256=1-79GsWLVLhDZoWO_E0JM7Fwr1oye_8Og0ulB9x46mw,455
2
+ rootlp/modules/Section_LP/Section.py,sha256=fKfDMOGaX-WpMiA-mKUSfXJRqYlgS_i23hcNnsB8ppY,6116
3
+ rootlp/modules/Section_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ rootlp/modules/Section_LP/test_Section.py,sha256=Ew2JfW5vuzugQ2FOc8tRT25s45au653dEfohNcAZPgM,830
5
+ rootlp/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ rootlp/modules/getfunction_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ rootlp/modules/getfunction_LP/getfunction.py,sha256=hB3ZN0tO1QCK85WJeE92_hTvxE8zD6Lj4xVELbKsukY,2504
8
+ rootlp/modules/getfunction_LP/test_getfunction.py,sha256=1qNutF39nZp8OF140t1E6vbUJoq3BgqQ5Al6PznzCnM,1613
9
+ rootlp/modules/main_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ rootlp/modules/main_LP/main.py,sha256=mCm-2IT3Y0U74BpRUNM_VodXJbusv-yVQAIvKF32NvM,16737
11
+ rootlp/modules/main_LP/test_main.py,sha256=X0Zslp99Kzf_zGhYzb_qZPnr3oUFI0Q0yQSKy11SZHo,1734
12
+ rootlp/modules/menu_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ rootlp/modules/menu_LP/menu.py,sha256=Rg6I8WOF7vSZ2MY3K6oROVKlygbf0_VYEJdPwPpu4bU,1671
14
+ rootlp/modules/menu_LP/test_menu.py,sha256=Vc7JgkFgjKntGKuuKh-eje9WB1ulhaMl5U7xWeIb1js,1463
15
+ rootlp/modules/mo_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ rootlp/modules/mo_LP/mo.py,sha256=Ywb1Jl_bWVPOFGj2D9oaEIABcnc7a02doIZ0KorW3Ik,379
17
+ rootlp/modules/mo_LP/test_mo.py,sha256=AT9jWAFFTMiZqp8MgPPjNLuOI_3DpljiMbCtqfU6UuM,1407
18
+ rootlp/modules/print_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ rootlp/modules/print_LP/print.py,sha256=IPmXtH8j5lw2ruFSxnT00ccjwja6Z3uZZhUGnFxoA2U,9364
20
+ rootlp/modules/print_LP/test_print.py,sha256=ZllWhhMtmtC3xulw4E0XPhVLtFT_sKjmodADAgw8L3k,2310
21
+ rootlp/modules/project_server_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ rootlp/modules/project_server_LP/project_server.py,sha256=ehGWQeQgwGkTrt2SidCiHsCC_OBpvdTH3UJDrEPBI1U,2536
23
+ rootlp/modules/project_server_LP/test_project_server.py,sha256=sFWZAPM2J4vWxAOcGU6mPdWkQZYXVoSmHGSn1CjB5Ws,1570
24
+ rootlp/modules/readme_string_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ rootlp/modules/readme_string_LP/readme_string.py,sha256=qZJvfzdyWVfrIzHZfsMSCLOzvFJqRZee7k3ym8iFHx8,1120
26
+ rootlp/modules/readme_string_LP/test_readme_string.py,sha256=iFqIqm0WyGPObyXZdUK47wYWNk1HB65rJd8URFo6lm4,1546
27
+ rootlp/modules/user_inputs_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ rootlp/modules/user_inputs_LP/test_user_inputs.py,sha256=2WnIXsT8bSUSACoOAC-CwijEj55TD0bVllZOA39MSNU,940
29
+ rootlp/modules/user_inputs_LP/user_inputs.py,sha256=149Q8zW3iRs-ze2pF-YI6Ne8SUrM9MgQ7LCENDG16WE,3021
30
+ rootlp/modules.json,sha256=26jONcavFN8ackYpzEfVdBR1x4JDSC96qWjuqN9ezw8,2079
31
+ rootlp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ rootlp/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ rootlp/scripts.json,sha256=RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o,2
34
+ rootlp-0.1.7.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
35
+ rootlp-0.1.7.dist-info/METADATA,sha256=d2aA-wvNEzE1a7sPXchfnLFlN4pFgYVXUJrozNKZ1wg,1751
36
+ rootlp-0.1.7.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.26
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any