Skip to content
Merged
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
235 changes: 208 additions & 27 deletions .github/workflows/build-test-pyd4.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,223 @@
name: Build pyd4
# This file is autogenerated by maturin v1.8.1
# To update, run
#
# maturin generate-ci github --pytest
#
name: pyd4 CI

on:
push:
branches: [master]
branches:
- main
- master
tags:
- '*'
pull_request:
branches: [master]
workflow_dispatch:

permissions:
contents: read

jobs:
build-and-test:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
- uses: actions/setup-python@v5
with:
toolchain: stable
profile: minimal
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist --find-interpreter -m ./pyd4/Cargo.toml
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-linux-${{ matrix.platform.target }}
# path: dist
- name: pytest
shell: bash
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
pip install pyd4 --find-links dist --force-reinstall
pip install pytest
pytest


- name: Install UV
uses: astral-sh/setup-uv@v3
# musllinux:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: ubuntu-22.04
# target: x86_64
# - runner: ubuntu-22.04
# target: x86
# - runner: ubuntu-22.04
# target: aarch64
# - runner: ubuntu-22.04
# target: armv7
# 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
# - name: pytest
# if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
# uses: addnab/docker-run-action@v3
# with:
# image: alpine:latest
# options: -v ${{ github.workspace }}:/io -w /io
# run: |
# set -e
# apk add py3-pip py3-virtualenv
# python3 -m virtualenv .venv
# source .venv/bin/activate
# pip install pyd4 --no-index --find-links dist --force-reinstall
# pip install pytest
# pytest
# - name: pytest
# if: ${{ !startsWith(matrix.platform.target, 'x86') }}
# uses: uraimo/run-on-arch-action@v2
# with:
# arch: ${{ matrix.platform.target }}
# distro: alpine_latest
# githubToken: ${{ github.token }}
# install: |
# apk add py3-virtualenv
# run: |
# set -e
# python3 -m virtualenv .venv
# source .venv/bin/activate
# pip install pytest
# pip install pyd4 --find-links dist --force-reinstall
# pytest

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyd4/pyproject.toml"
# 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 --find-interpreter
# sccache: 'true'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-windows-${{ matrix.platform.target }}
# path: dist
# - name: pytest
# if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
# shell: bash
# run: |
# set -e
# python3 -m venv .venv
# source .venv/Scripts/activate
# pip install pyd4 --find-links dist --force-reinstall
# pip install pytest
# pytest

- name: Install project
run: |
cd pyd4
uv sync --all-extras --dev
# macos:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: macos-13
# 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
# - name: pytest
# run: |
# set -e
# python3 -m venv .venv
# source .venv/bin/activate
# pip install pyd4 --find-links dist --force-reinstall
# pip install pytest
# pytest

- name: Build
run: |
cd pyd4
uv build
# 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

- name: Test
run: |
cd pyd4
uv run pytest
# release:
# name: Release
# runs-on: ubuntu-latest
# if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
# needs: [linux, musllinux, windows, macos, sdist]
# 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
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
# with:
# command: upload
# args: --non-interactive --skip-existing wheels-*/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ pyd4/*.egg-info/**
pyd4/build/**
pyd4/**/__pycache__/**
.ipynb*
dist
8 changes: 6 additions & 2 deletions pyd4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ env_logger = "0.9.0"

[lib]
crate-type = ["cdylib"]
name = "pyd4"
path = "src/lib.rs"
name = "_pyd4"
path = "src/lib.rs"

[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]
23 changes: 9 additions & 14 deletions pyd4/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[build-system]
requires = ["setuptools", "setuptools-rust", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["maturin>=1,<2"]
build-backend = "maturin"

[project]
name = "pyd4"
version = "0.3.6.2"
requires-python = ">=3.12"
version = "0.3.10"
requires-python = ">=3.10"
description = "Python binding for D4 file format"
dependencies = ["numpy>=2.2.2"]
dependencies = ["numpy>1.24.4"]
readme = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
Expand All @@ -19,15 +19,10 @@ classifiers = [
"Operating System :: MacOS :: MacOS X",
]

[tool.setuptools.packages]
find = { where = ["pyd4"] }
[tool.maturin]
python-source = "python"
module-name = "pyd4._pyd4" # Points to Rust

[[tool.setuptools-rust.ext-modules]]
target = "pyd4"
path = "Cargo.toml"
binding = "PyO3"

[dependency-groups]
dev = [
"pytest>=8.3.4",
]
dev = ["pytest>=8.3.4", "maturin>=1,<2"]
Loading