Skip to content

Commit eac3fb9

Browse files
authored
Merge pull request #104 from urschrei/shugel/push-puxyyqsrmyyu
Switch to scikit-build
2 parents 1e01536 + fbd96de commit eac3fb9

6 files changed

Lines changed: 121 additions & 85 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@ updates:
99
# if you use those, you don't need updates.
1010
- dependency-name: "actions/*"
1111

12-
- package-ecosystem: pip
12+
- package-ecosystem: "uv"
1313
directory: "/"
1414
schedule:
15-
interval: daily
16-
open-pull-requests-limit: 10
15+
interval: "monthly"
16+
open-pull-requests-limit: 20
17+
groups:
18+
# Specify a name for the group, which will be used in pull request titles
19+
# and branch names
20+
python-non-security-dependencies:
21+
# Define patterns to include dependencies in the group (based on
22+
# dependency name)
23+
applies-to: version-updates # Applies the group rule to version updates
24+
patterns:
25+
- "*"

.github/workflows/wheels.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@ permissions:
55
attestations: write
66
contents: read
77

8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
tags:
14+
- 'v*'
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
820
env:
921
rustlib: lonlat_bng
1022
wheelname: convertbng
1123
CIBW_BUILD_FRONTEND: build[uv]
1224

13-
on: [push, pull_request]
1425

1526
jobs:
1627
get_latest_lib_tag:

CMakeLists.txt

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
cmake_minimum_required(VERSION 3.15...3.27)
2+
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
3+
4+
# Find Python
5+
find_package(
6+
Python
7+
COMPONENTS Interpreter Development.Module NumPy
8+
REQUIRED)
9+
10+
# Get NumPy include directory
11+
message(STATUS "NumPy include directory: ${Python_NumPy_INCLUDE_DIRS}")
12+
13+
# Cythonize the .pyx file to .c
14+
add_custom_command(
15+
OUTPUT cutil.c
16+
COMMENT "Cythonizing ${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng/cutil.pyx"
17+
COMMAND Python::Interpreter -m cython
18+
"${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng/cutil.pyx"
19+
--output-file cutil.c
20+
-I "${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng"
21+
DEPENDS src/convertbng/cutil.pyx src/convertbng/convertbng_p.pxd
22+
VERBATIM)
23+
24+
# Create the extension module
25+
python_add_library(cutil MODULE cutil.c WITH_SOABI)
26+
27+
# Set include directories
28+
target_include_directories(cutil PRIVATE
29+
${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng
30+
${Python_NumPy_INCLUDE_DIRS}
31+
)
32+
33+
# Link against the Rust library
34+
# The library is pre-built and located in src/convertbng/
35+
find_library(LONLAT_BNG_LIBRARY
36+
NAMES lonlat_bng liblonlat_bng
37+
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng
38+
NO_DEFAULT_PATH
39+
REQUIRED
40+
)
41+
message(STATUS "Found lonlat_bng library: ${LONLAT_BNG_LIBRARY}")
42+
43+
target_link_libraries(cutil PRIVATE ${LONLAT_BNG_LIBRARY})
44+
45+
# Set RPATH for different platforms
46+
if(APPLE)
47+
set_target_properties(cutil PROPERTIES
48+
INSTALL_RPATH "@loader_path"
49+
BUILD_WITH_INSTALL_RPATH TRUE
50+
)
51+
elseif(UNIX)
52+
set_target_properties(cutil PROPERTIES
53+
INSTALL_RPATH "$ORIGIN"
54+
BUILD_WITH_INSTALL_RPATH TRUE
55+
)
56+
endif()
57+
58+
# Install the extension module
59+
install(TARGETS cutil DESTINATION convertbng)
60+
61+
# Install the shared library
62+
if(APPLE)
63+
set(RDP_LIB_NAME "liblonlat_bng.dylib")
64+
elseif(UNIX)
65+
set(RDP_LIB_NAME "liblonlat_bng.so")
66+
elseif(WIN32)
67+
set(RDP_LIB_NAME "lonlat_bng.dll")
68+
endif()
69+
70+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng/${RDP_LIB_NAME}
71+
DESTINATION convertbng)
72+
73+
# Install header file
74+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/convertbng/header.h
75+
DESTINATION convertbng)

pyproject.toml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[project]
22
name = "convertbng"
3-
dynamic = ["version", "readme"]
3+
version = "0.7.9"
44
description = "Fast lon, lat to and from ETRS89 and BNG (OSGB36) using the OS OSTN15 transform via Rust FFI"
5-
license = "BlueOak-1.0.0"
6-
license-files = ["LICENSE.md"]
5+
readme = "README.md"
76
requires-python = ">=3.10"
87
dependencies = [
98
"numpy >= 2.0.0",
109
]
1110
authors = [{ name = "Stephan Hügel", email = "urschrei@gmail.com" }]
11+
license = "BlueOak-1.0.0"
12+
license-files = ["LICENSE.md"]
1213
keywords = ["Geo", "OSTN02", "OSTN15", "BNG", "OSGB36", "GIS"]
1314
classifiers = [
1415
"Programming Language :: Python",
@@ -29,31 +30,28 @@ classifiers = [
2930
Repository = "https://github.com/urschrei/convertbng"
3031
Tracker = "https://github.com/urschrei/convertbng/issues"
3132

32-
[project.optional-dependencies]
33-
test = ["pytest >= 7.4.2"]
33+
[dependency-groups]
34+
dev = [
35+
"pytest>=8.4.1",
36+
]
3437

35-
[tool.setuptools.dynamic]
36-
readme = {file = "README.md", content-type = "text/markdown"}
38+
[tool.scikit-build]
39+
minimum-version = "build-system.requires"
40+
wheel.packages = ["src/convertbng"]
3741

3842
[build-system]
39-
build-backend = "setuptools.build_meta"
4043
requires = [
41-
"setuptools >= 45",
42-
"setuptools-scm[toml] >= 6.2",
44+
"scikit-build-core>=0.10",
4345
"numpy >= 2.0.0",
44-
"cython >= 3.0.0",
45-
"wheel >= 0.29.0",
46+
"cython >= 3.1.0",
4647
]
48+
build-backend = "scikit_build_core.build"
4749

4850
[tool.pytest.ini_options]
49-
minversion = "6.2.2"
51+
minversion = "8.4.1"
5052
addopts = [
5153
"--import-mode=importlib",
5254
]
5355
testpaths = [
5456
"tests",
5557
]
56-
57-
[tool.setuptools_scm]
58-
write_to = "src/_version.py"
59-

setup.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

uv.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)