Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable binary wheels for all python versions and OS #30

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c808baf
Enable pybind11 support via submodule
ianhbell May 6, 2024
19da150
Fix setting of cmake standard
ianhbell May 6, 2024
daa6e63
Fix setting of compiler
ianhbell May 6, 2024
18b6d30
Add missing override
ianhbell May 6, 2024
ece2b40
Don't call make directly
ianhbell May 6, 2024
cd39e43
And enable building of wheels
ianhbell May 6, 2024
0eaf866
And run the build script
ianhbell May 6, 2024
cd48488
Run the script via cibuildwheel
ianhbell May 6, 2024
ef5f9e8
Jump all the way to scikit-build-core
ianhbell May 6, 2024
70ce3bc
Pre build step no longer needed
ianhbell May 6, 2024
bbb7d75
And copy generated shared library
ianhbell May 6, 2024
5081503
Fix the names to make python imports happier
ianhbell May 6, 2024
72e9983
Fix names in imports
ianhbell May 6, 2024
71e87c2
Need numpy to run tests
ianhbell May 6, 2024
79d97d1
And scipy and thermopack
ianhbell May 6, 2024
aaba098
Pin versions for tests
ianhbell May 6, 2024
9ee6a38
Build script no longer needed
ianhbell May 6, 2024
98fbc32
windows too just for fun
ianhbell May 6, 2024
5188248
Bump thermopack version, no windows
ianhbell May 6, 2024
b5eeb73
Disable the testing
ianhbell May 6, 2024
f263473
Bump to remove deprecated node versions
ianhbell May 6, 2024
7da44bb
Not yet available
ianhbell May 6, 2024
f280599
Need unique names for uploads
ianhbell May 6, 2024
1723083
Bump scikit-build-core
ianhbell May 7, 2024
cff9171
Fix sdist?
ianhbell May 7, 2024
1973d47
And merge the build artifacts together
ianhbell May 7, 2024
3cf3f76
The submodule no longer needed
ianhbell May 7, 2024
4eed6c1
setup.py is also not needed
ianhbell May 7, 2024
454c289
Cleanup how arch flags are set
ianhbell May 7, 2024
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
54 changes: 54 additions & 0 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: cibuildwheel

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v4
- name: checkout submodules
run: git submodule update --init --recursive

# Used to host cibuildwheel
- uses: actions/setup-python@v4

- name: Install cibuildwheel and other dependencies
run: python -m pip install cibuildwheel==2.17.0 build wheel setuptools

- name: Build sdist
run: pipx run build --sdist --outdir wheelhouse
if: runner.os == 'Windows'

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
env:
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: "universal2"
# CIBW_BEFORE_BUILD: bash cpp/build.sh
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0
CIBW_ENVIRONMENT_LINUX: CXXFLAGS='-fconcepts'
CIBW_BUILD_VERBOSITY_WINDOWS: 2
CIBW_SKIP: "*pypy* *pp* *cp36* *cp37* *musl*"

- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}-${{ matrix.version }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
merge:
runs-on: ubuntu-latest
needs: build_wheels
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: artifact
pattern: binary-*
Empty file added .gitmodules
Empty file.
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.16)
cmake_policy(VERSION 3.12)
project(KineticGas LANGUAGES C CXX)

SET(CMAKE_CXX_STANDARD 17)

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wno-sign-compare -pthread")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG -Wno-unused-parameter -Wno-unused-const-variable")
endif(NOT MSVC)

set(SOURCES cpp/KineticGas.cpp cpp/KineticGas_mthr.cpp cpp/Spherical.cpp cpp/MieKinGas.cpp
cpp/Integration/Integration.cpp cpp/Factorial.cpp cpp/bindings.cpp)

if (CMAKE_BUILD_TYPE MATCHES Release)
project(pykingas)
set(TARGET pykingas)
else()
project(pykingas_d)
set(TARGET pykingas_d)
endif()

# Find the module development requirements (requires FindPython from 3.17 or
# scikit-build-core's built-in backport)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)

# Add a library using FindPython's tooling (pybind11 also provides a helper like
# this)
python_add_library(${TARGET} MODULE ${SOURCES} WITH_SOABI)
target_link_libraries(${TARGET} PRIVATE pybind11::headers)

# The install directory is the output (wheel) directory
install(TARGETS ${TARGET} DESTINATION pykingas)
36 changes: 0 additions & 36 deletions cpp/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion cpp/MieKinGas.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class MieKinGas : public Spherical {
// Contact diameter related methods
// bmax[i][j] is in units of sigma[i][j]
// bmax = The maximum value of the impact parameter at which deflection angle (chi) is positive
std::vector<std::vector<double>> get_b_max(double T);
std::vector<std::vector<double>> get_b_max (double T) override;
std::vector<std::vector<double>> get_collision_diameters(double rho, double T, const std::vector<double>& x) override;
virtual std::vector<std::vector<double>> get_BH_diameters(double T);
std::vector<std::vector<double>> get_vdw_alpha(){return alpha;}
Expand Down
4 changes: 2 additions & 2 deletions cpp/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ using vector2d = std::vector<vector1d>;


#ifndef DEBUG
PYBIND11_MODULE(KineticGas_r, handle){
PYBIND11_MODULE(pykingas, handle){
#else
PYBIND11_MODULE(KineticGas_d, handle){
PYBIND11_MODULE(pykingas_d, handle){
#endif
handle.doc() = "Is this documentation? This is documentation.";
handle.def("ipow", &ipow);
Expand Down
19 changes: 0 additions & 19 deletions cpp/build.sh

This file was deleted.

4 changes: 2 additions & 2 deletions pykingas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class bcolors: # For fancy (readable) printing during tests
args = sys.argv

if '-debug' in args or 'debug' in args or '-d' in args:
from . import KineticGas_d as __cpp_Module__
from . import pykingas_d as __cpp_Module__
else:
from . import KineticGas_r as __cpp_Module__
from . import pykingas as __cpp_Module__

# Expose everything in the __cpp_Module__ through the pykingas module
for _attr in dir(__cpp_Module__):
Expand Down
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[build-system]
requires = ["scikit-build-core>=0.9.3", "pybind11"]
build-backend = "scikit_build_core.build"


[project]
name = "pykingas"
version = "2.0.0"
description="Revised Enskog theory for Mie fluids, and other spherical potentials. Allows prediction of transport coefficients such as diffusion coefficients, viscosities, thermal diffusion coefficients and thermal conductivities. In dense, multicomponent gas mixtures and supercritical mixtures."
readme = "README.md"
authors = [
{ name = "Vegard Gjeldvik Jervell", email = "vegard.g.j@icloud.com" },
]
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.optional-dependencies]
test = ["pytest"]


[tool.scikit-build]
wheel.expand-macos-universal-tags = true


[tool.cibuildwheel]
#test-command = "pytest {project}/tests"
#test-requires = ["pytest", "numpy~=1.22", "scipy~=1.7", "thermopack~=2.2"]
#test-extras = ["test"]
#test-skip = ["*universal2:arm64"]
build-verbosity = 1
22 changes: 0 additions & 22 deletions setup.py

This file was deleted.