Skip to content

Add Python bindings crate, FFI, workflow, and examples for RMCP Rust SDK #1

Add Python bindings crate, FFI, workflow, and examples for RMCP Rust SDK

Add Python bindings crate, FFI, workflow, and examples for RMCP Rust SDK #1

Workflow file for this run

name: Python Bindings CI
on:
push:
paths:
- 'bindings/python/**'
- 'crates/rmcp/**'
- '.github/workflows/python-bindings.yml'
pull_request:
paths:
- 'bindings/python/**'
- 'crates/rmcp/**'
- '.github/workflows/python-bindings.yml'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install maturin pytest pytest-asyncio
- name: Build and test
run: |
cd bindings/python
maturin develop
pytest tests/ -v
build:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install maturin twine
- name: Build wheels
run: |
cd bindings/python
maturin build --release --strip
- name: Publish to PyPI
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
cd bindings/python
twine upload target/wheels/*