Skip to content

Commit

Permalink
Modernise Python build
Browse files Browse the repository at this point in the history
  • Loading branch information
xioTechnologies committed Aug 16, 2024
1 parent e7d2b41 commit a093f6d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ jobs:
platforms: all

- name: Build wheel
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS: all
CIBW_BUILD: ${{ matrix.python-version }}${{ matrix.target[1] }}
CIBW_BEFORE_BUILD: pip install numpy
CIBW_BEFORE_TEST: pip install numpy matplotlib
CIBW_BEFORE_TEST: pip install matplotlib
CIBW_TEST_COMMAND: cd {project}/Python && python advanced_example.py no_block && python simple_example.py no_block
CIBW_TEST_COMMAND_WINDOWS: cd /D {project}/Python && python advanced_example.py no_block && python simple_example.py no_block
CIBW_TEST_SKIP: "*-macosx_arm64" # fix CI warning
Expand Down
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[build-system]
requires = ["setuptools", "numpy"]
build-backend = "setuptools.build_meta"

[project]
name = "imufusion"
version = "1.2.5"
description = "Fusion Python package"
readme = { text = "See [github](https://github.com/xioTechnologies/Fusion) for documentation and examples.", content-type = "text/markdown" }
authors = [{ name = "x-io Technologies Limited", email = "info@x-io.co.uk" }]
license = { file = "LICENSE.md" }
classifiers = ["Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"] # versions shown by pyversions badge in README

[project.urls]
Repository = "https://github.com/xioTechnologies/Fusion"

[tool.setuptools]
py-modules = [] # fix cibuildwheel error: "Multiple top-level packages discovered in a flat-layout"
26 changes: 1 addition & 25 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import numpy
import os
import shutil
import sys
from setuptools import setup, Extension

for folder in ["build", "dist", "imufusion.egg-info"]:
if os.path.exists(folder) and os.path.isdir(folder):
shutil.rmtree(folder)

if len(sys.argv) == 1: # if this script was called without arguments
sys.argv.append("install")
sys.argv.append("--user")

github_url = "https://github.com/xioTechnologies/Fusion"

ext_modules = Extension("imufusion", ["Python/Python-C-API/imufusion.c",
"Fusion/FusionAhrs.c",
"Fusion/FusionCompass.c",
Expand All @@ -22,16 +10,4 @@
define_macros=[("FUSION_USE_NORMAL_SQRT", None)],
libraries=(["m"] if "linux" in sys.platform else [])) # link math library for Linux

setup(name="imufusion",
version="1.2.5",
description="Fusion Python package",
long_description="See [github](" + github_url + ") for documentation and examples.",
long_description_content_type='text/markdown',
url=github_url,
author="x-io Technologies Limited",
author_email="info@x-io.co.uk",
license="MIT",
classifiers=["Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"], # versions shown by pyversions badge in README
ext_modules=[ext_modules])
setup(ext_modules=[ext_modules])

0 comments on commit a093f6d

Please sign in to comment.