Skip to content

Add asyncio support to the Python SDK #239

Add asyncio support to the Python SDK

Add asyncio support to the Python SDK #239

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
# Run on all pull requests regardless of source branch
jobs:
python:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.12', '3.13', '3.14']
env:
POETRY_VERSION: "2.4.1"
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install Transloadit CLI
run: npm install -g transloadit
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install Poetry
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
- name: Install Dependencies
run: poetry install
- name: Test with coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14'
run: |
poetry run pytest --cov=transloadit \
--cov-report=xml \
--cov-report=json \
--cov-report=html \
--cov-report=term-missing \
--cov-fail-under=65 \
tests
env:
TEST_NODE_PARITY: 1
- name: Test without coverage
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.14'
run: poetry run pytest tests
- name: Upload coverage reports
# Only upload coverage if we have a token (skip for Dependabot PRs)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14' && (github.event_name != 'pull_request' || github.actor != 'dependabot[bot]')
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: python-sdk
fail_ci_if_error: false
- name: Upload coverage reports (tokenless)
# Use tokenless upload for Dependabot PRs
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14' && github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
uses: codecov/codecov-action@v6
with:
files: ./coverage.xml
flags: unittests
name: python-sdk
fail_ci_if_error: false
- name: Upload coverage artifacts
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14'
uses: actions/upload-artifact@v7
with:
name: coverage-reports
path: |
coverage.json
htmlcov/
python-e2e:
runs-on: ubuntu-latest
needs: python
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
POETRY_VERSION: "2.4.1"
PYTHON_SDK_E2E: "1"
TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_KEY }}
TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_SECRET }}
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install Transloadit CLI
run: npm install -g transloadit
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
architecture: x64
cache: 'pip'
- name: Install Poetry
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
- name: Install dependencies
run: poetry install
- name: Ensure credentials present
run: |
if [ -z "$TRANSLOADIT_KEY" ] || [ -z "$TRANSLOADIT_SECRET" ]; then
echo "TRANSLOADIT_KEY and TRANSLOADIT_SECRET secrets must be configured for the E2E job" >&2
exit 1
fi
- name: Run E2E tests and examples
env:
TEST_NODE_PARITY: 0
run: |
poetry run pytest tests/test_e2e_upload.py tests/test_examples.py -q --maxfail=1 --no-cov