Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div align="center">
<h1>RunPod | Python Library </h1>
<h1>Runpod | Python Library </h1>

[![PyPI Package](https://badge.fury.io/py/runpod.svg)](https://badge.fury.io/py/runpod)
&nbsp;
[![Downloads](https://static.pepy.tech/personalized-badge/runpod?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/runpod)

[![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)
[![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)

[![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)
&nbsp;
Expand All @@ -15,7 +15,7 @@

</div>

Welcome to the official Python library for RunPod API &amp; SDK.
Welcome to the official Python library for Runpod API &amp; SDK.

## Table of Contents

Expand Down Expand Up @@ -46,11 +46,11 @@ pip install git+https://github.com/runpod/runpod-python.git

## ⚡ | Serverless Worker (SDK)

This python package can also be used to create a serverless worker that can be deployed to RunPod as a custom endpoint API.
This python package can also be used to create a serverless worker that can be deployed to Runpod as a custom endpoint API.

### Quick Start

Create 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:
Create 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:

```python
# my_worker.py
Expand Down Expand Up @@ -79,15 +79,15 @@ See our [blog post](https://www.runpod.io/blog/serverless-create-a-basic-api) fo

### Local Test Worker

You can also test your worker locally before deploying it to RunPod. This is useful for debugging and testing.
You can also test your worker locally before deploying it to Runpod. This is useful for debugging and testing.

```bash
python my_worker.py --rp_serve_api
```

## 📚 | API Language Library (GraphQL Wrapper)

When interacting with the RunPod API you can use this library to make requests to the API.
When interacting with the Runpod API you can use this library to make requests to the API.

```python
import runpod
Expand Down
8 changes: 7 additions & 1 deletion tests/test_cli/test_cli_groups/test_config_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,15 @@ def test_output_messages(self):

def test_api_key_prompt(self):
"""Tests the API key prompt."""
with patch("click.prompt", return_value="KEY") as mock_prompt:
with patch("click.prompt", return_value="KEY") as mock_prompt, patch(
"runpod.cli.groups.config.commands.set_credentials"
) as mock_set_credentials, patch(
"runpod.cli.groups.config.commands.check_credentials",
return_value=(False, None)
):
result = self.runner.invoke(runpod_cli, ["config", "--profile", "test"])
mock_prompt.assert_called_with(
" > RunPod API Key", hide_input=False, confirmation_prompt=False
) # pylint: disable=line-too-long
mock_set_credentials.assert_called_with("KEY", "test", overwrite=True)
assert result.exit_code == 0
7 changes: 3 additions & 4 deletions tests/test_cli/test_cli_groups/test_exec_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
from unittest.mock import patch

import click
from click.testing import CliRunner

from runpod.cli.entry import runpod_cli


class TestExecCommands(unittest.TestCase):
"""Tests for Runpod CLI exec commands."""

def setUp(self):
self.runner = CliRunner()
self.runner = click.testing.CliRunner()

def test_remote_python_with_provided_pod_id(self):
Expand Down Expand Up @@ -49,9 +50,7 @@ def test_remote_python_without_provided_pod_id_prompt(self):
"runpod.cli.groups.exec.commands.python_over_ssh"
) as mock_python_over_ssh, patch(
"runpod.cli.groups.exec.commands.get_session_pod",
side_effect=lambda: click.prompt(
"Please provide the pod ID", "prompted_pod_id"
),
return_value="prompted_pod_id",
) as mock_get_pod_id: # pylint: disable=line-too-long
mock_python_over_ssh.return_value = None
result = self.runner.invoke(runpod_cli, ["exec", "python", temp_file.name])
Expand Down
Loading