Skip to content

Commit

Permalink
README + Github actions configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed Jul 15, 2024
1 parent 6c4c79b commit 0dcf0fa
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 28 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Release

on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
needs: [linux, musllinux, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

on:
pull_request:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build Rust module
uses: PyO3/maturin-action@v1
with:
command: dev -E test,lint
- name: Verify
run: just verify
19 changes: 9 additions & 10 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

python := "python3"

default:
@echo "Available recipes:"
@echo " mypy - Run mypy for type checking"
@echo " pylint - Run pylint for linting"
@echo " test - Run pytest for testing"
@echo " verify - Run mypy, pylint, test"

# Recipe to run mypy for type checking
mypy:
@echo "Running mypy..."
Expand All @@ -23,11 +30,11 @@ verify: mypy pylint test
# Recipe to build the project
build:
@echo "Building the project..."
{{python}} setup.py sdist bdist_wheel
maturin build --release

clean:
@echo "Cleaning the project"
rm -rf dist/
cargo clean

example:
#!/usr/bin/env bash
Expand All @@ -37,11 +44,3 @@ example:
export PYTHONPATH="$PYTHONPATH:examples/"
fi
hypercorn -b "0.0.0.0:9080" example:app
# Default recipe to show help message
default:
@echo "Available recipes:"
@echo " mypy - Run mypy for type checking"
@echo " pylint - Run pylint for linting"
@echo " test - Run pytest for testing"
@echo " verify - Run mypy, pylint, test"
95 changes: 77 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,92 @@
## Python SDK for restate
[![Documentation](https://img.shields.io/badge/doc-reference-blue)](https://docs.restate.dev)
[![Examples](https://img.shields.io/badge/view-examples-blue)](https://github.com/restatedev/examples)
[![Discord](https://img.shields.io/discord/1128210118216007792?logo=discord)](https://discord.gg/skW3AZ6uGd)
[![Twitter](https://img.shields.io/twitter/follow/restatedev.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=restatedev)

# Python SDK for restate

### Prerequisites
* python 3
* pip
* just
> [!WARNING]
> The Python SDK is currently in active development, and might break across releases.
### Local development
[Restate](https://restate.dev/) is a system for easily building resilient applications using *distributed durable async/await*. This repository contains the Restate SDK for writing services in **Python**.

## Community

* 🤗️ [Join our online community](https://discord.gg/skW3AZ6uGd) for help, sharing feedback and talking to the community.
* 📖 [Check out our documentation](https://docs.restate.dev) to get quickly started!
* 📣 [Follow us on Twitter](https://twitter.com/restatedev) for staying up to date.
* 🙋 [Create a GitHub issue](https://github.com/restatedev/sdk-typescript/issues) for requesting a new feature or reporting a problem.
* 🏠 [Visit our GitHub org](https://github.com/restatedev) for exploring other repositories.

## Using the SDK

To use this SDK, add the dependency to your project:

```shell
pip install restate_sdk
```

* pip install -r requirements.txt
* just build
## Versions

The Python SDK is currently in active development, and might break across releases.

### Justfile commands
* just clean
* just verify
* just build
* just example
The compatibility with Restate is described in the following table:

### Dev
| Restate Server\sdk-typescript | 0.0/0.1 |
|-------------------------------|---------|
| 1.0 ||

#### Pre-requisites
## Contributing

We’re excited if you join the Restate community and start contributing!
Whether it is feature requests, bug reports, ideas & feedback or PRs, we appreciate any and all contributions.
We know that your time is precious and, therefore, deeply value any effort to contribute!

### Local development

* Python 3
* pip
* just
* PyEnv or VirtualEnv
* [just](https://github.com/casey/just)
* [Rust toolchain](https://rustup.rs/)

Build the
Setup your virtual environment using the tool of your choice, e.g. VirtualEnv:

```shell
python3 -m venv .venv
source venv/bin/activate
```

Install `maturin`:

```shell
pip install maturin
```

Now build the Rust module and include opt-in additional dev dependencies:

```shell
maturin dev -E test,lint
```

You usually need to build the Rust module only once, but you might need to rebuild it on pulls.

For linting and testing:

```shell
just verify
```

## Releasing the package

Pull latest main:

```shell
git checkout main && git pull
```

Update module version in `Cargo.toml`, commit it. Then push tag, e.g.:

```
git tag -m "Release v0.1.0" v0.1.0
git push origin v0.1.0
```

0 comments on commit 0dcf0fa

Please sign in to comment.