Skip to content

Commit

Permalink
Merge pull request #42 from rahil-makadia/dev
Browse files Browse the repository at this point in the history
creating binary wheels again
  • Loading branch information
rahil-makadia authored Feb 20, 2024
2 parents db065f0 + c3bcc37 commit 598cb58
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 39 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/cpp_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ on:
branches:
- main
- dev
paths:
- 'include/**'
- 'src/**'
- 'tests/cpp/**'

jobs:
prop-only:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build GRSS library
run: |
source initialize.sh --tm-overwrite
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install GRSS (including dependencies)
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/joss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ on:
branches:
- main
- dev
paths:
- 'joss/**'

jobs:
paper:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
Expand Down
82 changes: 55 additions & 27 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,58 @@ permissions:
id-token: write

jobs:
build-and-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Initialize repository
run: |
source initialize.sh --no-tm-overwrite
- name: Run build script
run: source build_python.sh
- name: Show files
run: ls -l dist
- name: Publish to Test PyPI
if: github.ref == 'refs/heads/dev'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
build:
name: build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up Xcode
if: matrix.os == 'macos-14'
uses: maxim-lobanov/[email protected]
with:
xcode-version: '15.1.0'
- name: Initialize repository
run: |
source initialize.sh --no-tm-overwrite
- name: Build python distributions
run: source build_python.sh
- name: Upload distribution for next job
uses: actions/upload-artifact@master
with:
name: dist-${{ matrix.os }}
path: dist
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Ubuntu distribution from previous job
uses: actions/download-artifact@master
with:
name: dist-ubuntu-latest
path: dist
- name: Download MacOS distribution from previous job
uses: actions/download-artifact@master
with:
name: dist-macos-14
path: dist
- name: Show files
run: ls -l dist
- name: Publish to Test PyPI
if: github.ref == 'refs/heads/dev'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install GRSS (including dependencies)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project(grss VERSION ${ver})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_compile_options(-std=c++11 -O3 -fPIC -fopenmp) # operational flags
# add_compile_options(-std=c++11 -DLONGDOUBLE -g3 -fPIC -fopenmp -Werror -Wall -Wextra -pedantic -Wno-unused-but-set-variable -Wno-unused-result) # debugging flags
# add_compile_options(-std=c++11 -DLONGDOUBLE -g3 -fPIC -fopenmp -Werror -Wall -Wextra -pedantic) # debugging flags

# Set header file directories
include_directories(${CMAKE_SOURCE_DIR}/include)
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include src/*.cpp
include src/CMakeLists.txt

include extern/get_cspice.py
recursive-include extern/pybind11 *
recursive-include tests *

include CMakeLists.txt
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ The GRSS library is available on PyPI and can be installed using the following c
pip install grss
```

If this installation fails (i.e., you get an error when importing GRSS), you can try installing it without using the binary wheel on PyPI by using the following command:

``` console
pip install grss --no-binary grss
```

NOTE: The GRSS library is currently not pip-installable on Intel-based Macs. To use the library on an Intel-based Mac, please install the library using the source code from the GitHub repository (see below for instructions).

### Install via source code
Expand Down
4 changes: 2 additions & 2 deletions build_python.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
rm -rf build dist grss.egg-info

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build twine cibuildwheel
python3 -m pip install --upgrade pip build twine cibuildwheel

python3 -m build --sdist --outdir dist
python3 -m cibuildwheel --output-dir dist

twine check dist/*
6 changes: 6 additions & 0 deletions docs/source/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ The GRSS library is available on PyPI and can be installed using the following c
pip install grss
If this installation fails (i.e., you get an error when importing GRSS), you can try installing it without using the binary wheel on PyPI by using the following command:

.. code-block:: console
pip install grss --no-binary grss
NOTE: The GRSS library is currently not pip-installable on Intel-based Macs. To use the library on an Intel-based Mac, please install the library using the source code from the GitHub repository (see below for instructions).

-----------------------
Expand Down
2 changes: 1 addition & 1 deletion grss/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.2.0
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,17 @@ package-data = {"grss" = [
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.cibuildwheel]
before-build = [
"pip install pybind11",
"rm -rf build",
"mkdir build",
"pybind11_DIR=$(pybind11-config --cmakedir)",
"cmake -Dpybind11_DIR=$pybind11_DIR -B./build -S.",
]

[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]
archs = ["arm64"]

[tool.cibuildwheel.linux]
archs = ["x86_64"]
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class CMakeBuild(build_ext):

def build_extension(self, ext: CMakeExtension) -> None:
subprocess.run(["./build_cpp.sh"], cwd=ext.sourcedir, check=True)
binary_created = [f for f in os.listdir(f"{ext.sourcedir}/build/")
if f.startswith("prop_simulation")]
if not binary_created:
raise FileNotFoundError("prop_simulation binary for C++ source code not found "
"in cmake build directory")
os.system(f"cp {ext.sourcedir}/build/prop_simulation* {self.build_lib}/grss/prop/")
return

Expand Down

0 comments on commit 598cb58

Please sign in to comment.