Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add python release ci #228

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/python_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Release Python

on:
push:
tags:
- "*"
pull_request:
branches:
- main
paths:
- ".github/workflows/python_release.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --bindings pyo3 --features=pyo3/extension-module
sccache: "true"
working-directory: "bindings/python"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: bindings/python/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 --bindings pyo3 --features=pyo3/extension-module
sccache: "true"
working-directory: "bindings/python"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: bindings/python/dist

release:
name: Release
environment: release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [windows, macos]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: "wheels-*/*"
- name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
3 changes: 3 additions & 0 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
edition = "2021"
name = "tonbo-python"
version = "0.1.0"
license = "Apache-2.0"
repository = "https://github.com/tonbo-io/tonbo"
readme = "README.md"

[lib]
crate-type = ["cdylib"]
Expand Down
6 changes: 6 additions & 0 deletions bindings/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This package intends to build a native python binding for [Tonbo](https://github

Tonbo's Python bindings can be used to build data-intensive applications, including other types of databases.

## Installation

```sh
pip install tonbo
```

## Example

```py
Expand Down
3 changes: 3 additions & 0 deletions bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
description = "Tonbo Python Binding"
license = { text = "Apache-2.0" }
dynamic = ["version"]

[project.optional-dependencies]
Expand All @@ -23,3 +25,4 @@ features = ["pyo3/extension-module"]

module-name = "tonbo._tonbo"
python-source = "python"
strip = true
9 changes: 6 additions & 3 deletions bindings/python/python/tonbo/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ from tonbo import error as error
from tonbo.fs import FsOptions

@final
class Record: ...
class Record:
def __call__(self) -> None: ...

@final
class Bound(Enum):
"""Tonbo range for scan. None for unbounded"""

Included = auto()
Excluded = auto()
@staticmethod
def Included(key: Any) -> Bound: ...
@staticmethod
def Excluded(key: Any) -> Bound: ...

@final
class DataType(Enum):
Expand Down
Loading