pythagoras 0.23.16__py3-none-any.whl → 0.23.18__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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pythagoras
|
|
3
|
-
Version: 0.23.
|
|
3
|
+
Version: 0.23.18
|
|
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
|
|
@@ -66,7 +66,7 @@ data science, machine learning, and AI workflows.
|
|
|
66
66
|
Pythagoras excels at complex, long-running, resource-demanding computations.
|
|
67
67
|
It’s not recommended for real-time, latency-sensitive workflows.
|
|
68
68
|
|
|
69
|
-
##
|
|
69
|
+
## Tutorials
|
|
70
70
|
|
|
71
71
|
Pythagoras elevates two popular techniques — memoization and parallelization —
|
|
72
72
|
to a global scale and then fuses them, unlocking performance and scalability
|
|
@@ -87,7 +87,114 @@ preferred functional patterns, augmented by new capabilities.
|
|
|
87
87
|
|
|
88
88
|
## Videos
|
|
89
89
|
|
|
90
|
-
[Data Phoenix Webinar, August 27, 2025](https://youtu.be/eb6_atu1RQI) ([slides](https://docs.google.com/presentation/d/1fGBqnp0aqVHPJ-BYGYnUll1_TJI_WObAbEVX89Z3-yA))
|
|
90
|
+
* [Data Phoenix Webinar, August 27, 2025](https://youtu.be/eb6_atu1RQI) ([slides](https://docs.google.com/presentation/d/1fGBqnp0aqVHPJ-BYGYnUll1_TJI_WObAbEVX89Z3-yA))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## Usage Examples
|
|
94
|
+
|
|
95
|
+
Importing Pythagoras:
|
|
96
|
+
```python
|
|
97
|
+
from pythagoras.core import *
|
|
98
|
+
import pythagoras as pth
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Creating a portal based on a (shared) folder:
|
|
102
|
+
```python
|
|
103
|
+
my_portal = get_portal("./my_local_folder")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Checking the state of a portal:
|
|
107
|
+
```python
|
|
108
|
+
my_portal.describe()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Decorating a function:
|
|
112
|
+
```python
|
|
113
|
+
@pure()
|
|
114
|
+
def my_long_running_function(a:float, b:float) -> float:
|
|
115
|
+
from time import sleep # imports must be placed inside a pure function
|
|
116
|
+
sleep(5)
|
|
117
|
+
return a+10*b
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Using a decorated function synchronously:
|
|
121
|
+
```python
|
|
122
|
+
result = my_long_running_function(a=1, b=2) # only named arguments are allowed
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Using a decorated function asynchronously:
|
|
126
|
+
```python
|
|
127
|
+
future_result_address = my_long_running_function.swarm(a=10, b=20)
|
|
128
|
+
if ready(future_result_address):
|
|
129
|
+
result = get(future_result_address)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Pre-conditions for executing a function:
|
|
133
|
+
```python
|
|
134
|
+
@pure(pre_validators=[
|
|
135
|
+
unused_ram(Gb=5),
|
|
136
|
+
installed_packages("scikit-learn","pandas"),
|
|
137
|
+
unused_cpu(cores=10)])
|
|
138
|
+
def my_long_running_function(a:float, b:float) -> float:
|
|
139
|
+
from time import sleep
|
|
140
|
+
sleep(5)
|
|
141
|
+
return a+10*b
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Recursion:
|
|
145
|
+
```python
|
|
146
|
+
@pure(pre_validators=[recursive_parameters("n")])
|
|
147
|
+
def factorial(n:int)->int:
|
|
148
|
+
if n == 1:
|
|
149
|
+
return 1
|
|
150
|
+
else:
|
|
151
|
+
return n*factorial(n=n-1) # only named arguments are allowed
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Partial function application:
|
|
155
|
+
```python
|
|
156
|
+
@pure()
|
|
157
|
+
def my_map(input_list:list, transformer: PureFn)->list:
|
|
158
|
+
result = []
|
|
159
|
+
for element in input_list:
|
|
160
|
+
transformed_element = transformer(x=element)
|
|
161
|
+
result.append(transformed_element)
|
|
162
|
+
return result
|
|
163
|
+
|
|
164
|
+
@pure()
|
|
165
|
+
def my_square(x):
|
|
166
|
+
return x*x
|
|
167
|
+
|
|
168
|
+
result = my_map(input_list=[1,2,3,4,5], transformer=my_square)
|
|
169
|
+
|
|
170
|
+
my_square_map = my_map.fix_kwargs(transformer = my_square)
|
|
171
|
+
|
|
172
|
+
result = my_square_map(input_list=[1,2,3,4,5])
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Mutually recursive functions:
|
|
176
|
+
```python
|
|
177
|
+
@pure(pre_validators=recursive_parameters("n"))
|
|
178
|
+
def is_even(n:int, is_odd ,is_even)->bool:
|
|
179
|
+
if n in {0,2}:
|
|
180
|
+
return True
|
|
181
|
+
else:
|
|
182
|
+
return is_odd(n=n-1, is_even=is_even, is_odd=is_odd)
|
|
183
|
+
|
|
184
|
+
@pure(pre_validators=recursive_parameters("n"))
|
|
185
|
+
def is_odd(n:int, is_even, is_odd)->bool:
|
|
186
|
+
if n in {0,2}:
|
|
187
|
+
return False
|
|
188
|
+
else:
|
|
189
|
+
return is_even(n=n-1, is_odd=is_odd, is_even=is_even)
|
|
190
|
+
|
|
191
|
+
(is_even, is_odd) = (
|
|
192
|
+
is_even.fix_kwargs(is_odd=is_odd, is_even=is_even)
|
|
193
|
+
, is_odd.fix_kwargs(is_odd=is_odd, is_even=is_even) )
|
|
194
|
+
|
|
195
|
+
assert is_even(n=10)
|
|
196
|
+
assert is_odd(n=11)
|
|
197
|
+
```
|
|
91
198
|
|
|
92
199
|
## How to get it?
|
|
93
200
|
|
|
@@ -60,6 +60,6 @@ pythagoras/_900_project_stats_collector/__init__.py,sha256=Eagt-BhPPtBGgpMywx2lk
|
|
|
60
60
|
pythagoras/_900_project_stats_collector/project_analyzer.py,sha256=uhycFKjUIXEpYcZYnak3yn4JFhchl-oZ7wt6spFxhoY,3574
|
|
61
61
|
pythagoras/__init__.py,sha256=TMPtJdSi_WShCpJnsVVdO48Wcvs78GMbUi5gHc1eMLw,1233
|
|
62
62
|
pythagoras/core/__init__.py,sha256=cXtQ-Vbm8TqzazvkFws5cV3AEEYbEKzNXYeuHeLGFK0,328
|
|
63
|
-
pythagoras-0.23.
|
|
64
|
-
pythagoras-0.23.
|
|
65
|
-
pythagoras-0.23.
|
|
63
|
+
pythagoras-0.23.18.dist-info/WHEEL,sha256=NHRAbdxxzyL9K3IO2LjmlNqKSyPZnKv2BD16YYVKo18,79
|
|
64
|
+
pythagoras-0.23.18.dist-info/METADATA,sha256=3s7ztGkAceirTtK1EBxxPuKy_BGYGK7d24mN0gHXzJo,7561
|
|
65
|
+
pythagoras-0.23.18.dist-info/RECORD,,
|
|
File without changes
|