diff --git a/.github/environment.yml b/.github/environment.yml index 5663558..0338746 100644 --- a/.github/environment.yml +++ b/.github/environment.yml @@ -7,8 +7,7 @@ dependencies: - libpdal-core - compilers - python - - pip - - scikit-build-core - pybind11 - cmake - ninja + - uv diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 661d682..3186f80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,6 +36,11 @@ jobs: - name: Check out uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v8.3.1 + with: + enable-cache: true + - name: Setup micromamba uses: conda-incubator/setup-miniconda@v3 with: @@ -49,12 +54,14 @@ jobs: - name: Install Numpy ${{ matrix.numpy-version }} shell: bash -l {0} run: | - mamba install numpy=${{ matrix.numpy-version }} + PYTHON=$(python -c 'import sys; print(sys.executable)') + uv pip install --python "$PYTHON" --reinstall "numpy==${{ matrix.numpy-version }}.*" - name: Install shell: bash -l {0} run: | - pip install . -Ccmake.define.WITH_TESTS=ON . + PYTHON=$(python -c 'import sys; print(sys.executable)') + uv pip install --python "$PYTHON" --no-build-isolation -Ccmake.define.WITH_TESTS=ON . - name: Test Unix shell: bash -l {0} @@ -76,8 +83,8 @@ jobs: run: | sudo apt-get update -y sudo apt-get install pkg-config libssl-dev -y - python -m pip install build pipx twine - pipx run build --sdist -Ccmake.define.CMAKE_BUILD_WITH_INSTALL_RPATH=ON + PYTHON=$(python -c 'import sys; print(sys.executable)') + uv build --python "$PYTHON" --sdist -Ccmake.define.CMAKE_BUILD_WITH_INSTALL_RPATH=ON - name: Test Windows if: matrix.os == 'windows-latest' @@ -93,5 +100,3 @@ jobs: pdal --drivers $PDAL_DRIVER_PATH/pdal_filters_python_test$EXT $PDAL_DRIVER_PATH/pdal_io_numpy_test$EXT - - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80ea68c..5e5623f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,12 @@ jobs: fail-fast: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v8 + with: + enable-cache: true + - name: Setup micromamba uses: conda-incubator/setup-miniconda@v3 with: @@ -33,11 +38,11 @@ jobs: auto-update-conda: true environment-file: .github/environment.yml - - name: Install dependencies + - name: Build source distribution shell: bash -l {0} run: | - python -m pip install build pipx twine - pipx run build --sdist -Ccmake.define.CMAKE_BUILD_WITH_INSTALL_RPATH=ON + PYTHON=$(python -c 'import sys; print(sys.executable)') + uv build --python "$PYTHON" --sdist -Ccmake.define.CMAKE_BUILD_WITH_INSTALL_RPATH=ON - name: Publish package distributions to PyPI if: github.event_name == 'release' && github.event.action == 'published' diff --git a/.gitignore b/.gitignore index 98c8507..37e77af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ .vscode/ +.venv/ _skbuild/ MANIFEST +build/ +build-*/ dist/ +wheels/ *.egg-info/ *.o *.so diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a1357c..be10b35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.0) +cmake_minimum_required(VERSION 3.15.0) project(pdal-python-plugins VERSION ${SKBUILD_PROJECT_VERSION} DESCRIPTION "PDAL Python Plugins" HOMEPAGE_URL "https://github.com/PDAL/python-plugins") @@ -15,8 +15,8 @@ set(Python3_FIND_FRAMEWORK "LAST") find_package(Python3 COMPONENTS Interpreter Development.Module Development.Embed NumPy REQUIRED) -# find PDAL. Require 2.1+ -find_package(PDAL 2.6 REQUIRED) +# find PDAL. +find_package(PDAL 2.7 REQUIRED) # Taken and adapted from PDAL's cmake macros.cmake diff --git a/README.rst b/README.rst index 8c5fda7..c75fe03 100644 --- a/README.rst +++ b/README.rst @@ -5,8 +5,8 @@ PDAL Python Plugins PDAL Python plugins allow you to process data with PDAL into `Numpy `__ arrays. They support embedding Python in PDAL pipelines with the -`readers.numpy `__ and -`filters.python `__ stages. +`readers.numpy `__ and +`filters.python `__ stages. Installation -------------------------------------------------------------------------------- @@ -18,7 +18,9 @@ PDAL Python plugins are installable via PyPI: .. code-block:: - pip install pdal-plugins + uv pip install pdal-plugins + +If you are not using uv, :code:`pip install pdal-plugins` works too. GitHub ................................................................................ @@ -33,5 +35,47 @@ Requirements * PDAL 2.6+ * Python >=3.9 -* Numpy (eg :code:`pip install numpy`) -* scikit-build-core (eg :code:`pip install scikit-build-core`) +* uv +* Numpy +* scikit-build-core +* pybind11 +* CMake and Ninja + +Development +================================================================================ + +The project uses uv for Python package installation and builds, with +scikit-build-core driving the CMake build. + +Create a development environment with the same dependencies used by CI: + +.. code-block:: bash + + mamba env create -f .github/environment.yml + mamba activate test + +Install the plugins into that environment and build the C++ tests: + +.. code-block:: bash + + PYTHON=$(python -c 'import sys; print(sys.executable)') + uv pip install --python "$PYTHON" --no-build-isolation -Ccmake.define.WITH_TESTS=ON . + +Run the tests from the scikit-build output directory: + +.. code-block:: bash + + export PYTHONHOME=$CONDA_PREFIX + export PATH=$CONDA_PREFIX/bin:$PATH + export WHEEL_DIR=$(python -m scikit_build_core.builder.wheel_tag) + export PDAL_DRIVER_PATH=$(pwd)/build/$WHEEL_DIR/Release + pdal --drivers + $PDAL_DRIVER_PATH/pdal_filters_python_test + $PDAL_DRIVER_PATH/pdal_io_numpy_test + +Build source and wheel distributions with uv: + +.. code-block:: bash + + PYTHON=$(python -c 'import sys; print(sys.executable)') + uv build --python "$PYTHON" diff --git a/pyproject.toml b/pyproject.toml index b57762e..2b3ddfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,8 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Scientific/Engineering :: GIS", ] @@ -29,18 +31,29 @@ dependencies = [ "numpy >= 1.22" ] -version="1.6.6" +version="1.6.7" [project.optional-dependencies] test = [ ] +[dependency-groups] +build = [ + "numpy >= 1.22", + "pybind11[global]", + "scikit-build-core", +] +test = [ ] + +[tool.uv] +package = true + [tool.setuptools] package-dir = {"" = "src"} zip-safe = false [project.urls] -homepage = "https://pdal.io" -documentation = "https://pdal.io" +homepage = "https://pdal.org" +documentation = "https://pdal.org" repository = "https://github.com/PDAL/python-plugins" changelog = "https://github.com/PDAL/python-plugins/blob/main/README.rst" @@ -62,7 +75,7 @@ sdist.include = [ "src", "CMakeLists.txt" ] -cmake.verbose = true +build.verbose = true logging.level = "INFO" #[tool.scikit-build.cmake.define] diff --git a/src/pdal/filters/PythonFilter.hpp b/src/pdal/filters/PythonFilter.hpp index 19f3d03..7ee45ff 100644 --- a/src/pdal/filters/PythonFilter.hpp +++ b/src/pdal/filters/PythonFilter.hpp @@ -35,7 +35,6 @@ #pragma once #include -#include #include "../plang/Invocation.hpp"