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
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e ".[pandas]"

- name: Run tests
run: python -m unittest discover -s tests -p 'test*.py' -v

wheels:
needs: test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04-arm
- os: macos-15-intel
- os: macos-15
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.21

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl

sdist:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
28 changes: 0 additions & 28 deletions .github/workflows/tests.yml

This file was deleted.

9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[build-system]
requires = ["setuptools>=61.0", "setuptools-rust>=1.0"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build = "cp312-*"
environment = { NSV_BUILD_RUST = "1" }

[tool.cibuildwheel.linux]
archs = ["auto64"]
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y"
environment = { NSV_BUILD_RUST = "1", PATH = "$HOME/.cargo/bin:$PATH" }
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ name = "_rust"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.29", features = ["extension-module"] }
pyo3 = { version = "0.29", features = ["extension-module", "abi3-py38"] }
nsv = "0.0.12"
16 changes: 10 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import os

from setuptools import setup, find_packages

try:
build_rust = os.environ.get("NSV_BUILD_RUST", "0") == "1"
if build_rust:
from setuptools_rust import Binding, RustExtension
rust_extensions = [RustExtension("nsv._rust", path="rust/Cargo.toml", binding=Binding.PyO3, optional=True)]
except ImportError:
rust_extensions = [RustExtension("nsv._rust", path="rust/Cargo.toml", binding=Binding.PyO3, optional=False, py_limited_api=True)]
options = {"bdist_wheel": {"py_limited_api": "cp38"}}
else:
rust_extensions = []
options = {}

setup(
name="nsv",
version="0.2.3",
packages=find_packages(),
packages=find_packages(exclude=["tests", "tests.*"]),
description="Python implementation of the NSV (Newline-Separated Values) format",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
Expand Down Expand Up @@ -45,6 +50,5 @@
"pandas": ["pandas"],
},
rust_extensions=rust_extensions,
setup_requires=["setuptools-rust>=1.0"] if rust_extensions else [],
zip_safe=False,
options=options,
)
Loading