{"id":23226131,"url":"https://github.com/shuffle/app_sdk","last_synced_at":"2025-10-25T17:20:39.425Z","repository":{"id":262444307,"uuid":"887255398","full_name":"Shuffle/app_sdk","owner":"Shuffle","description":"App SDK for Shuffle. Previously in the /shuffle/shuffle/backend/app_sdk location.","archived":false,"fork":false,"pushed_at":"2025-02-05T18:33:40.000Z","size":88,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T19:49:50.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shuffle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-12T12:38:52.000Z","updated_at":"2025-02-05T18:33:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbbbae96-8e70-4540-9884-8b62834b028f","html_url":"https://github.com/Shuffle/app_sdk","commit_stats":null,"previous_names":["shuffle/app_sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuffle%2Fapp_sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuffle%2Fapp_sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuffle%2Fapp_sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuffle%2Fapp_sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shuffle","download_url":"https://codeload.github.com/Shuffle/app_sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238310106,"owners_count":19450794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-19T00:16:12.817Z","updated_at":"2025-10-25T17:20:39.418Z","avatar_url":"https://github.com/Shuffle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shuffle SDK\nThis is the SDK used for app development, testing and production of ALL apps in Shuffle. Works with manual runs, Docker, k8s, cloud serverless. \n\nReleased under [Python pip for usage outside of Shuffle](https://pypi.org/project/shuffle-sdk/) \n\nPython apps: [https://github.com/shuffle/python-apps](https://github.com/shuffle/python-apps)\nAll apps: [https://shuffler.io/search](https://shuffler.io/search)\n\n## Usage with Shuffle\nRefer to the [Shuffle App Creation docs](https://shuffler.io/docs/app_creation)\n\n## Build\n`docker build . -t shuffle/shuffle:app_sdk`\n\n## Download\n```\npip install shuffle_sdk\n```\n\n## Usage\n```python\nfrom shuffle_sdk import AppBase\n\nclass Example(AppBase):\n    def sample_function(self, paramname):\n        return f\"Hello {paramname}\"\n\nif __name__ == \"__main__\":\n    Example.run()\n```\n\n## Testing Shuffle Apps\nWith the above function as an example\n```bash\npython3 app.py --standalone --action=sample_function paramname=World\n```\n\n**NOT REQUIRED: These are reserved parameters, allowing you to set variables for testing such as local backends to upload into Shuffle during tests:**\n```\n--shuffle_url=\"http://custom_backend_url\"\n--shuffle_authorization=\"auth\"\n--shuffle_executionid=\"execution_id\"\n```\n\nExample wit [Shuffle Tools+Liquid](https://github.com/Shuffle/python-apps/tree/master/shuffle-tools/1.2.0/src) and the [Shuffle Tools app and the \"repeat back to me\" function](https://github.com/Shuffle/python-apps/blob/678187d1198f5e8fd2072e475dbbbf858728dde8/shuffle-tools/1.2.0/src/app.py#L235)\n```bash\npython3 app.py --standalone --action=repeat_back_to_me '--call={{ \"hello\" | replace: \"o\", \"lol\" }}'\n```\n\nExample using [Shuffle Tools](https://github.com/Shuffle/python-apps/tree/master/shuffle-tools/1.2.0/src) [Shuffle actions](https://github.com/shuffle/shufflepy) within the \"execute_python\" function to get emails from Outlook ([app.py](https://github.com/Shuffle/python-apps/blob/678187d1198f5e8fd2072e475dbbbf858728dde8/shuffle-tools/1.2.0/src/app.py#L570))\n```bash\npython3 app.py --standalone --action=execute_python 'code=print(shuffle.run_app(app_id=\"accdaaf2eeba6a6ed43b2efc0112032d\", action=\"get_emails\"))'\n```\n\nExample [LLM inference with the Shuffle-AI app](https://github.com/Shuffle/python-apps/tree/master/shuffle-ai/1.0.0/src). Supports GPU and requires ollama installed and serving. \n```bash\npython3 app.py --standalone --action=run_llm 'input=convert the following data into a python list of valid ips: 12.3.4.4'\n```\n\nIf successful, the output of the function will show in your CLI.\n\n## Testing functions inside Shuffle App images manually\nThis is mostly the same, but paths and docker is a part of the command.\n```\ndocker run frikky/shuffle:shuffle-ai_1.0.0 python3 /app/app.py standalone --action=run_llm '--input=llm, please answer this question thanks'\n```\n\nWith GPU's active in Docker for the LLM (requires [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)):\n```\ndocker 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'\n```\n\n## Building a fully functional Shuffle App\n[Look at the documentation on our website](https://shuffler.io/docs/app_creation)\n\n## Adding new [Liquid filters](https://shuffler.io/docs/liquid)\nAdd a function along these lines:\n```\n@shuffle_filters.register\ndef md5(a):\n    a = str(a)\n    return hashlib.md5(a.encode('utf-8')).hexdigest()\n```\n\nThis can be used as `{{ \"string\" | md5 }}`, where `\"string\"` -\u003e the `a` parameter of the function\n\n## (Scale testing) Running the Shuffle Tools within the Shuffle Tools app locally\n1. Set your env `SHUFFLE_APP_EXPOSED_PORT=8080` and `SHUFFLE_SWARM_CONFIG=run`\n2. Run the [Shuffle Tools app](https://github.com/Shuffle/python-apps/tree/master/shuffle-tools/1.2.0/src) as a webserver: `python3 app.py`\n3. Send a local request to the Shuffle Tools app to run an action within an action. **Make sure to add an authorization \u0026 execution_id that exists**\n```\ncurl -XPOST http://localhost:8080/api/v1/run -H \"Content-Type: application/json\" -d '{\n    \"action\": {\"app_name\": \"shuffle tools\", \"name\": \"execute_python\", \"parameters\": [{\n        \"name\": \"code\", \n        \"value\": \"singul.config[\\\"url\\\"] = \\\"https://shuffler.io\\\";print(singul.run_app(app_id=\\\"3e2bdf9d5069fe3f4746c29d68785a6a\\\", action=\\\"repeat_back_to_me\\\", parameters=[{\\\"name\\\": \\\"call\\\", \\\"value\\\": \\\"testing\\\"}]))\"}]\n    }, \n    \"authorization\": \"\",\n    \"execution_id\": \"\"\n}\n'\n```\n\nYou can replace the singul.config URL with a local instance for local testing as well.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuffle%2Fapp_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuffle%2Fapp_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuffle%2Fapp_sdk/lists"}