pythagoras 0.23.5__tar.gz → 0.23.7__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 (65) hide show
  1. {pythagoras-0.23.5 → pythagoras-0.23.7}/PKG-INFO +4 -3
  2. {pythagoras-0.23.5 → pythagoras-0.23.7}/README.md +3 -2
  3. {pythagoras-0.23.5 → pythagoras-0.23.7}/pyproject.toml +1 -1
  4. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_030_data_portals/data_portal_core_classes.py +1 -1
  5. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/basic_pre_validators.py +14 -4
  6. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/protected_portal_core_classes.py +3 -3
  7. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_090_swarming_portals/swarming_portals.py +1 -1
  8. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_800_signatures_and_converters/__init__.py +1 -1
  9. pythagoras-0.23.5/src/pythagoras/_800_signatures_and_converters/node_signatures.py → pythagoras-0.23.7/src/pythagoras/_800_signatures_and_converters/node_signature.py +2 -0
  10. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/.DS_Store +0 -0
  11. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/__init__.py +0 -0
  12. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/basic_portal_core_classes.py +0 -0
  13. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/exceptions.py +0 -0
  14. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/long_infoname.py +0 -0
  15. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/not_picklable_class.py +0 -0
  16. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/portal_tester.py +0 -0
  17. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_010_basic_portals/post_init_metaclass.py +0 -0
  18. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_020_ordinary_code_portals/__init__.py +0 -0
  19. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_020_ordinary_code_portals/code_normalizer.py +0 -0
  20. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_020_ordinary_code_portals/function_processing.py +0 -0
  21. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_020_ordinary_code_portals/ordinary_decorator.py +0 -0
  22. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_020_ordinary_code_portals/ordinary_portal_core_classes.py +0 -0
  23. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_030_data_portals/__init__.py +0 -0
  24. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_030_data_portals/ready_and_get.py +0 -0
  25. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_030_data_portals/storable_decorator.py +0 -0
  26. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/__init__.py +0 -0
  27. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/exception_processing_tracking.py +0 -0
  28. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/execution_environment_summary.py +0 -0
  29. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/kw_args.py +0 -0
  30. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/logging_decorator.py +0 -0
  31. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/logging_portal_core_classes.py +0 -0
  32. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/notebook_checker.py +0 -0
  33. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/output_capturer.py +0 -0
  34. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_040_logging_code_portals/uncaught_exceptions.py +0 -0
  35. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_050_safe_code_portals/__init__.py +0 -0
  36. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_050_safe_code_portals/safe_decorator.py +0 -0
  37. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_050_safe_code_portals/safe_portal_core_classes.py +0 -0
  38. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_060_autonomous_code_portals/__init__.py +0 -0
  39. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_060_autonomous_code_portals/autonomous_decorators.py +0 -0
  40. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py +0 -0
  41. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py +0 -0
  42. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/__init__.py +0 -0
  43. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/fn_arg_names_checker.py +0 -0
  44. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/list_flattener.py +0 -0
  45. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/package_manager.py +0 -0
  46. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/protected_decorators.py +0 -0
  47. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/system_utils.py +0 -0
  48. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/validation_succesful_const.py +0 -0
  49. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_070_protected_code_portals/validator_fn_classes.py +0 -0
  50. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_080_pure_code_portals/__init__.py +0 -0
  51. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_080_pure_code_portals/pure_core_classes.py +0 -0
  52. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_080_pure_code_portals/pure_decorator.py +0 -0
  53. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_090_swarming_portals/__init__.py +0 -0
  54. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_090_swarming_portals/output_suppressor.py +0 -0
  55. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_100_top_level_API/__init__.py +0 -0
  56. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_100_top_level_API/default_local_portal.py +0 -0
  57. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_100_top_level_API/top_level_API.py +0 -0
  58. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_800_signatures_and_converters/base_16_32_convertors.py +0 -0
  59. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_800_signatures_and_converters/current_date_gmt_str.py +0 -0
  60. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_800_signatures_and_converters/hash_signatures.py +0 -0
  61. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_800_signatures_and_converters/random_signatures.py +0 -0
  62. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_900_project_stats_collector/__init__.py +0 -0
  63. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/_900_project_stats_collector/project_analyzer.py +0 -0
  64. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/__init__.py +0 -0
  65. {pythagoras-0.23.5 → pythagoras-0.23.7}/src/pythagoras/core/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pythagoras
3
- Version: 0.23.5
3
+ Version: 0.23.7
4
4
  Summary: Planet-scale distributed computing in Python.
5
5
  Keywords: cloud,ML,AI,serverless,distributed,parallel,machine-learning,deep-learning,pythagoras
6
6
  Author: Volodymyr (Vlad) Pavlov
@@ -80,8 +80,9 @@ Pythagoras elevates two popular techniques — memoization and parallelization
80
80
  to a global scale and then fuses them, unlocking performance and scalability
81
81
  that were previously out of reach.
82
82
 
