Skip to content

Commit 6958380

Browse files
committed
b
1 parent bd890d0 commit 6958380

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

cppython/build/backend.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
logger = logging.getLogger('cppython.build')
1616

1717

18-
def _inject_toolchain(
19-
config_settings: dict[str, Any] | None, toolchain_file: Path | None
20-
) -> dict[str, Any]:
18+
def _inject_toolchain(config_settings: dict[str, Any] | None, toolchain_file: Path | None) -> dict[str, Any]:
2119
"""Inject the toolchain file into config settings for scikit-build-core.
2220
2321
Args:

docs/build-backend/integration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ my_project/
205205
### Dual Workflow
206206

207207
**Python extension** (uses `cppython.build`):
208+
208209
```bash
209210
pip wheel .
210211
```
211212

212213
**Standalone C++ build** (uses CMakePresets):
214+
213215
```bash
214216
cmake --preset=default
215217
cmake --build build

examples/conan_cmake/extension/CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"description": "Base preset for all configurations"
88
}
99
]
10-
}
10+
}

examples/conan_cmake/extension/pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ wheel.packages = ["src/example_extension"]
2020
# and inject the toolchain file into scikit-build-core
2121
install-path = "install"
2222

23-
dependencies = [
24-
"fmt>=11.0.2",
25-
"nanobind>=2.4.0",
26-
]
23+
dependencies = ["fmt>=11.0.2", "nanobind>=2.4.0"]
2724

2825
[tool.cppython.generators.cmake]
2926
# Use the CMakePresets.json in this directory
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Example Python extension module with C++ backend."""
22

3-
from example_extension._core import format_greeting, add_numbers
3+
from example_extension._core import add_numbers, format_greeting
44

5-
__all__ = ["format_greeting", "add_numbers"]
5+
__all__ = ['format_greeting', 'add_numbers']

examples/conan_cmake/extension/src/example_extension/_core.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ namespace nb = nanobind;
1616
* @param name The name to greet
1717
* @return A formatted greeting string
1818
*/
19-
std::string format_greeting(const std::string& name) {
19+
std::string format_greeting(const std::string &name)
20+
{
2021
return fmt::format("Hello, {}! This message was formatted by fmt.", name);
2122
}
2223

@@ -27,11 +28,13 @@ std::string format_greeting(const std::string& name) {
2728
* @param b Second number
2829
* @return Sum of a and b
2930
*/
30-
int add_numbers(int a, int b) {
31+
int add_numbers(int a, int b)
32+
{
3133
return a + b;
3234
}
3335

34-
NB_MODULE(_core, m) {
36+
NB_MODULE(_core, m)
37+
{
3538
m.doc() = "Example extension module built with CPPython + scikit-build-core";
3639

3740
m.def("format_greeting", &format_greeting, nb::arg("name"),

tests/integration/examples/test_conan_cmake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def test_extension(example_runner: CliRunner) -> None:
168168

169169
# Test the installed extension by adding install_target to path
170170
test_code = (
171-
f"import sys; sys.path.insert(0, {str(install_path)!r}); "
171+
f'import sys; sys.path.insert(0, {str(install_path)!r}); '
172172
"import example_extension; print(example_extension.format_greeting('Test'))"
173173
)
174174
test_result = subprocess.run(

0 commit comments

Comments
 (0)