-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3960 from ornladios/add-pip-packaging
Add pip packaging
- Loading branch information
Showing
14 changed files
with
341 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Python Packaging | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
overrideVersion: | ||
description: Manually force a version | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- release_[0-9]+ | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+* | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
ADIOS2_CUSTOM_VERSION_OVERRIDE: ${{ github.event.inputs.overrideVersion }} | ||
|
||
jobs: | ||
make_sdist: | ||
name: Make SDist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate common version file | ||
run: cmake -P scripts/ci/gh-actions/config/adios-version.cmake && echo VERSION.TXT | ||
|
||
- name: Build SDist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
build_wheels: | ||
name: Wheel on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# os: [ubuntu-latest, windows-latest, macos-latest] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate common version file | ||
run: cmake -P scripts/ci/gh-actions/config/adios-version.cmake && echo VERSION.TXT | ||
|
||
- uses: pypa/cibuildwheel@v2.16 | ||
env: | ||
CIBW_BUILD: cp*-manylinux_x86_64 | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: wheelhouse/*.whl | ||
|
||
upload_pypi: | ||
needs: [build_wheels, make_sdist] | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
upload_test_pypi: | ||
needs: [build_wheels, make_sdist] | ||
environment: testpypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
# Upload to Test PyPI for every commit on main branch | ||
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Publish package distributions to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import adios2 | ||
|
||
import sys | ||
import unittest | ||
|
||
|
||
DATA_FILENAME = "hello-world-py.bp" | ||
|
||
class TestSimpleReadWrite(unittest.TestCase): | ||
|
||
def _write(self, ad, greeting): | ||
"""write a string to a bp file""" | ||
io = ad.DeclareIO("hello-world-writer") | ||
var_greeting = io.DefineVariable("Greeting") | ||
w = io.Open(DATA_FILENAME, adios2.Mode.Write) | ||
w.BeginStep() | ||
w.Put(var_greeting, greeting) | ||
w.EndStep() | ||
w.Close() | ||
return 0 | ||
|
||
def _read(self, ad): | ||
"""read a string from to a bp file""" | ||
io = ad.DeclareIO("hello-world-reader") | ||
r = io.Open(DATA_FILENAME, adios2.Mode.Read) | ||
r.BeginStep() | ||
var_greeting = io.InquireVariable("Greeting") | ||
message = r.Get(var_greeting) | ||
r.EndStep() | ||
r.Close() | ||
return message | ||
|
||
def test_simple_read_write(self): | ||
"""driver function""" | ||
print("ADIOS2 version {0}".format(adios2.__version__)) | ||
ad = adios2.ADIOS() | ||
greeting = "Hello World from ADIOS2" | ||
self._write(ad, greeting) | ||
message = self._read(ad) | ||
print("{}".format(message)) | ||
self.assertEqual(greeting, message) | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
[build-system] | ||
requires = ["scikit-build-core", "numpy", "setuptools_scm>=8"] | ||
build-backend = "scikit_build_core.build" | ||
|
||
[project] | ||
name = "adios2" | ||
dynamic = ["version"] | ||
authors = [ | ||
{ name="Caitlin Ross", email="caitlin.ross@kitware.com" }, | ||
{ name="Chuck Atkins", email="chuck.atkins@kitware.com" }, | ||
{ name="Greg S. Eisenhauer", email="eisen@cc.gatech.edu" }, | ||
{ name="Junmin Gu", email="jgu@lbl.gov" }, | ||
{ name="Norbert Podhorszki", email="pnorbert@ornl.gov" }, | ||
{ name="Ruonan (Jason) Wang", email="wangr1@ornl.gov" }, | ||
{ name="Scott Wittenburg", email="scott.wittenburg@kitware.com" }, | ||
{ name="Spiros Tsalikis", email="spiros.tsalikis@kitware.com" }, | ||
{ name="V. A. Bolea Sanchez", email="vicente.bolea@kitware.com" }, | ||
{ name="William F. Godoy", email="godoywf@ornl.gov" }, | ||
] | ||
description = "The Adaptable Input Output System version 2" | ||
readme = "ReadMe.md" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Programming Language :: C++", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"numpy", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/ornladios/adios2" | ||
Documentation = "https://adios2.readthedocs.io/" | ||
"Bug Tracker" = "https://github.com/ornladios/adios2/issues" | ||
Discussions = "https://github.com/ornladios/ADIOS2/discussions" | ||
Changelog = "https://github.com/ornladios/ADIOS2/releases" | ||
|
||
[tool.cibuildwheel] | ||
# Trigger an install of the package, and run a basic test | ||
test-command = "python -m unittest adios2.test.simple_read_write.TestSimpleReadWrite" | ||
|
||
[tool.scikit-build] | ||
wheel.packages = ["adios2"] | ||
|
||
[tool.scikit-build.metadata.version] | ||
provider = "scikit_build_core.metadata.regex" | ||
input = "VERSION.TXT" | ||
regex = "^(?P<value>.+?)$" | ||
|
||
[tool.scikit-build.cmake.define] | ||
ADIOS2_USE_PIP = "ON" | ||
ADIOS2_USE_Python = "ON" | ||
ADIOS2_USE_Fortran = "OFF" | ||
ADIOS2_USE_MPI = "OFF" | ||
ADIOS2_USE_HDF5 = "OFF" | ||
ADIOS2_USE_HDF5_VOL = "OFF" | ||
ADIOS2_USE_BZip2 = "OFF" | ||
ADIOS2_USE_Blosc2 = "OFF" | ||
ADIOS2_USE_DataMan = "OFF" | ||
ADIOS2_USE_SZ = "OFF" | ||
ADIOS2_USE_ZeroMQ = "OFF" | ||
ADIOS2_USE_ZFP = "OFF" | ||
BUILD_TESTING = "OFF" | ||
ADIOS2_INSTALL_GENERATE_CONFIG = "OFF" |
Oops, something went wrong.