{"id":13405555,"url":"https://github.com/runpod/runpod-python","last_synced_at":"2025-03-14T10:30:59.781Z","repository":{"id":64686284,"uuid":"576438535","full_name":"runpod/runpod-python","owner":"runpod","description":"🐍 | Python library for RunPod API and serverless worker SDK. ","archived":false,"fork":false,"pushed_at":"2025-01-16T07:02:16.000Z","size":15244,"stargazers_count":211,"open_issues_count":48,"forks_count":75,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-28T17:52:48.865Z","etag":null,"topics":["api","artificial-intelligence","cloud-gpu","gpu","machine-learning","runpod","sdk-python","serverless"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/runpod/","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/runpod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-09T21:35:48.000Z","updated_at":"2025-02-22T21:19:06.000Z","dependencies_parsed_at":"2023-09-22T19:25:45.496Z","dependency_job_id":"9b032779-7f75-43f7-b8c9-9a11e72ad903","html_url":"https://github.com/runpod/runpod-python","commit_stats":{"total_commits":281,"total_committers":5,"mean_commits":56.2,"dds":"0.42348754448398573","last_synced_commit":"494b7880079e958fdf6aa1db4348155f34acf55a"},"previous_names":[],"tags_count":103,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runpod%2Frunpod-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runpod%2Frunpod-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runpod%2Frunpod-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runpod%2Frunpod-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runpod","download_url":"https://codeload.github.com/runpod/runpod-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243561911,"owners_count":20311198,"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":["api","artificial-intelligence","cloud-gpu","gpu","machine-learning","runpod","sdk-python","serverless"],"created_at":"2024-07-30T19:02:05.330Z","updated_at":"2025-03-14T10:30:58.872Z","avatar_url":"https://github.com/runpod.png","language":"Python","funding_links":[],"categories":["Python","Agent Runtime Infrastructure"],"sub_categories":["Codex Resources"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eRunPod | Python Library \u003c/h1\u003e\n\n[![PyPI Package](https://badge.fury.io/py/runpod.svg)](https://badge.fury.io/py/runpod)\n\u0026nbsp;\n[![Downloads](https://static.pepy.tech/personalized-badge/runpod?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=blue\u0026left_text=Downloads)](https://pepy.tech/project/runpod)\n\n[![CI | End-to-End RunPod Python Tests](https://github.com/runpod/runpod-python/actions/workflows/CI-e2e.yml/badge.svg)](https://github.com/runpod/runpod-python/actions/workflows/CI-e2e.yml)\n\n[![CI | Code Quality](https://github.com/runpod/runpod-python/actions/workflows/CI-pylint.yml/badge.svg)](https://github.com/runpod/runpod-python/actions/workflows/CI-pylint.yml)\n\u0026nbsp;\n[![CI | Unit Tests](https://github.com/runpod/runpod-python/actions/workflows/CI-pytests.yml/badge.svg)](https://github.com/runpod/runpod-python/actions/workflows/CI-pytests.yml)\n\u0026nbsp;\n[![CI | CodeQL](https://github.com/runpod/runpod-python/actions/workflows/CI-codeql.yml/badge.svg)](https://github.com/runpod/runpod-python/actions/workflows/CI-codeql.yml)\n\n\u003c/div\u003e\n\nWelcome to the official Python library for RunPod API \u0026amp; SDK.\n\n## Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [💻 | Installation](#--installation)\n- [⚡ | Serverless Worker (SDK)](#--serverless-worker-sdk)\n  - [Quick Start](#quick-start)\n  - [Local Test Worker](#local-test-worker)\n- [📚 | API Language Library (GraphQL Wrapper)](#--api-language-library-graphql-wrapper)\n  - [Endpoints](#endpoints)\n  - [GPU Cloud (Pods)](#gpu-cloud-pods)\n- [📁 | Directory](#--directory)\n- [🤝 | Community and Contributing](#--community-and-contributing)\n\n## 💻 | Installation\n\n```bash\n# Install the latest release version\npip install runpod\n\n# or\n\n# Install the latest development version (main branch)\npip install git+https://github.com/runpod/runpod-python.git\n```\n\n*Python 3.8 or higher is required to use the latest version of this package.*\n\n## ⚡ | Serverless Worker (SDK)\n\nThis python package can also be used to create a serverless worker that can be deployed to RunPod as a custom endpoint API.\n\n### Quick Start\n\nCreate a python script in your project that contains your model definition and the RunPod worker start code. Run this python code as your default container start command:\n\n```python\n# my_worker.py\n\nimport runpod\n\ndef is_even(job):\n\n    job_input = job[\"input\"]\n    the_number = job_input[\"number\"]\n\n    if not isinstance(the_number, int):\n        return {\"error\": \"Silly human, you need to pass an integer.\"}\n\n    if the_number % 2 == 0:\n        return True\n\n    return False\n\nrunpod.serverless.start({\"handler\": is_even})\n```\n\nMake sure that this file is ran when your container starts. This can be accomplished by calling it in the docker command when you set up a template at [runpod.io/console/serverless/user/templates](https://www.runpod.io/console/serverless/user/templates) or by setting it as the default command in your Dockerfile.\n\nSee our [blog post](https://www.runpod.io/blog/serverless-create-a-basic-api) for creating a basic Serverless API, or view the [details docs](https://docs.runpod.io/serverless-ai/custom-apis) for more information.\n\n### Local Test Worker\n\nYou can also test your worker locally before deploying it to RunPod. This is useful for debugging and testing.\n\n```bash\npython my_worker.py --rp_serve_api\n```\n\n## 📚 | API Language Library (GraphQL Wrapper)\n\nWhen interacting with the RunPod API you can use this library to make requests to the API.\n\n```python\nimport runpod\n\nrunpod.api_key = \"your_runpod_api_key_found_under_settings\"\n```\n\n### Endpoints\n\nYou can interact with RunPod endpoints via a `run` or `run_sync` method.\n\n```python\nendpoint = runpod.Endpoint(\"ENDPOINT_ID\")\n\nrun_request = endpoint.run(\n    {\"your_model_input_key\": \"your_model_input_value\"}\n)\n\n# Check the status of the endpoint run request\nprint(run_request.status())\n\n# Get the output of the endpoint run request, blocking until the endpoint run is complete.\nprint(run_request.output())\n```\n\n```python\nendpoint = runpod.Endpoint(\"ENDPOINT_ID\")\n\nrun_request = endpoint.run_sync(\n    {\"your_model_input_key\": \"your_model_input_value\"}\n)\n\n# Returns the job results if completed within 90 seconds, otherwise, returns the job status.\nprint(run_request )\n```\n\n### GPU Cloud (Pods)\n\n```python\nimport runpod\n\nrunpod.api_key = \"your_runpod_api_key_found_under_settings\"\n\n# Get all my pods\npods = runpod.get_pods()\n\n# Get a specific pod\npod = runpod.get_pod(pod.id)\n\n# Create a pod\npod = runpod.create_pod(\"test\", \"runpod/stack\", \"NVIDIA GeForce RTX 3070\")\n\n# Stop the pod\nrunpod.stop_pod(pod.id)\n\n# Resume the pod\nrunpod.resume_pod(pod.id)\n\n# Terminate the pod\nrunpod.terminate_pod(pod.id)\n```\n\n## 📁 | Directory\n\n```BASH\n.\n├── docs               # Documentation\n├── examples           # Examples\n├── runpod             # Package source code\n│   ├── api_wrapper    # Language library - API (GraphQL)\n│   ├── cli            # Command Line Interface Functions\n│   ├── endpoint       # Language library - Endpoints\n│   └── serverless     # SDK - Serverless Worker\n└── tests              # Package tests\n```\n\n## 🤝 | Community and Contributing\n\nWe welcome both pull requests and issues on [GitHub](https://github.com/runpod/runpod-python). Bug fixes and new features are encouraged, but please read our [contributing guide](CONTRIBUTING.md) first.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca target=\"_blank\" href=\"https://discord.gg/pJ3P2DbUUq\"\u003e![Discord Banner 2](https://discordapp.com/api/guilds/912829806415085598/widget.png?style=banner2)\u003c/a\u003e\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunpod%2Frunpod-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunpod%2Frunpod-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunpod%2Frunpod-python/lists"}