corelp 1.0.32__tar.gz → 1.0.34__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 (50) hide show
  1. {corelp-1.0.32 → corelp-1.0.34}/PKG-INFO +1 -3
  2. {corelp-1.0.32 → corelp-1.0.34}/pyproject.toml +2 -2
  3. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/Section_LP/Section.py +1 -1
  4. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/main_LP/main.py +1 -1
  5. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/print_LP/print.py +10 -6
  6. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/user_inputs_LP/test_user_inputs.py +2 -1
  7. corelp-1.0.34/src/corelp/modules/user_inputs_LP/user_inputs.py +73 -0
  8. corelp-1.0.32/src/corelp/modules/user_inputs_LP/user_inputs.py +0 -81
  9. {corelp-1.0.32 → corelp-1.0.34}/README.md +0 -0
  10. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/__init__.py +0 -0
  11. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/icon_pythonLP.png +0 -0
  12. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/Path_LP/Path.py +0 -0
  13. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/Path_LP/__init__.py +0 -0
  14. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/Path_LP/test_Path.py +0 -0
  15. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/Section_LP/__init__.py +0 -0
  16. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/Section_LP/test_Section.py +0 -0
  17. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/__init__.py +0 -0
  18. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/debug_LP/__init__.py +0 -0
  19. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/debug_LP/debug.py +0 -0
  20. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/debug_LP/test_debug.py +0 -0
  21. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/folder_LP/__init__.py +0 -0
  22. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/folder_LP/folder.py +0 -0
  23. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/folder_LP/test_folder.py +0 -0
  24. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/getmodule_LP/__init__.py +0 -0
  25. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/getmodule_LP/getmodule.py +0 -0
  26. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/kwargsself_LP/__init__.py +0 -0
  27. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/kwargsself_LP/kwargsself.py +0 -0
  28. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/kwargsself_LP/test_kwargsself.py +0 -0
  29. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/main_LP/__init__.py +0 -0
  30. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/main_LP/test_main.py +0 -0
  31. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/print_LP/__init__.py +0 -0
  32. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/print_LP/test_print.py +0 -0
  33. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/prop_LP/__init__.py +0 -0
  34. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/prop_LP/prop.py +0 -0
  35. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/prop_LP/test_prop.py +0 -0
  36. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/rfrom_LP/__init__.py +0 -0
  37. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/rfrom_LP/rfrom.py +0 -0
  38. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/rfrom_LP/test_rfrom.py +0 -0
  39. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/selfkwargs_LP/__init__.py +0 -0
  40. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/selfkwargs_LP/selfkwargs.py +0 -0
  41. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/selfkwargs_LP/test_selfkwargs.py +0 -0
  42. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/test_LP/__init__.py +0 -0
  43. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/test_LP/test.py +0 -0
  44. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/test_LP/test_test.py +0 -0
  45. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules/user_inputs_LP/__init__.py +0 -0
  46. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/modules.json +0 -0
  47. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/py.typed +0 -0
  48. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/pythonLP.png:Zone.Identifier +0 -0
  49. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/scripts/__init__.py +0 -0
  50. {corelp-1.0.32 → corelp-1.0.34}/src/corelp/scripts.json +0 -0
@@ -1,9 +1,7 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: corelp
3
- Version: 1.0.32
3
+ Version: 1.0.34
4
4
  Summary: A library that gathers core functions for python programming.
5
- Requires-Dist: ipython
6
- Requires-Dist: ipywidgets
7
5
  Requires-Dist: joblib
8
6
  Requires-Dist: rich
9
7
  Requires-Python: >=3.12
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "corelp"
3
- version = "1.0.32"
3
+ version = "1.0.34"
4
4
  description = "A library that gathers core functions for python programming."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
- dependencies = [ "ipython", "ipywidgets", "joblib", "rich",]
7
+ dependencies = [ "joblib", "rich",]
8
8
 
9
9
  [build-system]
10
10
  requires = [ "uv_build>=0.8.8,<0.9.0",]
@@ -14,7 +14,7 @@ This class defines decorator instances allowing to create section functions.
14
14
 
15
15
  # %% Libraries
16
16
  from corelp import print, folder, selfkwargs, kwargsself
17
- from dataclasses import dataclass, field
17
+ from dataclasses import dataclass
18
18
  import pickle
19
19
  import joblib
20
20
  from pathlib import Path
@@ -25,7 +25,7 @@ import types
25
25
 
26
26
 
27
27
  # %% Function
