diff --git a/.github/workflows/cpp_tests.yml b/.github/workflows/cpp_tests.yml index 16034013..64ff9786 100644 --- a/.github/workflows/cpp_tests.yml +++ b/.github/workflows/cpp_tests.yml @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 499dedb6..37163390 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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) diff --git a/.github/workflows/joss.yml b/.github/workflows/joss.yml index 6161d8fd..fe48cfdd 100644 --- a/.github/workflows/joss.yml +++ b/.github/workflows/joss.yml @@ -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: diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index bd8f21a6..13600019 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -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/setup-xcode@v1.6.0 + 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 }} diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 5e8b762b..646e4eed 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -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) diff --git a/CMakeLists.txt b/CMakeLists.txt index c24610f7..f871713c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/MANIFEST.in b/MANIFEST.in index 1e3ca676..ac0c0820 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/README.md b/README.md index d5be566e..7cfb3a96 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build_python.sh b/build_python.sh index b556da21..9b3b3dbb 100755 --- a/build_python.sh +++ b/build_python.sh @@ -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/* diff --git a/docs/source/start.rst b/docs/source/start.rst index 323bee6a..51206728 100644 --- a/docs/source/start.rst +++ b/docs/source/start.rst @@ -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). ----------------------- diff --git a/grss/version.txt b/grss/version.txt index a0cd9f0c..a4f52a5d 100644 --- a/grss/version.txt +++ b/grss/version.txt @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.2.0 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index feb11db0..cc41d960 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/setup.py b/setup.py index 789dc4a2..918c4f81 100644 --- a/setup.py +++ b/setup.py @@ -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