diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml new file mode 100644 index 0000000..4e830e6 --- /dev/null +++ b/.github/workflows/cibuildwheel.yml @@ -0,0 +1,77 @@ +name: Build and upload to PyPI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macos-10.15] + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: 3.8 + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v1 + with: + platforms: all + - name: Build wheels + uses: pypa/cibuildwheel@v2.0.0 + env: + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_BUILD: cp3?-* + CIBW_SKIP: cp27-* cp36-* *-win32 *-manylinux_i686 + CIBW_ARCHS_LINUX: x86_64 aarch64 + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 + CIBW_BEFORE_BUILD: pip install pybind11 + CIBW_TEST_COMMAND: pytest {project}/tests + CIBW_TEST_REQUIRES: pytest numpy + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: 3.8 + - name: Build sdist + run: python setup.py sdist + - uses: actions/upload-artifact@v2 + with: + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + # upload to PyPI on every tag starting with 'v' + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a11edc3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: python -jobs: - include: - - os: linux - services: docker - - os: osx - language: shell - osx_image: xcode12.5 - - os: windows - language: shell - before_install: - - choco install python --version 3.8.10 - - export PATH="/c/Python38:/c/Python38/Scripts:$PATH" - - ln -s /c/Python38/python.exe /c/Python38/python3.exe -env: - global: - - CIBW_BEFORE_ALL_LINUX="yum install -y cmake3 && ln -s /usr/bin/cmake3 /usr/bin/cmake" - - CIBW_MANYLINUX_X86_64_IMAGE="manylinux2014" - - CIBW_BUILD="cp3?-*" - - CIBW_SKIP="cp27-* *-win32 *-manylinux_i686" - - TWINE_USERNAME=__token__ - - CIBW_BEFORE_BUILD="pip install pybind11" - - CIBW_TEST_COMMAND="pytest {project}/tests" - - CIBW_TEST_REQUIRES="pytest numpy" -install: - - python3 -m pip install cibuildwheel -script: - - python3 -m cibuildwheel --output-dir wheelhouse -after_success: - - | - if [[ $TRAVIS_TAG ]]; then - python3 -m pip install twine - python3 -m twine upload wheelhouse/*.whl - fi diff --git a/README.md b/README.md index 1c0c7fb..a60850f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ print(result) # [[1], [1, 2]] ``` -## New features (`python-prtree>=0.4.0`) +## New features +### `python-prtree>=0.4.0` You can use PRTree3D: ```python @@ -49,8 +50,7 @@ print(result) # [[1], [1, 2]] ``` - -## New features (`python-prtree>=0.3.0`) +### `python-prtree>=0.3.0` You can save and load a binary file as follows: ```python diff --git a/setup.py b/setup.py index db26571..15da2a2 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ def build_extension(self, ext): setup( name='python_prtree', - version='0.4.0', + version='0.4.2', license='MIT', description='Python implementation of Priority R-Tree', author='atksh', diff --git a/test.sh b/test.sh index aa25acc..5cc393c 100644 --- a/test.sh +++ b/test.sh @@ -1,4 +1,3 @@ -clear rm -rf build dist .pytest_cache CXX=/usr/bin/g++ pip install . pytest tests -vv --capture=no diff --git a/tests/test_PRTree.py b/tests/test_PRTree.py index 74160b9..3d54f5d 100644 --- a/tests/test_PRTree.py +++ b/tests/test_PRTree.py @@ -11,6 +11,7 @@ def has_intersect(x, y, dim): @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3)]) def test_result(PRTree, dim): + np.random.seed(1) idx = np.arange(100) x = np.random.rand(len(idx), 2 * dim) for i in range(dim): @@ -25,6 +26,7 @@ def test_result(PRTree, dim): @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3)]) def test_io(PRTree, dim, tmp_path): + np.random.seed(1) idx = np.arange(100) x = np.random.rand(len(idx), 2 * dim) for i in range(dim): @@ -53,6 +55,7 @@ def test_io(PRTree, dim, tmp_path): @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3)]) def test_insert_erase(PRTree, dim): + np.random.seed(1) N = 10000 idx = np.arange(N) x = np.random.rand(N, 2 * dim) diff --git a/third/pybind11 b/third/pybind11 index f61855b..e58c689 160000 --- a/third/pybind11 +++ b/third/pybind11 @@ -1 +1 @@ -Subproject commit f61855b9d8821e2576960109a2a67379a6c2366f +Subproject commit e58c6897cc7b77b92e1c49df82a3504f777b97c9