Shuffle SDK
This is the SDK used for app development, testing and production of ALL apps in Shuffle. Works with manual runs, Docker, k8s, cloud serverless.
Released under Python pip for usage outside of Shuffle
Python apps: https://github.com/shuffle/python-apps All apps: https://shuffler.io/search
Usage with Shuffle
Refer to the Shuffle App Creation docs
Build
docker build . -t shuffle/shuffle:app_sdk
Download
pip install shuffle_sdk
Usage
from shuffle_sdk import AppBase
class Example(AppBase):
def sample_function(self, paramname):
return f"Hello {paramname}"
if __name__ == "__main__":
Example.run()
Testing Shuffle Apps
With the above function as an example
python3 app.py --standalone --action=sample_function paramname=World
NOT REQUIRED: These are reserved parameters, allowing you to set variables for testing such as local backends to upload into Shuffle during tests:
--shuffle_url="http://custom_backend_url"
--shuffle_authorization="auth"
--shuffle_executionid="execution_id"
Example wit Shuffle Tools+Liquid and the Shuffle Tools app and the "repeat back to me" function
python3 app.py --standalone --action=repeat_back_to_me '--call={{ "hello" | replace: "o", "lol" }}'
Example using Shuffle Tools Shuffle actions within the "execute_python" function to get emails from Outlook (app.py)
python3 app.py --standalone --action=execute_python 'code=print(shuffle.run_app(app_id="accdaaf2eeba6a6ed43b2efc0112032d", action="get_emails"))'
Example LLM inference with the Shuffle-AI app. Supports GPU and requires ollama installed and serving.
python3 app.py --standalone --action=run_llm 'input=convert the following data into a python list of valid ips: 12.3.4.4'
If successful, the output of the function will show in your CLI.
Testing functions inside Shuffle App images manually
This is mostly the same, but paths and docker is a part of the command.
docker run frikky/shuffle:shuffle-ai_1.0.0 python3 /app/app.py standalone --action=run_llm '--input=llm, please answer this question thanks'
With GPU's active in Docker for the LLM (requires Nvidia Container Toolkit):
docker run --gpus all GPU_LAYERS=8 frikky/shuffle:shuffle-ai_1.0.0 python3 /app/app.py standalone --action=run_llm '--input=llm, please answer this question thanks'
Building a fully functional Shuffle App
Look at the documentation on our website
Adding new Liquid filters
Add a function along these lines:
@shuffle_filters.register
def md5(a):
a = str(a)
return hashlib.md5(a.encode('utf-8')).hexdigest()
This can be used as {{ "string" | md5 }}, where "string" -> the a parameter of the function
(Scale testing) Running the Shuffle Tools within the Shuffle Tools app locally
- Set your env
SHUFFLE_APP_EXPOSED_PORT=8080andSHUFFLE_SWARM_CONFIG=run - Run the Shuffle Tools app as a webserver:
python3 app.py - Send a local request to the Shuffle Tools app to run an action within an action. Make sure to add an authorization & execution_id that exists
curl -XPOST http://localhost:8080/api/v1/run -H "Content-Type: application/json" -d '{
"action": {"app_name": "shuffle tools", "name": "execute_python", "parameters": [{
"name": "code",
"value": "singul.config[\"url\"] = \"https://shuffler.io\";print(singul.run_app(app_id=\"3e2bdf9d5069fe3f4746c29d68785a6a\", action=\"repeat_back_to_me\", parameters=[{\"name\": \"call\", \"value\": \"testing\"}]))"}]
},
"authorization": "",
"execution_id": ""
}
'
You can replace the singul.config URL with a local instance for local testing as well.
Metadata
Release files for shuffle-sdk 0.0.41
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shuffle_sdk-0.0.41.tar.gz | 49.3 kB | Without provenance | Details for shuffle_sdk-0.0.41.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shuffle_sdk-0.0.41-py3-none-any.whl | Python 3 | none | any | Details for shuffle_sdk-0.0.41-py3-none-any.whl |
Total release size: 98.0 kB
Release files / shuffle_sdk-0.0.41.tar.gz
| Download URL | shuffle_sdk-0.0.41.tar.gz |
|---|---|
| Size | 49.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a25746483844f0e29681f0f64a42d35a046256d6feb5eb63a27ec9e2f327793
|
|
BLAKE2b-256 checksum How to use checksums |
e4ede39b715f5d70bc308494664bd8a6dd6a1e06f4cf0b522f6b7413ccf08fd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / shuffle_sdk-0.0.41-py3-none-any.whl
| Download URL | shuffle_sdk-0.0.41-py3-none-any.whl |
|---|---|
| Size | 48.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec4330014e6441f5f4db476e4673cadebc29e59bddb60ca4857b06c14f12cefa
|
|
BLAKE2b-256 checksum How to use checksums |
f8faa6b3310928a784dfbfb6af0482e6225bfb6b5c9bc71b0f6202d9d849731c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for shuffle-sdk 0.0.41
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.