Skip to content

Commit

Permalink
Merge pull request #23 from Yvictor/feat/py313
Browse files Browse the repository at this point in the history
feat: support py3.13 and aarch64 linux
  • Loading branch information
Yvictor authored Jan 24, 2025
2 parents 1949ce6 + a4afe55 commit 712b8f0
Show file tree
Hide file tree
Showing 4 changed files with 1,193 additions and 66 deletions.
115 changes: 74 additions & 41 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
permissions:
contents: read

env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1

jobs:
linux:
runs-on: ubuntu-latest
Expand All @@ -28,21 +31,34 @@ jobs:
#, aarch64, armv7]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install uv
uses: astral-sh/setup-uv@v5
- name: Install talib
run: |
wget https://github.com/Yvictor/polars_ta_extension/releases/download/0.1.0/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib
./configure
make
sudo make install
cd ..
rm -rf ta-lib
env:
TA_INCLUDE_PATH: ${{ github.workspace }}/dependencies/include
TA_LIBRARY_PATH: ${{ github.workspace }}/dependencies/lib
- name: Test
run: |
python -m pip install --upgrade pip
pip install .[dev]
pytest
uv run pytest
env:
DEPS_PATH: ${{ github.workspace }}/dependencies
TA_INCLUDE_PATH: ${{ github.workspace }}/dependencies/include
TA_LIBRARY_PATH: ${{ github.workspace }}/dependencies/lib
- name: Build wheels for x86_64
if: matrix.target == 'x86_64'
uses: PyO3/maturin-action@v1
uses: PyO3/maturin-action@v1.46.0
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
Expand Down Expand Up @@ -100,35 +116,47 @@ jobs:
name: wheels
path: dist

# linux-arm:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# target: [aarch64]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# - name: Setup QEMU
# uses: docker/setup-qemu-action@v1
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# args: --release --out dist --find-interpreter
# sccache: 'true'
# container: ghcr.io/rust-cross/manylinux_2_28-cross:aarch64
# rust-toolchain: stable-aarch64-unknown-linux-gnu
# env:
# DEPS_PATH: ${{ github.workspace }}/dependencies
# TA_INCLUDE_PATH: ${{ github.workspace }}/dependencies/include
# TA_LIBRARY_PATH: ${{ github.workspace }}/dependencies/lib
# - name: Upload wheels
# uses: actions/upload-artifact@v3
# with:
# name: wheels
# path: dist
linux-arm:
runs-on: ubuntu-24.04-arm
strategy:
matrix:
target: [aarch64]
# armv7l]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: install uv
uses: astral-sh/setup-uv@v5
- name: install tools
run: |
uv tool install maturin
- name: Install talib
run: |
wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib-0.6.4-src.tar.gz
tar -xzf ta-lib-0.6.4-src.tar.gz
cd ta-lib-0.6.4
./configure
make
sudo make install
cd ..
rm -rf ta-lib-0.6.4
env:
TA_INCLUDE_PATH: ${{ github.workspace }}/dependencies/include
TA_LIBRARY_PATH: ${{ github.workspace }}/dependencies/lib
- name: Build wheels
run: |
maturin build --release --out dist --find-interpreter
env:
DEPS_PATH: ${{ github.workspace }}/dependencies
TA_INCLUDE_PATH: ${{ github.workspace }}/dependencies/include
TA_LIBRARY_PATH: ${{ github.workspace }}/dependencies/lib
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist


windows:
Expand All @@ -138,7 +166,7 @@ jobs:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
Expand All @@ -150,6 +178,11 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.target }}
- name: install uv
uses: astral-sh/setup-uv@v5
- name: install tools
run: |
uv tool install maturin
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand All @@ -173,14 +206,14 @@ jobs:
target: [x86_64, aarch64-apple-darwin]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# - name: check python version
# run: |
# python --version
# which python
# python -m pip install -U pip
- name: install uv
uses: astral-sh/setup-uv@v5
- name: install tools
run: |
uv tool install maturin
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polars_talib"
version = "0.1.4"
version = "0.1.5"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -10,7 +10,7 @@ crate-type = ["cdylib"]


[dependencies]
pyo3 = { version = "*", features = ["extension-module"] }
pyo3 = { version = "0.20", features = ["extension-module", "abi3-py37"] }
pyo3-polars = { version = "0.10.0", features = ["derive"] }
polars = {version = "0.36.2", features = ["dtype-struct"]}
# "performant", "lazy", "dtype-array"
Expand Down
50 changes: 27 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
[build-system]
requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"

[project]
name = "polars_talib"
name = "polars-talib"
version = "0.1.5"
description = "Polars extension for Ta-Lib: Support Ta-Lib functions in Polars expressions"
readme = "README.md"
authors = [
{name = "yvictor", email = "[email protected]"}
]
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["version"]
authors = [
{name = "yvictor", email = "[email protected]"}
]
dependencies = [
"polars >= 0.20",
]
description = "Polars extension for Ta-Lib: Support Ta-Lib functions in Polars expressions"
readme = "README.md"
keywords = ["polars-extension", "talib", "technical-analysis", "TA-Lib", "polars", "rust", "polars-expr"]
dependencies = [
"polars >= 0.18.0,<0.18.5; python_version < '3.8'",
"polars >= 0.19; python_version >= '3.8'",
]


[tool.maturin]
module-name = "polars_talib._polars_talib"
python-packages = ["polars_talib"]
python-source = "python"
features = ["pyo3/extension-module"]
module-name = "polars_talib._polars_talib"

[project.optional-dependencies]
[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"

[dependency-groups]
dev = [
"pytest >= 7.4.1",
"maturin[patchelf]",
"polars",
"numpy==1.26.4",
"maturin>=1.8.1",
"pytest>=7.4.1",
"numpy==1.20.0; python_version < '3.9'",
"numpy==1.26.4; python_version >= '3.9'",
"memray",
"hypothesis",
"pytest-memray",
"pytest-memray==1.4.0; python_version >= '3.8'",
"pytest-benchmark",
"ta-lib",
"ta-lib==0.5.3",
]


[tool.ruff]
line-length = 100
fix = true
src = ["python"]
src = ["python"]
Loading

0 comments on commit 712b8f0

Please sign in to comment.