# sandpy.com cloud
``pip install sandpy-client``
### Usage
Before you will be able to use cloud client, you need to create account on: sandpy.com
SandPy lets you run your code on powerfull cloud computing instances right from your code editor.
You need to just decorate function that you want to execute with "flask-style" decorator.
Function will be skipped by local execution but will be real-time executed on one of our servers and results of your function will be returned back to your code.
### Example
#
```
from sandpy-client import Client
client = Client(api_key, api_secret)
@client.run(compute_on='GPU')
def add(a, b):
c = a + b
return c
c = test(a=10, b=20)
```
```
>>> c
30
```
### Limitations
1. Supported function argument types (DATAFRAME, int, float, str, list, tuple, set, dict, bool)
2. If you are using 3rd party packages (that can be downloaded using pip) - you HAVE TO specify imports in decorator (imports=['pandas'])
3. You CAN'T use anything outside of function scope (beside 3rd party packages).
## Documentation
##### api_key and api_secret: You can generate api_key and api_secret on account dashboard and you have to pass it to client while initialization.
#
```
Client(api_key='key', api_secret='secret')
```
##### Requirements: You can pass your requirements as a path to requirements.txt file:
#
```
Client(..., requirements_filename='./requirements.txt')
```
##### Or you can pass it as a tuple of requirements:
#
```
Client(..., requirements=('pandas', 'numpy==1.0'))
```
##### Compute On: You can choose between CPU and GPU as your computing instance. By default is CPU as we suggest using (if you using cuda=True, use GPU instead). You can specify compute_on globally in client and in run decorator.
#
```
Client(..., compute_on='GPU')
```
```
@client.run(..., compute_on='GPU')
def add(a, b):
...
```
##### Imports: You can specify 3rd party packages that will be imported.
#
```
@client.run(..., imports=['pandas'])
def add(a, b):
df = pandas.DataFrame('[1, 2]')
```
```
@client.run(..., imports=['pandas.DataFrame'])
def add(a, b):
df = DataFrame('[1, 2]')
```
### Another Example
```
from module import df, filename
@client.run(compute_on='GPU')
def ctgan(dataset, number_of_epochs):
model = CTGAN(
epochs=number_of_epochs,
batch_size=100,
cuda=False
)
model.fit(dataset)
return model
model = ctgan(df, 150)
pandas.dump(model, open(filename, 'wb')
```
Raw data
{
"_id": null,
"home_page": "https://sandpy.com",
"name": "sandpy-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "CLOUD,COMPUTING,CLOUDCOMPUTING",
"author": "Aleksander Peczot",
"author_email": "peczot.a@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/80/d0/1f311f6dcbc9340c9e7e474420adc5af4fadf39f3cb8f6b13973e9896d64/sandpy-client-1.0.3.tar.gz",
"platform": null,
"description": "# sandpy.com cloud\n``pip install sandpy-client``\n\n### Usage\nBefore you will be able to use cloud client, you need to create account on: sandpy.com\n\nSandPy lets you run your code on powerfull cloud computing instances right from your code editor.\nYou need to just decorate function that you want to execute with \"flask-style\" decorator.\nFunction will be skipped by local execution but will be real-time executed on one of our servers and results of your function will be returned back to your code.\n\n### Example\n#\n\n```\nfrom sandpy-client import Client\nclient = Client(api_key, api_secret)\n\n@client.run(compute_on='GPU')\ndef add(a, b):\n c = a + b\n return c\n\nc = test(a=10, b=20)\n```\n```\n>>> c\n30\n```\n### Limitations\n1. Supported function argument types (DATAFRAME, int, float, str, list, tuple, set, dict, bool)\n2. If you are using 3rd party packages (that can be downloaded using pip) - you HAVE TO specify imports in decorator (imports=['pandas'])\n3. You CAN'T use anything outside of function scope (beside 3rd party packages).\n\n## Documentation\n##### api_key and api_secret: You can generate api_key and api_secret on account dashboard and you have to pass it to client while initialization.\n#\n```\nClient(api_key='key', api_secret='secret')\n```\n##### Requirements: You can pass your requirements as a path to requirements.txt file:\n#\n```\nClient(..., requirements_filename='./requirements.txt')\n```\n\n##### Or you can pass it as a tuple of requirements:\n#\n```\nClient(..., requirements=('pandas', 'numpy==1.0'))\n```\n\n##### Compute On: You can choose between CPU and GPU as your computing instance. By default is CPU as we suggest using (if you using cuda=True, use GPU instead). You can specify compute_on globally in client and in run decorator.\n#\n```\nClient(..., compute_on='GPU')\n```\n```\n@client.run(..., compute_on='GPU')\ndef add(a, b):\n ...\n```\n##### Imports: You can specify 3rd party packages that will be imported.\n#\n```\n@client.run(..., imports=['pandas'])\ndef add(a, b):\n df = pandas.DataFrame('[1, 2]')\n```\n```\n@client.run(..., imports=['pandas.DataFrame'])\ndef add(a, b):\n df = DataFrame('[1, 2]')\n```\n### Another Example\n```\nfrom module import df, filename\n\n@client.run(compute_on='GPU')\ndef ctgan(dataset, number_of_epochs): \n model = CTGAN(\n epochs=number_of_epochs,\n batch_size=100,\n cuda=False\n )\n \n model.fit(dataset) \n return model\n\nmodel = ctgan(df, 150)\npandas.dump(model, open(filename, 'wb')\n```",
"bugtrack_url": null,
"license": "apache-2.0",
"summary": "Client for sandpy cloud",
"version": "1.0.3",
"split_keywords": [
"cloud",
"computing",
"cloudcomputing"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "754bbfa6f8ac22dffe10952d4489eb51",
"sha256": "555b5501c3980b830c8b352efb7c489e01c7b80231cffb1c97e7dce82c23dfbe"
},
"downloads": -1,
"filename": "sandpy-client-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "754bbfa6f8ac22dffe10952d4489eb51",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4514,
"upload_time": "2022-12-07T19:53:11",
"upload_time_iso_8601": "2022-12-07T19:53:11.530392Z",
"url": "https://files.pythonhosted.org/packages/80/d0/1f311f6dcbc9340c9e7e474420adc5af4fadf39f3cb8f6b13973e9896d64/sandpy-client-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-07 19:53:11",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "sandpy-client"
}