Skip to content

Commit

Permalink
Merge pull request #17 from hoaihuongbk/fix_deploy
Browse files Browse the repository at this point in the history
Update test with os
  • Loading branch information
hoaihuongbk authored Feb 15, 2025
2 parents f49bc3a + 382ff14 commit 1930755
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 33 deletions.
71 changes: 52 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,71 @@
name: Publish to PyPI

on:
workflow_call:
inputs:
python-version:
required: false
type: string
default: "3.10"
release:
types: [ created ]

jobs:
release:
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
architecture: [ x86-64, aarch64 ]
python-version: [ '3.10']
exclude:
- os: macos-latest
architecture: x86-64

steps:
- uses: actions/checkout@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ inputs.python-version }}
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Set Rust target for aarch64
if: matrix.architecture == 'aarch64'
id: target
run: |
uv sync
TARGET=$(
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
echo "aarch64-apple-darwin";
else
echo "aarch64-unknown-linux-gnu";
fi
)
echo "target=$TARGET" >> $GITHUB_OUTPUT
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
command: build
target: ${{ steps.target.outputs.target }}
args: >
--out dist
manylinux: ${{ matrix.architecture == 'aarch64' && '2_24' || 'auto' }}

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
path: dist/*.whl

- name: Build package
run: uv build --wheel
release:
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
needs: [build-wheels]
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

15 changes: 7 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Test

on:
workflow_call:
inputs:
python-version:
required: false
type: string
default: "3.10"
push:
branches: [ main ]
paths:
Expand All @@ -20,14 +14,19 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10']
steps:
- uses: actions/checkout@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ inputs.python-version }}
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras --group dev
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ __pycache__
/src/lakeops/udf/lakeops_udf.cpython-310-darwin.so
/.coverage
/coverage.xml
/rust/target/
/rust/Cargo.lock
/src/lakeops/lakeops_udf.cpython-310-darwin.so
/src/lakeops/_lakeops_udf.cpython-310-darwin.so
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ test_docs:
@echo "Generating documentation"
@uv run mkdocs build --clean
@uv run mkdocs serve

build_wheel:
@echo "Releasing the project"
@uv tool run maturin build
28 changes: 23 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ version = "0.1.7"
description = "Data lake operations toolkit"
readme = "README.md"
requires-python = ">=3.10"
authors = [
{ name = "Huong Vuong", email = "[email protected]" },
]
license = { file = "LICENSE" }
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Rust",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]

dependencies = [
"deltalake>=0.24.0",
"pandas>=2.2.3",
Expand Down Expand Up @@ -53,9 +70,9 @@ target-version = "py310"

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"E", # pycodestyle
"F", # pyflakes
"I", # isort
]

[tool.ruff.format]
Expand All @@ -65,7 +82,8 @@ skip-magic-trailing-comma = false

[tool.maturin]
features = ["pyo3/extension-module"]
module-name = "lakeops.udf.lakeops_udf"
module-name = "lakeops._lakeops_udf"
python-source = "src"
manifest-path = "src/lakeops/udf/rust/Cargo.toml"
manifest-path = "rust/Cargo.toml"
compatibility = "manylinux2014"

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/lakeops/udf/rust/src/lib.rs → rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use geo::functions::{point_in_polygon, calculate_distance, encode_geohash, decod
use json::functions::{json_extract, is_valid_json};

#[pymodule]
#[pyo3(name="_lakeops_udf")]
fn lakeops_udf(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(point_in_polygon, m)?)?;
m.add_function(wrap_pyfunction!(calculate_distance, m)?)?;
Expand Down
2 changes: 1 addition & 1 deletion src/lakeops/udf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from lakeops.udf.lakeops_udf import (
from lakeops._lakeops_udf import (
point_in_polygon,
calculate_distance,
json_extract,
Expand Down

0 comments on commit 1930755

Please sign in to comment.