Skip to content

Commit eaecd2d

Browse files
authored
Merge branch 'main' into patch-1
2 parents 5503416 + 1ce9d85 commit eaecd2d

143 files changed

Lines changed: 9811 additions & 736 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Bug report
33
about: Create a report to help us improve
44
title: ''
55
labels: bug
6-
assignees: justinmerrell
6+
assignees: ''
77

88
---
99

.github/tape_collection/cli_config.tape

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Enter
1010

1111
Sleep 4s
1212

13-
Type "<Paste your RunPod API Key here>"
13+
Type "<Paste your Runpod API Key here>"

.github/workflows/CD-publish_to_pypi.yml

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,83 @@
11
name: CD | Publish Python 🐍 distributions 📦 to PyPI
22

33
on:
4-
release:
5-
types: [published]
6-
4+
push:
5+
branches: [main]
76
workflow_dispatch:
7+
inputs:
8+
force_publish:
9+
description: 'Force publish without release-please'
10+
required: true
11+
default: 'false'
12+
type: choice
13+
options:
14+
- 'true'
15+
- 'false'
16+
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
actions: write
21+
issues: write
22+
id-token: write
823

924
jobs:
10-
build-n-publish:
11-
name: Build and publish Python 🐍 distributions 📦 to PyPI
25+
release-please:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
release_created: ${{ steps.release.outputs.release_created }}
29+
tag_name: ${{ steps.release.outputs.tag_name }}
30+
steps:
31+
- uses: google-github-actions/release-please-action@v3
32+
id: release
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
release-type: python
36+
package-name: runpod
37+
38+
# PyPI publishing
39+
pypi-publish:
40+
name: PyPI Publish
41+
needs: release-please
42+
if: ${{ needs.release-please.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.force_publish == 'true') }}
1243
runs-on: ubuntu-latest
1344