83
- * `Pythagoras 101: Introduction to Memoization` notebook:
84
- https://colab.research.google.com/drive/1bvNXFP1BQJqhoS270Dz1lNT4jPCuj540
83
+ * [Pythagoras 101: Introduction to Memoization](https://colab.research.google.com/drive/1bvNXFP1BQJqhoS270Dz1lNT4jPCuj540)
84
+
85
+ * [Pythagoras 102: Parallelization Basics](https://colab.research.google.com/drive/1DZxgwoiTnyy1qE7T5JunU4GN4j0w6CVk)
85
86
 
86
87
 
87
88
  **!!! BOOKMARK THIS PAGE AND COME BACK LATER, WE WILL PUBLISH MORE TUTORIALS SOON !!!**
@@ -28,8 +28,9 @@ Pythagoras elevates two popular techniques — memoization and parallelization
28
28
  to a global scale and then fuses them, unlocking performance and scalability
29
29
  that were previously out of reach.
30
30
 
31
- * `Pythagoras 101: Introduction to Memoization` notebook:
32
- https://colab.research.google.com/drive/1bvNXFP1BQJqhoS270Dz1lNT4jPCuj540
31
+ * [Pythagoras 101: Introduction to Memoization](https://colab.research.google.com/drive/1bvNXFP1BQJqhoS270Dz1lNT4jPCuj540)
32
+
33
+ * [Pythagoras 102: Parallelization Basics](https://colab.research.google.com/drive/1DZxgwoiTnyy1qE7T5JunU4GN4j0w6CVk)
33
34
 
34
35
 
35
36
  **!!! BOOKMARK THIS PAGE AND COME BACK LATER, WE WILL PUBLISH MORE TUTORIALS SOON !!!**
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "pythagoras"
7
- version = "0.23.5"
7
+ version = "0.23.7"
8
8
  authors = [
9
9
  {name = "Volodymyr (Vlad) Pavlov", email = "vlpavlov@ieee.org"},
10
10
  ]
@@ -21,7 +21,7 @@ from .._020_ordinary_code_portals import (
21
21
  from persidict import WriteOnceDict
22
22
 
23
23
  TOTAL_VALUES_TXT = "Values, total"
24
- PROBABILITY_OF_CHECKS_TXT = "Probability of checks"
24
+ PROBABILITY_OF_CHECKS_TXT = "Probability of consistency checks"
25
25
 
26
26
 
27
27
  def get_active_data_portal() -> DataPortal:
@@ -26,21 +26,31 @@ def unused_ram(Gb:int) -> SimplePreValidatorFn:
26
26
  return SimplePreValidatorFn(_at_least_X_G_RAM_free_check).fix_kwargs(x=Gb)
27
27
 
28
28
 
29
- def _check_python_package_and_install_if_needed(package_name)-> ValidationSuccessClass | None:
29
+ def _check_python_package_and_install_if_needed(
30
+ package_name)-> ValidationSuccessClass | None:
30
31
  assert isinstance(package_name, str)
31
- import importlib
32
+ import importlib, time
32
33
  try:
33
34
  importlib.import_module(package_name)
34
35
  return pth.VALIDATION_SUCCESSFUL
35
36
  except:
36
- pth.install_package(package_name)
37
- return pth.VALIDATION_SUCCESSFUL
37
+ portal = self.portal
38
+ address = (pth.get_node_signature()
39
+ , package_name
40
+ , "installation_attempt")
41
+ # allow installation retries every 10 minutes
42
+ if (not address in portal._config_settings
43
+ or portal._config_settings[address] < time.time() - 600):
44
+ portal._config_settings[address] = time.time()
45
+ pth.install_package(package_name)
46
+ return pth.VALIDATION_SUCCESSFUL
38
47
 
39
48
 
40
49
  def installed_packages(*args) -> list[SimplePreValidatorFn]:
41
50
  validators = []
42
51
  for package_name in args:
43
52
  assert isinstance(package_name, str)
53
+ #TODO: check if the package is available on pypi.org
44
54
  new_validator = SimplePreValidatorFn(_check_python_package_and_install_if_needed)
45
55
  new_validator = new_validator.fix_kwargs(package_name=package_name)
46
56
  validators.append(new_validator)
@@ -57,8 +57,8 @@ class ProtectedFn(AutonomousFn):
57
57
  pre_validators_arg_names = ["packed_kwargs", "fn_addr"]
58
58
 
59
59
  def __init__(self, fn: Callable | str
60
- , pre_validators: list[ValidatorFn] | list[Callable] | None = None
61
- , post_validators: list[ValidatorFn] | list[Callable] | None = None
60
+ , pre_validators: list[ValidatorFn] | list[Callable] | ValidatorFn | Callable | None = None
61
+ , post_validators: list[ValidatorFn] | list[Callable] | ValidatorFn | Callable | None = None
62
62
  , excessive_logging: bool | Joker = KEEP_CURRENT
63
63
  , fixed_kwargs: dict[str,Any] | None = None
64
64
  , portal: ProtectedCodePortal | None = None):
@@ -173,7 +173,7 @@ class ProtectedFn(AutonomousFn):
173
173
 
174
174
 
175
175
  def _normalize_validators(self
176
- , validators: list[ValidatorFn] | None
176
+ , validators: list[ValidatorFn] | ValidatorFn | None
177
177
  , validator_type: type
178
178
  ) -> list[ValidatorFn]:
179
179
  """Return list of validators in a normalized form.
@@ -27,7 +27,7 @@ from .._010_basic_portals.basic_portal_core_classes import _describe_runtime_cha
27
27
  from persidict import OverlappingMultiDict
28
28
  from .._080_pure_code_portals.pure_core_classes import (
29
29
  PureCodePortal, PureFnExecutionResultAddr)
30
- from .._800_signatures_and_converters.node_signatures import get_node_signature
30
+ from .._800_signatures_and_converters.node_signature import get_node_signature
31
31
 
32
32
  from multiprocessing import get_context
33
33
 
@@ -1,5 +1,5 @@
1
1
  from .base_16_32_convertors import *
2
2
  from .current_date_gmt_str import *
3
3
  from .hash_signatures import *
4
- from .node_signatures import *
4
+ from .node_signature import *
5
5
  from .random_signatures import *
@@ -1,8 +1,10 @@
1
1
  import uuid, platform, getpass
2
+ from functools import cache
2
3
 
3
4
  from .hash_signatures import get_hash_signature
4
5
 
5
6
 
7
+ @cache
6
8
  def get_node_signature() -> str:
7
9
  """Returns a globally-unique signature for the current computing node.
8
10
  """