Repository navigation
Conversation
rp login --profile NAME saved a key under [NAME], but runpod.profile was fixed to "default", so the saved key was never used without code changes. RUNPOD_PROFILE now selects the profile for runpod.api_key and is the default for rp login --profile. - unset or blank RUNPOD_PROFILE keeps the "default" profile - an explicit --profile still overrides the env var - RUNPOD_API_KEY still takes precedence over any stored profile
There was a problem hiding this comment.
🟡 Changes recommended
A profile containing only S3 credentials causes import runpod to raise KeyError when RUNPOD_API_KEY is unset, also blocking rp login from adding the missing key.
1 open issue
What changed in this PR
This PR lets the SDK and CLI select saved credentials through RUNPOD_PROFILE, avoiding the need to set the profile in Python code.
Changes:
- Selects the SDK profile at import and the default login profile from
RUNPOD_PROFILE, with blank values falling back todefault. - Adds tests for profile selection, credential loading, and override precedence.
- Documents the environment variable in getting-started and CLI guides.
| File | Description |
|---|---|
tests/test_profile.py |
Tests profile selection and API-key precedence. |
tests/test_cli/test_management_commands.py |
Tests environment-based login profiles and explicit overrides. |
runpod/rp_cli/main.py |
Uses the selected profile as the login default. |
runpod/__init__.py |
Initializes the SDK profile from RUNPOD_PROFILE. |
docs/getting_Started.md |
Documents profile selection before SDK import. |
docs/cli/start_here.md |
Explains CLI profile selection and precedence. |
docs/cli/references/command_line_interface.md |
Adds environment-based profile selection to the reference. |
Review effort: Balanced
A RUNPOD_PROFILE pointing at a profile with only S3 credentials made `import runpod` raise KeyError: 'api_key' when RUNPOD_API_KEY was unset, which also blocked `rp login --api-key`. Read the key with .get so such a profile yields api_key = None.
briandconnelly
left a comment
There was a problem hiding this comment.
No issues found.
No reportable defects were found in the reviewed scope. Tests were read, not run.
What changed
The pull request uses RUNPOD_PROFILE to select the SDK credential profile and the default profile for rp login, while preserving explicit profile and API-key overrides. It also tolerates stored profiles without an API key and adds documentation and tests.
👾 Reviewed by review-agent (GPT-6.1 Sol) on behalf of briandconnelly
Commit 1e5b8e5 · 0 inline comments
- credentials live in ~/.runpod/config.toml, one table per profile, not ~/.runpod/credentials.toml - setting runpod.profile after import does not change the key; the profile and key are read once at import, so document RUNPOD_PROFILE (set before import), rp login --profile, and RUNPOD_API_KEY precedence - rename docs/getting_Started.md to docs/getting_started.md
The rename moves to its own change so file history follows it.

Summary
rp login --profile NAMEsaves a key under[NAME]in~/.runpod/config.toml. Nothing read that profile back, though:runpod.profilewas fixed to"default", so using the saved key meant settingrunpod.profilein code or exportingRUNPOD_API_KEY.RUNPOD_PROFILEnow selects the profile, in the same way asAWS_PROFILE:runpod.profileat import"default"RUNPOD_PROFILE, else"default"rp login --profiledefaultdefaultRUNPOD_PROFILE, elsedefaultPrecedence is unchanged:
RUNPOD_API_KEY> stored profile, and an explicit--profile>RUNPOD_PROFILE. An unset or blankRUNPOD_PROFILEbehaves exactly as before.The CLI docs and getting-started docs now describe the variable. The getting-started guide also had the wrong credentials file (
credentials.toml; the real file isconfig.toml) and claimed that settingrunpod.profilein a script switches profiles, which it doesn't because the key is read at import; both are corrected. Renaming the file togetting_started.mdis in #697, kept separate so the file's history follows the rename.Test plan
tests/test_profile.pycovers the default, a selected profile, whitespace stripping, a blank value falling back to the default, loading the key from the selected profile, andRUNPOD_API_KEYstill winning.rp logintests check that the env var picks the profile it saves to, and that--profileoverrides it.make quality-check: 2742 passed, 94.27% coverage.