pythagoras


Namepythagoras JSON
Version 0.23.19 PyPI version JSON
download
home_pageNone
SummaryPlanet-scale distributed computing in Python.
upload_time2025-09-13 05:56:19
maintainerNone
docs_urlNone
authorVolodymyr (Vlad) Pavlov
requires_python>=3.10
licenseNone
keywords cloud ml ai serverless distributed parallel machine-learning deep-learning pythagoras
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pythagoras

Planet-scale distributed computing in Python.

**!!! RESEARCH PREVIEW !!!**

## What is it?

Pythagoras is a super-scalable, easy-to-use, and
low-maintenance framework for (1) massive algorithm parallelization and 
(2) hardware usage optimization in Python. It simplifies and speeds up 
data science, machine learning, and AI workflows.

Pythagoras excels at complex, long-running, resource-demanding computations. 
It’s not recommended for real-time, latency-sensitive workflows.

## Tutorials

Pythagoras elevates two popular techniques — memoization and parallelization — 
to a global scale and then fuses them, unlocking performance and scalability 
that were previously out of reach.

* [Pythagoras 101: Introduction to Memoization](https://pythagoras.link/tutorial-101)

* [Pythagoras 102: Parallelization Basics](https://pythagoras.link/tutorial-102)

Drawing from many years of functional-programming practice, 
Pythagoras extends these proven ideas to the next level. 
In a Pythagoras environment, you can seamlessly employ your 
preferred functional patterns, augmented by new capabilities.

* [Pythagoras 203: Work with Functions](https://pythagoras.link/tutorial-203)

**!!! BOOKMARK THIS PAGE AND COME BACK LATER, WE WILL PUBLISH MORE TUTORIALS SOON !!!**

## Videos

* [Data Phoenix Webinar, August 27, 2025](https://youtu.be/eb6_atu1RQI) ([slides](https://docs.google.com/presentation/d/1fGBqnp0aqVHPJ-BYGYnUll1_TJI_WObAbEVX89Z3-yA))


## Usage Examples

Importing Pythagoras:
```python
from pythagoras.core import *
import pythagoras as pth
```

Creating a portal based on a (shared) folder:
```python
my_portal = get_portal("./my_local_folder")
```

Checking the state of a portal:
```python
my_portal.describe()
```

Decorating a function:
```python
@pure()
def my_long_running_function(a:float, b:float) -> float:
  from time import sleep # imports must be placed inside a pure function
  sleep(5)
  return a+10*b
```

Using a decorated function synchronously:
```python
result = my_long_running_function(a=1, b=2) # only named arguments are allowed
```

Using a decorated function asynchronously:
```python
future_result_address = my_long_running_function.swarm(a=10, b=20)
if ready(future_result_address):
    result = get(future_result_address)
```

Pre-conditions for executing a function:
```python
@pure(pre_validators=[
    unused_ram(Gb=5),
    installed_packages("scikit-learn","pandas"),
    unused_cpu(cores=10)])
def my_long_running_function(a:float, b:float) -> float:
  from time import sleep
  sleep(5)
  return a+10*b
```

Recursion:
```python
@pure(pre_validators=[recursive_parameters("n")])
def factorial(n:int)->int:
  if n == 1:
    return 1
  else:
    return n*factorial(n=n-1) # only named arguments are allowed
```

Partial function application:
```python
@pure()
def my_map(input_list:list, transformer: PureFn)->list:
  result = []
  for element in input_list:
    transformed_element = transformer(x=element)
    result.append(transformed_element)
  return result

@pure()
def my_square(x):
  return x*x

result = my_map(input_list=[1,2,3,4,5], transformer=my_square)

my_square_map = my_map.fix_kwargs(transformer = my_square)

result = my_square_map(input_list=[1,2,3,4,5])
```

Mutually recursive functions:
```python
@pure(pre_validators=recursive_parameters("n"))
def is_even(n:int, is_odd ,is_even)->bool:
  if n in {0,2}:
    return True
  else:
    return is_odd(n=n-1, is_even=is_even, is_odd=is_odd)

@pure(pre_validators=recursive_parameters("n"))
def is_odd(n:int, is_even, is_odd)->bool:
  if n in {0,2}:
    return False
  else:
    return is_even(n=n-1, is_odd=is_odd, is_even=is_even)

(is_even, is_odd) = (
  is_even.fix_kwargs(is_odd=is_odd, is_even=is_even)
  , is_odd.fix_kwargs(is_odd=is_odd, is_even=is_even) )

assert is_even(n=10)
assert is_odd(n=11)
```

## How to get it?

The source code is hosted on GitHub at: https://github.com/pythagoras-dev/pythagoras

Installers for the latest released version are available 
at the Python package index at: https://pypi.org/project/pythagoras

Using uv :
```
uv add pythagoras
```

Using pip (legacy alternative to uv):
```
pip install pythagoras
```

## Dependencies

* [persidict](https://pypi.org/project/persidict)
* [parameterizable](https://pypi.org/project/parameterizable/)
* [jsonpickle](https://jsonpickle.github.io)
* [joblib](https://joblib.readthedocs.io)
* [lz4](https://python-lz4.readthedocs.io)
* [pandas](https://pandas.pydata.org)
* [numpy](https://numpy.org)
* [psutil](https://psutil.readthedocs.io)
* [boto3](https://boto3.readthedocs.io)
* [pytest](https://pytest.org)
* [moto](http://getmoto.org)
* [boto3](https://boto3.readthedocs.io)
* [scipy](https://www.scipy.org)
* [jsonpickle](https://jsonpickle.github.io)
* [scikit-learn](https://scikit-learn.org)
* [autopep8](https://pypi.org/project/autopep8)
* [deepdiff](https://zepworks.com/deepdiff/current/)
* [nvidia-ml-p](https://pypi.org/project/nvidia-ml-py/)
* [uv](https://docs.astral.sh/uv/)

## Key Contacts

* [Vlad (Volodymyr) Pavlov](https://www.linkedin.com/in/vlpavlov/)

## About The Name

Pythagoras of Samos was a famous ancient Greek thinker and scientist 
who was the first man to call himself a philosopher ("lover of wisdom"). 
He is most recognised for his many mathematical findings, 
including the Pythagorean theorem. 

Not everyone knows that in antiquity, Pythagoras was also credited with 
major astronomical discoveries, such as sphericity of the Earth 
and the identity of the morning and evening stars as the planet Venus.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pythagoras",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "cloud, ML, AI, serverless, distributed, parallel, machine-learning, deep-learning, pythagoras",
    "author": "Volodymyr (Vlad) Pavlov",
    "author_email": "Volodymyr (Vlad) Pavlov <vlpavlov@ieee.org>",
    "download_url": "https://files.pythonhosted.org/packages/80/c6/419e3142b0a339319e874402c3aaa3229af708711ef6c7e8507dadbec40a/pythagoras-0.23.19.tar.gz",
    "platform": null,
    "description": "# Pythagoras\n\nPlanet-scale distributed computing in Python.\n\n**!!! RESEARCH PREVIEW !!!**\n\n## What is it?\n\nPythagoras is a super-scalable, easy-to-use, and\nlow-maintenance framework for (1) massive algorithm parallelization and \n(2) hardware usage optimization in Python. It simplifies and speeds up \ndata science, machine learning, and AI workflows.\n\nPythagoras excels at complex, long-running, resource-demanding computations. \nIt\u2019s not recommended for real-time, latency-sensitive workflows.\n\n## Tutorials\n\nPythagoras elevates two popular techniques \u2014 memoization and parallelization \u2014 \nto a global scale and then fuses them, unlocking performance and scalability \nthat were previously out of reach.\n\n* [Pythagoras 101: Introduction to Memoization](https://pythagoras.link/tutorial-101)\n\n* [Pythagoras 102: Parallelization Basics](https://pythagoras.link/tutorial-102)\n\nDrawing from many years of functional-programming practice, \nPythagoras extends these proven ideas to the next level. \nIn a Pythagoras environment, you can seamlessly employ your \npreferred functional patterns, augmented by new capabilities.\n\n* [Pythagoras 203: Work with Functions](https://pythagoras.link/tutorial-203)\n\n**!!! BOOKMARK THIS PAGE AND COME BACK LATER, WE WILL PUBLISH MORE TUTORIALS SOON !!!**\n\n## Videos\n\n* [Data Phoenix Webinar, August 27, 2025](https://youtu.be/eb6_atu1RQI) ([slides](https://docs.google.com/presentation/d/1fGBqnp0aqVHPJ-BYGYnUll1_TJI_WObAbEVX89Z3-yA))\n\n\n## Usage Examples\n\nImporting Pythagoras:\n```python\nfrom pythagoras.core import *\nimport pythagoras as pth\n```\n\nCreating a portal based on a (shared) folder:\n```python\nmy_portal = get_portal(\"./my_local_folder\")\n```\n\nChecking the state of a portal:\n```python\nmy_portal.describe()\n```\n\nDecorating a function:\n```python\n@pure()\ndef my_long_running_function(a:float, b:float) -> float:\n  from time import sleep # imports must be placed inside a pure function\n  sleep(5)\n  return a+10*b\n```\n\nUsing a decorated function synchronously:\n```python\nresult = my_long_running_function(a=1, b=2) # only named arguments are allowed\n```\n\nUsing a decorated function asynchronously:\n```python\nfuture_result_address = my_long_running_function.swarm(a=10, b=20)\nif ready(future_result_address):\n    result = get(future_result_address)\n```\n\nPre-conditions for executing a function:\n```python\n@pure(pre_validators=[\n    unused_ram(Gb=5),\n    installed_packages(\"scikit-learn\",\"pandas\"),\n    unused_cpu(cores=10)])\ndef my_long_running_function(a:float, b:float) -> float:\n  from time import sleep\n  sleep(5)\n  return a+10*b\n```\n\nRecursion:\n```python\n@pure(pre_validators=[recursive_parameters(\"n\")])\ndef factorial(n:int)->int:\n  if n == 1:\n    return 1\n  else:\n    return n*factorial(n=n-1) # only named arguments are allowed\n```\n\nPartial function application:\n```python\n@pure()\ndef my_map(input_list:list, transformer: PureFn)->list:\n  result = []\n  for element in input_list:\n    transformed_element = transformer(x=element)\n    result.append(transformed_element)\n  return result\n\n@pure()\ndef my_square(x):\n  return x*x\n\nresult = my_map(input_list=[1,2,3,4,5], transformer=my_square)\n\nmy_square_map = my_map.fix_kwargs(transformer = my_square)\n\nresult = my_square_map(input_list=[1,2,3,4,5])\n```\n\nMutually recursive functions:\n```python\n@pure(pre_validators=recursive_parameters(\"n\"))\ndef is_even(n:int, is_odd ,is_even)->bool:\n  if n in {0,2}:\n    return True\n  else:\n    return is_odd(n=n-1, is_even=is_even, is_odd=is_odd)\n\n@pure(pre_validators=recursive_parameters(\"n\"))\ndef is_odd(n:int, is_even, is_odd)->bool:\n  if n in {0,2}:\n    return False\n  else:\n    return is_even(n=n-1, is_odd=is_odd, is_even=is_even)\n\n(is_even, is_odd) = (\n  is_even.fix_kwargs(is_odd=is_odd, is_even=is_even)\n  , is_odd.fix_kwargs(is_odd=is_odd, is_even=is_even) )\n\nassert is_even(n=10)\nassert is_odd(n=11)\n```\n\n## How to get it?\n\nThe source code is hosted on GitHub at: https://github.com/pythagoras-dev/pythagoras\n\nInstallers for the latest released version are available \nat the Python package index at: https://pypi.org/project/pythagoras\n\nUsing uv :\n```\nuv add pythagoras\n```\n\nUsing pip (legacy alternative to uv):\n```\npip install pythagoras\n```\n\n## Dependencies\n\n* [persidict](https://pypi.org/project/persidict)\n* [parameterizable](https://pypi.org/project/parameterizable/)\n* [jsonpickle](https://jsonpickle.github.io)\n* [joblib](https://joblib.readthedocs.io)\n* [lz4](https://python-lz4.readthedocs.io)\n* [pandas](https://pandas.pydata.org)\n* [numpy](https://numpy.org)\n* [psutil](https://psutil.readthedocs.io)\n* [boto3](https://boto3.readthedocs.io)\n* [pytest](https://pytest.org)\n* [moto](http://getmoto.org)\n* [boto3](https://boto3.readthedocs.io)\n* [scipy](https://www.scipy.org)\n* [jsonpickle](https://jsonpickle.github.io)\n* [scikit-learn](https://scikit-learn.org)\n* [autopep8](https://pypi.org/project/autopep8)\n* [deepdiff](https://zepworks.com/deepdiff/current/)\n* [nvidia-ml-p](https://pypi.org/project/nvidia-ml-py/)\n* [uv](https://docs.astral.sh/uv/)\n\n## Key Contacts\n\n* [Vlad (Volodymyr) Pavlov](https://www.linkedin.com/in/vlpavlov/)\n\n## About The Name\n\nPythagoras of Samos was a famous ancient Greek thinker and scientist \nwho was the first man to call himself a philosopher (\"lover of wisdom\"). \nHe is most recognised for his many mathematical findings, \nincluding the Pythagorean theorem. \n\nNot everyone knows that in antiquity, Pythagoras was also credited with \nmajor astronomical discoveries, such as sphericity of the Earth \nand the identity of the morning and evening stars as the planet Venus.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Planet-scale distributed computing in Python.",
    "version": "0.23.19",
    "project_urls": {
        "Homepage": "https://github.com/pythagoras-dev/pythagoras"
    },
    "split_keywords": [
        "cloud",
        " ml",
        " ai",
        " serverless",
        " distributed",
        " parallel",
        " machine-learning",
        " deep-learning",
        " pythagoras"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "81560f8fe0eb5d588518edb731ea77d099ffa7a03c34c19cac97168e7d9bc3d9",
                "md5": "9180fb9366f5b4f88fc924d2e0949e05",
                "sha256": "88b0da4c79004f2e6a09a942ea1f34b44ba8024f515378dc5833ecc014062117"
            },
            "downloads": -1,
            "filename": "pythagoras-0.23.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9180fb9366f5b4f88fc924d2e0949e05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 80297,
            "upload_time": "2025-09-13T05:56:18",
            "upload_time_iso_8601": "2025-09-13T05:56:18.073825Z",
            "url": "https://files.pythonhosted.org/packages/81/56/0f8fe0eb5d588518edb731ea77d099ffa7a03c34c19cac97168e7d9bc3d9/pythagoras-0.23.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "80c6419e3142b0a339319e874402c3aaa3229af708711ef6c7e8507dadbec40a",
                "md5": "94dbcf3006170f47cd4bda9c08bbf5ed",
                "sha256": "e3184406a68db93611a82aec52f26eadec25823e497adf888b07b8ef533daadc"
            },
            "downloads": -1,
            "filename": "pythagoras-0.23.19.tar.gz",
            "has_sig": false,
            "md5_digest": "94dbcf3006170f47cd4bda9c08bbf5ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 50482,
            "upload_time": "2025-09-13T05:56:19",
            "upload_time_iso_8601": "2025-09-13T05:56:19.180490Z",
            "url": "https://files.pythonhosted.org/packages/80/c6/419e3142b0a339319e874402c3aaa3229af708711ef6c7e8507dadbec40a/pythagoras-0.23.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-13 05:56:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pythagoras-dev",
    "github_project": "pythagoras",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pythagoras"
}
        
Elapsed time: 1.85953s