Skip to content

Commit 52f94b0

Browse files
authored
Update build to use scikit-build-core (#165)
* modernize with scikit-build-core * update metata * CI churn * add convenience for printing info about the library and getting the pdal-plugin-path * Release build type * Test --no-deps --no-build-isolation * release stuff * add note about needing PDAL base library to PyPI README * dynamic version, pin scikit-build-core > 0.9 * remove cruft
1 parent dc8b1b5 commit 52f94b0

19 files changed

+208
-48
lines changed

.github/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: testenv
22
channels:
33
- conda-forge
44
dependencies:
5-
- scikit-build
5+
- scikit-build-core
66
- numpy
77
- compilers
88
- pybind11

.github/workflows/build.yml

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,60 +35,30 @@ jobs:
3535
with:
3636
repository: PDAL/python-plugins
3737
path: ./plugins
38+
ref: main
3839

3940
- name: Setup micromamba
4041
uses: conda-incubator/setup-miniconda@v3
4142
with:
4243
miniforge-variant: Mambaforge
4344
miniforge-version: latest
45+
python-version: ${{ matrix.python-version }}
4446
use-mamba: true
4547
auto-update-conda: true
4648
environment-file: .github/environment.yml
4749

4850
- name: Install python-pdal
49-
run: pip install .
51+
run: |
52+
pip install -vv . --no-deps --no-build-isolation
5053
5154
- name: Install python-pdal-plugins
5255
working-directory: ./plugins
53-
run: pip install .
56+
run: pip install -vv . --no-deps --no-build-isolation
5457

5558
- name: Test
5659
run: |
57-
export PDAL_DRIVER_PATH=$(python -c "import os, skbuild; print(os.path.join('plugins', skbuild.constants.SKBUILD_DIR(), 'cmake-build'))")
60+
export PDAL_DRIVER_PATH=$(python -m pdal --pdal-plugin-path)
61+
echo $PDAL_DRIVER_PATH
5862
pdal --drivers --debug
5963
py.test -v test/
6064
61-
- name: Build source distribution
62-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
63-
run: python setup.py sdist
64-
65-
- name: Upload distribution(s)
66-
uses: actions/upload-artifact@v3
67-
with:
68-
name: ${{ matrix.os }}-py${{ matrix.python-version }}
69-
path: ./dist/*
70-
71-
publish:
72-
runs-on: ubuntu-latest
73-
needs: [build]
74-
75-
steps:
76-
- name: Download distributions
77-
uses: actions/download-artifact@v3
78-
with:
79-
path: ./artifacts
80-
81-
- name: Move artifacts to dist
82-
run: |
83-
mkdir dist
84-
find ./artifacts -type f -exec mv {} ./dist \;
85-
tree ./dist
86-
87-
- name: Publish package
88-
uses: pypa/gh-action-pypi-publish@release/v1
89-
if: github.event_name == 'release' && github.event.action == 'published'
90-
with:
91-
user: __token__
92-
password: ${{ secrets.PYPI_TOKEN }}
93-
packages_dir: ./dist
94-
verbose: true

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
pypi-publish:
14+
name: Upload release to PyPI
15+
runs-on: ubuntu-latest
16+
environment:
17+
name: release
18+
url: https://pypi.org/p/pdal-plugins
19+
permissions:
20+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
21+
strategy:
22+
fail-fast: true
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Setup micromamba
27+
uses: conda-incubator/setup-miniconda@v3
28+
with:
29+
miniforge-variant: Mambaforge
30+
miniforge-version: latest
31+
use-mamba: true
32+
python-version: ${{ matrix.python-version }}
33+
auto-update-conda: true
34+
environment-file: .github/environment.yml
35+
36+
- name: Install dependencies
37+
shell: bash -l {0}
38+
run: |
39+
python -m pip install build pipx twine
40+
pipx run build --sdist
41+
42+
- name: Publish package distributions to PyPI
43+
if: github.event_name == 'release' && github.event.action == 'published'
44+
uses: pypa/gh-action-pypi-publish@release/v1

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.11.0)
2-
project(pdal-python)
2+
project(pdal-python VERSION)
33

44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -23,17 +23,17 @@ endif()
2323
find_package(Python3 COMPONENTS Interpreter ${DEVELOPMENT_COMPONENT} NumPy REQUIRED)
2424

2525
# find PDAL. Require 2.1+
26-
find_package(PDAL 2.5 REQUIRED)
26+
find_package(PDAL 2.6 REQUIRED)
2727

2828
# find PyBind11
2929
find_package(pybind11 REQUIRED)
3030

3131
set(extension "libpdalpython")
3232
pybind11_add_module(${extension} MODULE
33-
pdal/PyArray.cpp
34-
pdal/PyPipeline.cpp
35-
pdal/StreamableExecutor.cpp
36-
pdal/libpdalpython.cpp
33+
src/pdal/PyArray.cpp
34+
src/pdal/PyPipeline.cpp
35+
src/pdal/StreamableExecutor.cpp
36+
src/pdal/libpdalpython.cpp
3737
)
3838
target_include_directories(${extension} PRIVATE ${Python3_NumPy_INCLUDE_DIRS})
3939
target_link_libraries(${extension} PRIVATE ${PDAL_LIBRARIES})

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Additionally, you can use it to fetch `schema`_ and `metadata`_ from PDAL operat
99
Installation
1010
--------------------------------------------------------------------------------
1111

12+
**Note** The PDAL Python bindings require the PDAL base library installed. Source code can be found at https://pdal.io and `GitHub <https://github.com/PDAL/PDAL>`__.
13+
1214
PyPI
1315
................................................................................
1416

@@ -307,8 +309,8 @@ USE-CASE : Take a LiDAR map, create a mesh from the ground points, split into ti
307309
Requirements
308310
================================================================================
309311

310-
* PDAL 2.5+
312+
* PDAL 2.6+
311313
* Python >=3.9
312314
* Pybind11 (eg :code:`pip install pybind11[global]`)
313315
* Numpy (eg :code:`pip install numpy`)
314-
* scikit-build (eg :code:`pip install scikit-build`)
316+
* scikit-build-core (eg :code:`pip install scikit-build-core`)

pyproject.toml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,69 @@
1+
[project]
2+
name = "pdal"
3+
description = "Point cloud data processing"
4+
readme = "README.rst"
5+
requires-python = ">=3.9"
6+
license = {file = "LICENSE.txt"}
7+
keywords = ["point", "cloud", "spatial"]
8+
authors = [
9+
{email = "[email protected]"},
10+
{name = "Howard Butler"}
11+
]
12+
maintainers = [
13+
{name = "Howard Butler", email = "[email protected]"}
14+
]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Developers",
18+
"Intended Audience :: Science/Research",
19+
"License :: OSI Approved :: BSD License",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Topic :: Scientific/Engineering :: GIS",
26+
]
27+
28+
dependencies = [
29+
"numpy"
30+
]
31+
32+
dynamic = ["version"]
33+
34+
[project.optional-dependencies]
35+
test = [
36+
"pandas",
37+
"meshio"
38+
]
39+
40+
[tool.setuptools]
41+
package-dir = {"" = "src"}
42+
zip-safe = false
43+
44+
[project.urls]
45+
homepage = "https://pdal.io"
46+
documentation = "https://pdal.io"
47+
repository = "https://github.com/PDAL/Python"
48+
changelog = "https://github.com/PDAL/python/blob/main/README.rst"
49+
150
[build-system]
2-
requires = ["scikit-build", "cmake>=3.11", "ninja", "numpy", "pybind11[global]"]
51+
requires = ["scikit-build-core >= 0.9", "numpy", "pybind11[global]"]
52+
build-backend = "scikit_build_core.build"
53+
54+
55+
[tool.scikit-build]
56+
build-dir = "build/{wheel_tag}"
57+
sdist.exclude = [".github"]
58+
sdist.cmake = true
59+
cmake.build-type = "Release"
60+
sdist.include = [
61+
"src",
62+
"CMakeLists.txt"
63+
]
64+
cmake.verbose = false
65+
logging.level = "ERROR"
66+
67+
[tool.scikit-build.metadata.version]
68+
provider = "scikit_build_core.metadata.regex"
69+
input = "src/pdal/__init__.py"
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)