Skip to content
Open
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
57 changes: 57 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and upload to PyPI

on:
pull_request:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-11]
Comment thread
shimwell marked this conversation as resolved.

steps:
- uses: actions/checkout@v3

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

- uses: actions/upload-artifact@v3.1.2
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build sdist
run: |
pipx run build --sdist
- uses: actions/upload-artifact@v3.1.2
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3.1.2
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.8.5
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ src/CMakeFiles/
src/bin/
src/cmake_install.cmake
src/install_manifest.txt
_skbuild

# Nuclear data
scripts/nndc
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ recursive-include vendor *.hh
recursive-include vendor *.hpp
recursive-include vendor *.pc.in
recursive-include vendor *.natvis
global-include openmc
include vendor/gsl-lite/include/gsl/gsl
prune docs/build
prune docs/source/pythonapi/generated/
22 changes: 21 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
[build-system]
requires = ["setuptools", "wheel", "numpy", "cython"]
requires = [
"setuptools",
"wheel",
"numpy",
"cython",
"scikit-build>=0.17.6",
"cmake>=3.10.0",
"h5py",
]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
skip = "cp36-*"

[tool.cibuildwheel.macos]
skip = "cp36-* cp37-*"
before-all = "brew install homebrew/core/hdf5"
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"

[tool.cibuildwheel.linux]
manylinux-x86_64-image = "ghcr.io/h5py/manylinux2014_x86_64-hdf5"
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import sys
import numpy as np

from setuptools import setup, find_packages
from setuptools import find_packages
from skbuild import setup
from Cython.Build import cythonize


Expand All @@ -23,11 +24,11 @@
'name': 'openmc',
'version': version,
'packages': find_packages(exclude=['tests*']),
'scripts': glob.glob('scripts/openmc-*'),
'scripts': glob.glob('scripts/openmc-*'), # fails build + ['bin/openmc'],

# Data files and libraries
'package_data': {
'openmc.lib': ['libopenmc.{}'.format(suffix)],
# 'openmc.lib': ['libopenmc.{}'.format(suffix)],
'openmc.data': ['mass_1.mas20.txt', 'BREMX.DAT', 'half_life.json', '*.h5'],
'openmc.data.effective_dose': ['*.txt']
},
Expand Down Expand Up @@ -76,7 +77,9 @@
},
# Cython is used to add resonance reconstruction and fast float_endf
'ext_modules': cythonize('openmc/data/*.pyx'),
'include_dirs': [np.get_include()]
'include_dirs': [np.get_include()],
'include_package_data': True,
# cmake_args=['-DSOME_FEATURE:BOOL=OFF']
}

setup(**kwargs)