Prepare package for PyPI publishing

- Add MIT LICENSE file
- Enhance pyproject.toml with full metadata
- Add GitHub Actions workflows for CI and release
This commit is contained in:
porcelaincode
2026-01-28 15:07:07 +05:30
parent b367cdb275
commit e6476b771f
5 changed files with 220 additions and 1 deletions
+48
View File
@@ -0,0 +1,48 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-action@stable
- name: Run Rust tests
run: cargo test --all-features
- name: Run Rust clippy
run: cargo clippy --all-features -- -D warnings
- name: Check Rust formatting
run: cargo fmt --check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
args: --release --out dist
- name: Install and test import
run: |
pip install dist/*.whl
python -c "import raptorbt; print(raptorbt.__version__)"
+122
View File
@@ -0,0 +1,122 @@
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
publish:
description: 'Publish to PyPI'
required: true
type: boolean
default: false
permissions:
contents: read
jobs:
# Build wheels for Linux
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist
# Build wheels for macOS
macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}-apple-darwin
args: --release --out dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: dist
# Build wheels for Windows
windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: dist
# Build source distribution
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
# Publish to PyPI
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [linux, macos, windows, sdist]
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish)
environment:
name: pypi
url: https://pypi.org/p/raptorbt
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: List dist contents
run: ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Quant5 team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+29 -1
View File
@@ -5,17 +5,45 @@ build-backend = "maturin"
[project]
name = "raptorbt"
version = "0.1.0"
description = "High-performance Rust backtesting engine for Quant5"
description = "High-performance Rust backtesting engine with Python bindings"
readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "Quant5 team"}
]
keywords = [
"backtesting",
"trading",
"quantitative-finance",
"algorithmic-trading",
"rust",
"high-performance",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Financial and Insurance Industry",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business :: Financial :: Investment",
"Topic :: Scientific/Engineering :: Information Analysis",
"Typing :: Typed",
]
[project.urls]
Homepage = "https://github.com/alphabench/raptorbt"
Repository = "https://github.com/alphabench/raptorbt"
Documentation = "https://github.com/alphabench/raptorbt#readme"
"Bug Tracker" = "https://github.com/alphabench/raptorbt/issues"
[tool.maturin]
features = ["pyo3/extension-module"]
python-source = "python"
Binary file not shown.