45+
environment:
46+
name: pypi-production
47+
url: https://pypi.org/project/runpod/
48+
1449
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up Python 3.11.10
17-
uses: actions/setup-python@v5
50+
- name: Checkout code
51+
uses: actions/checkout@v5
1852
with:
19-
python-version: 3.11.10
20-
21-
- name: Install pypa/build
22-
run: >-
23-
python -m
24-
pip install
25-
build
26-
--user
27-
28-
- name: Build a binary wheel and a source tarball
29-
run: >-
30-
python -m
31-
build
32-
--sdist
33-
--wheel
34-
--outdir dist/
35-
.
36-
37-
- name: Publish distribution 📦 to Test PyPI
38-
uses: pypa/gh-action-pypi-publish@release/v1
53+
fetch-depth: 0
54+
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v7
3957
with:
40-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
41-
repository_url: https://test.pypi.org/legacy/
58+
enable-cache: true
59+
60+
- name: Set up Python 3.11.10
61+
run: uv python install 3.11.10
62+
63+
- name: Install dependencies
64+
run: uv sync --all-groups
65+
66+
- name: Build package
67+
run: uv build
68+
69+
- name: Verify package
70+
run: uv run twine check dist/*
4271

43-
- name: Publish distribution 📦 to PyPI
44-
# if: startsWith(github.ref, 'refs/tags')
72+
- name: Publish to PyPI
4573
uses: pypa/gh-action-pypi-publish@release/v1
4674
with:
47-
password: ${{ secrets.PYPI_API_TOKEN }}
75+
verbose: true
4876

4977
notify-runpod-workers:
5078
name: Notify workers
51-
needs: build-n-publish
79+
needs: [release-please, pypi-publish]
80+
if: ${{ needs.release-please.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.force_publish == 'true') }}
5281
strategy:
5382
matrix:
5483
repo:
@@ -75,12 +104,12 @@ jobs:
75104
runs-on: ubuntu-latest
76105

77106
steps:
78-
- name: Wait for propegation
107+
- name: Wait for propagation
79108
run: sleep 300s
80109
shell: bash
81110

82111
- name: Repository Dispatch
83-
uses: peter-evans/repository-dispatch@v3
112+
uses: peter-evans/repository-dispatch@v4
84113
with:
85114
token: ${{ secrets.RUNPOD_WORKERS_PAT }}
86115
repository: ${{ matrix.repo }}

.github/workflows/CD-test_publish_to_pypi.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,25 @@ jobs:
1111
build-n-publish:
1212
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
1313
runs-on: ubuntu-latest
14+
environment: test-release
15+
permissions:
16+
contents: read
17+
id-token: write # Required for OIDC
1418

1519
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up Python 3.11.10
18-
uses: actions/setup-python@v5
20+
- uses: actions/checkout@v5
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v7
1923
with:
20-
python-version: 3.11.10
24+
enable-cache: true
2125

22-
- name: Install pypa/build
23-
run: >-
24-
python -m
25-
pip install
26-
build
27-
--user
26+
- name: Set up Python 3.11.10
27+
run: uv python install 3.11.10
2828

29-
- name: Build a binary wheel and a source tarball
30-
run: >-
31-
python -m
32-
build
33-
--sdist
34-
--wheel
35-
--outdir dist/
36-
.
29+
- name: Build package
30+
run: uv build
3731

3832
- name: Publish distribution 📦 to Test PyPI
3933
uses: pypa/gh-action-pypi-publish@release/v1
4034
with:
41-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
42-
repository_url: https://test.pypi.org/legacy/
35+
repository-url: https://test.pypi.org/legacy/

.github/workflows/CI-codeql.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,19 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v5
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v3
45+
uses: github/codeql-action/init@v4
4646
with:
4747
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
52-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53-
# queries: security-extended,security-and-quality
48+
queries: security-extended,security-and-quality
5449

5550
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5651
# If this step fails, then you should remove it and run the build manually (see below)
5752
- name: Autobuild
58-
uses: github/codeql-action/autobuild@v3
53+
uses: github/codeql-action/autobuild@v4
5954

6055
# ℹ️ Command-line programs to run using the OS shell.
6156
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -68,6 +63,6 @@ jobs:
6863
# ./location_of_script_within_repo/buildscript.sh
6964

7065
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v3
66+
uses: github/codeql-action/analyze@v4
7267
with:
7368
category: "/language:${{matrix.language}}"

.github/workflows/CI-e2e.yml

Lines changed: 23 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,38 @@
1-
# Performs a full test of the package within production environment.
2-
3-
name: CI | End-to-End RunPod Python Tests
4-
1+
name: CI-e2e
52
on:
63
push:
7-
branches:
8-
- main
9-
4+
branches: [main]
105
pull_request:
11-
branches:
12-
- main
13-
6+
branches: [main]
147
workflow_dispatch:
158

169
jobs:
17-
e2e-build:
18-
name: Build and push mock-worker Docker image
10+
e2e:
11+
if: github.repository == 'runpod/runpod-python'
1912
runs-on: ubuntu-latest
20-
outputs:
21-
docker_tag: ${{ steps.output_docker_tag.outputs.docker_tag }}
22-
13+
timeout-minutes: 15
2314
steps:
24-
- name: Checkout Repo
25-
uses: actions/checkout@v4
26-
with:
27-
fetch-depth: 2
28-
29-
- name: Clone and patch mock-worker
30-
run: |
31-
git clone https://github.com/runpod-workers/mock-worker
32-
GIT_SHA=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
33-
echo "git+https://github.com/runpod/runpod-python.git@$GIT_SHA" > mock-worker/builder/requirements.txt
15+
- uses: actions/checkout@v5
3416

35-
- name: Set up QEMU
36-
uses: docker/setup-qemu-action@v3
17+
- uses: astral-sh/setup-uv@v6
3718

38-
- name: Set up Docker Buildx
39-
uses: docker/setup-buildx-action@v3
40-
41-
- name: Login to Docker Hub
42-
uses: docker/login-action@v3
19+
- uses: actions/setup-python@v5
4320
with:
44-
username: ${{ secrets.DOCKERHUB_USERNAME }}
45-
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
python-version: "3.12"
4622

47-
- name: Define Docker Tag
48-
id: docker_tag
23+
- name: Install dependencies
4924
run: |
50-
DOCKER_TAG=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
51-
echo "DOCKER_TAG=$(echo $DOCKER_TAG | cut -c 1-7)" >> $GITHUB_ENV
52-
53-
- name: Set Docker Tag as Output
54-
id: output_docker_tag
55-
run: echo "::set-output name=docker_tag::${{ env.DOCKER_TAG }}"
56-
57-
- name: Build and push Docker image
58-
env:
59-
DOCKERHUB_REPO: ${{ vars.DOCKERHUB_REPO }}
60-
DOCKERHUB_IMG: ${{ vars.DOCKERHUB_IMG }}
25+
uv venv
26+
source .venv/bin/activate
27+
uv pip install -e ".[test]" --quiet || uv pip install -e .
28+
uv pip install runpod-flash pytest pytest-asyncio pytest-timeout pytest-rerunfailures httpx
29+
uv pip install -e . --reinstall --no-deps
30+
python -c "import runpod; print(f'runpod: {runpod.__version__} from {runpod.__file__}')"
31+
32+
- name: Run e2e tests
6133
run: |
62-
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
63-
docker build -t $DOCKERHUB_REPO/$DOCKERHUB_IMG:${{ env.DOCKER_TAG }} -f mock-worker/Dockerfile mock-worker
64-
docker push $DOCKERHUB_REPO/$DOCKERHUB_IMG:${{ env.DOCKER_TAG }}
65-
66-
test:
67-
name: Run End-to-End Tests
68-
runs-on: ubuntu-latest
69-
needs: [e2e-build]
70-
71-
steps:
72-
- uses: actions/checkout@v4
73-
74-
- name: Run Tests
75-
id: run-tests
76-
uses: runpod/runpod-test-runner@v2.1.0
77-
with:
78-
image-tag: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ needs.e2e-build.outputs.docker_tag }}
79-
runpod-api-key: ${{ secrets.RUNPOD_API_KEY }}
80-
request-timeout: 1200
81-
82-
- name: Verify Tests
34+
source .venv/bin/activate
35+
pytest tests/e2e/ -v -p no:xdist --timeout=600 --reruns 1 --reruns-delay 5 --log-cli-level=INFO -o "addopts="
8336
env:
84-
TOTAL_TESTS: ${{ steps.run-tests.outputs.total-tests }}
85-
SUCCESSFUL_TESTS: ${{ steps.run-tests.outputs.succeeded }}
86-
run: |
87-
echo "Total tests: $TOTAL_TESTS"
88-
echo "Successful tests: $SUCCESSFUL_TESTS"
89-
if [ "$TOTAL_TESTS" != "$SUCCESSFUL_TESTS" ]; then
90-
exit 1
91-
fi
37+
RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }}
38+
RUNPOD_SDK_GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

.github/workflows/CI-pytests.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ jobs:
1515
run_tests:
1616
strategy:
1717
matrix:
18-
python-version: [3.8, 3.9, 3.10.15, 3.11.10]
18+
python-version: ["3.10", "3.11", "3.12"]
1919
runs-on: ubuntu-latest
2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323

24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v5
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v7
2626
with:
27-
python-version: ${{ matrix.python-version }}
27+
enable-cache: true
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
run: uv python install ${{ matrix.python-version }}
2831

2932
- name: Install Dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install '.[test]'
33+
run: uv sync --group test
3334

3435
- name: Run Tests
35-
run: pytest
36+
run: uv run pytest

0 commit comments

Comments
 (0)