28
- def main() :
28
+ def main(*, import_path:str=None, export_path:str=None, new:bool=True, bulk=None, overnight:bool=False, run_name:str=None) :
29
29
  '''
30
30
  This function can decorate the main function of a script.
31
31
  User inputs parameters shoud be put in the beginning of the main file, and the decorated function will recognize them.
@@ -52,8 +52,8 @@ class Print() :
52
52
 
53
53
  Parameters
54
54
  ----------
55
- string : object
56
- The object to print. Its :meth:`__str__` representation is used.
55
+ *strings : tuple
56
+ The objects to print. Its :meth:`__str__` representation is used.
57
57
  verbose : bool, optional
58
58
  If ``True`` (default), printing is performed.
59
59
  If ``False``, printing is skipped unless overridden.
@@ -135,14 +135,17 @@ class Print() :
135
135
  """
136
136
 
137
137
  # Main function
138
- def __call__(self, string, verbose=None, *, return_string=False, file=None, mode='a', end='\n', **kwargs) :
138
+ def __call__(self, *strings, verbose=None, return_string=False, file=None, mode='a', end='\n', **kwargs) :
139
+
139
140
  # Muting
140
141
  verbose = verbose if verbose is not None else self.verbose
141
142
  if not verbose :
142
143
  return None
143
144
 
145
+ # Formatting string
146
+ string = ", ".join([str(string) for string in strings]) + end
147
+
144
148
  # Printing markdown
145
- string = str(string) + end
146
149
  self.print(Markdown(string), **kwargs)
147
150
 
148
151
  # Writting to file
@@ -170,7 +173,7 @@ class Print() :
170
173
  def log(self) :
171
174
  return self.console.log
172
175
  pyprint = pyprint # python print
173
- richprint = richprint # rich print
176
+ richprint = richprint # rich prints
174
177
 
175
178
 
176
179
 
@@ -281,7 +284,8 @@ class Print() :
281
284
  AvgLoopTimeColumn(),
282
285
  TimeRemainingColumn(),
283
286
  EndTimeColumn(),
284
- transient=False
287
+ transient=False,
288
+ console=self.console
285
289
  )
286
290
 
287
291
  _bars : dict = field(default=None, repr=False)
@@ -34,7 +34,8 @@ def test_user_inputs() :
34
34
  raise ValueError(f'{inputs} should be dict(a=1)')
35
35
  user_inputs() #init
36
36
  b = 2
37
- if user_inputs() != {'b': 2} :
37
+ inputs = user_inputs()
38
+ if inputs != {'b': 2} :
38
39
  raise ValueError(f'{inputs} should be dict(b=2)')
39
40
 
40
41
 
@@ -0,0 +1,73 @@
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 : coreLP
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
+
18
+
19
+
20
+ # %% Function
21
+
22
+ def user_inputs(reset=False) :
23
+ r"""
24
+ Return a dictionary of variables defined by the user in the interactive environment.
25
+
26
+ Parameters
27
+ ----------
28
+ reset : bool
29
+ True to set as first call.
30
+
31
+ Returns
32
+ -------
33
+ dict
34
+ A dictionary containing the user's currently defined variables.
35
+
36
+ Examples
37
+ --------
38
+ >>> from corelp import user_inputs
39
+ >>> user_inputs(True) # First call (initializes and clears import-related variables)
40
+ None
41
+ >>> a = 1 # User defines a variable
42
+ >>> user_inputs() # Now returns: {'a': 1}
43
+ {'a': 1}
44
+ """
45
+ frame = inspect.currentframe().f_back
46
+ ns = {**frame.f_globals, **frame.f_locals}
47
+
48
+ # ---- Filter user variables (ignore internals starting with "_") ----
49
+ ns = {key: value for key, value in ns.items() if not key.startswith("_")}
50
+
51
+ # Validate status
52
+ if reset :
53
+ user_inputs.cache = None
54
+
55
+ # Case when user_inputs is on top : cache = None
56
+ if user_inputs.cache is None :
57
+ user_inputs.cache = ns
58
+ return
59
+
60
+ # Case when user_inputs is at bottom : cache = dict
61
+ else :
62
+ updated = { key: value for key, value in ns.items() if key not in user_inputs.cache or user_inputs.cache[key] is not value}
63
+ user_inputs.cache = None
64
+ return updated
65
+
66
+ user_inputs.cache = None
67
+
68
+
69
+
70
+ # %% Test function run
71
+ if __name__ == "__main__":
72
+ from corelp import test
73
+ test(__file__)
@@ -1,81 +0,0 @@
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 : coreLP
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
- from IPython import get_ipython
18
-
19
-
20
-
21
- # %% Function
22
- _user_inputs = {} # User inputs cache
23
-
24
- def user_inputs() :
25
- r"""
26
- Return a dictionary of variables defined by the user in the interactive
27
- environment.
28
-
29
- This function is intended for use inside other functions via
30
- ``function(**user_inputs())``.
31
- **It should not be used to store its return value**, e.g. **do not do**::
32
-
33
- variable = user_inputs()
34
-
35
- Instead, call it directly when needed.
36
-
37
- Returns
38
- -------
39
- dict
40
- A dictionary containing the user's currently defined variables.
41
-
42
- Examples
43
- --------
44
- >>> from corelp import user_inputs
45
- >>> user_inputs() # First call (initializes and clears import-related variables)
46
- {}
47
- >>> a = 1 # User defines a variable
48
- >>> user_inputs() # Now returns: {'a': 1}
49
- {'a': 1}
50
- """
51
-
52
- # ---- Detect execution environment ----
53
- ipy = get_ipython()
54
-
55
- if ipy is not None:
56
- # Running in IPython or Jupyter
57
- ns = ipy.user_ns
58
- else:
59
- # Running in normal Python script
60
- frame = inspect.currentframe().f_back
61
- ns = {**frame.f_globals, **frame.f_locals}
62
-
63
- # ---- Filter user variables (ignore internals starting with "_") ----
64
- ns = {k: v for k, v in ns.items() if not k.startswith("_")}
65
-
66
- # ---- Return only new or updated variables ----
67
- updated = {
68
- k: v
69
- for k, v in ns.items()
70
- if k not in _user_inputs or _user_inputs[k] is not v
71
- }
72
-
73
- _user_inputs.update(updated)
74
- return updated
75
-
76
-
77
-
78
- # %% Test function run
79
- if __name__ == "__main__":
80
- from corelp import test
81
- test(__file__)
File without changes
File without changes
File without changes
File without changes
File without changes