Skip to content

Commit ce15b58

Browse files
authored
chore: add some extra text, update for 3.12 (#120)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 297f453 commit ce15b58

File tree

7 files changed

+81
-32
lines changed

7 files changed

+81
-32
lines changed

.github/workflows/conda.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
platform: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.8", "3.10"]
16+
python-version: ["3.8", "3.11"]
1717

1818
runs-on: ${{ matrix.platform }}
1919

.github/workflows/pip.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
platform: [windows-latest, macos-latest, ubuntu-latest]
18-
python-version: ["3.7", "3.11", "pypy-3.8"]
18+
python-version: ["3.7", "3.12", "pypy-3.9"]
1919

2020
steps:
2121
- uses: actions/checkout@v4

.github/workflows/wheels.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
needs: [build_wheels, build_sdist]
7070
runs-on: ubuntu-latest
7171
if: github.event_name == 'release' && github.event.action == 'published'
72+
environment: pypi
73+
permissions:
74+
id-token: write
7275

7376
steps:
7477
- uses: actions/setup-python@v4
@@ -81,5 +84,3 @@ jobs:
8184
path: dist
8285

8386
- uses: pypa/gh-action-pypi-publish@release/v1
84-
with:
85-
password: ${{ secrets.pypi_password }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,4 @@ dmypy.json
140140
cython_debug/
141141

142142
_skbuild/
143+
.pyodide-xbuildenv/

CMakeLists.txt

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
cmake_minimum_required(VERSION 3.15...3.26)
1+
# Require CMake 3.15+ (matching scikit-build-core) Use new versions of all
2+
# policies up to CMake 3.27
3+
cmake_minimum_required(VERSION 3.15...3.27)
24

5+
# Scikit-build-core sets these values for you, or you can just hard-code the
6+
# name and version.
37
project(
48
${SKBUILD_PROJECT_NAME}
59
VERSION ${SKBUILD_PROJECT_VERSION}
610
LANGUAGES CXX)
711

12+
# Find the module development requirements (requires FindPython from 3.17 or
13+
# scikit-build-core's built-in backport)
814
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
915
find_package(pybind11 CONFIG REQUIRED)
1016

17+
# Add a library using FindPython's tooling (pybind11 also provides a helper like
18+
# this)
1119
python_add_library(_core MODULE src/main.cpp WITH_SOABI)
1220
target_link_libraries(_core PRIVATE pybind11::headers)
21+
22+
# This is passing in the version as a define just as an example
1323
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION})
1424

25+
# The install directory is the output (wheel) directory
1526
install(TARGETS _core DESTINATION scikit_build_example)

README.md

+58-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
scikit_build_example
2-
==============
1+
# scikit_build_example
32

43
[![Gitter][gitter-badge]][gitter-link]
54

@@ -9,10 +8,8 @@ scikit_build_example
98
| pip builds | [![Pip Actions Status][actions-pip-badge]][actions-pip-link] |
109

1110

12-
13-
An example project built with [pybind11](https://github.com/pybind/pybind11)
14-
and scikit-build-core. Python 3.7+ (see older commits for older versions of
15-
Python).
11+
An example project built with [pybind11][] and [scikit-build-core][]. Python
12+
3.7+ (see older commits for older versions of Python using [scikit-build (classic)][]).
1613

1714

1815
[gitter-badge]: https://badges.gitter.im/pybind/Lobby.svg
@@ -25,34 +22,71 @@ Python).
2522
[actions-wheels-link]: https://github.com/pybind/scikit_build_example/actions?query=workflow%3AWheels
2623
[actions-wheels-badge]: https://github.com/pybind/scikit_build_example/workflows/Wheels/badge.svg
2724

28-
Installation
29-
------------
25+
## Installation
3026

31-
- clone this repository
27+
- Clone this repository
3228
- `pip install ./scikit_build_example`
3329

30+
## Test call
31+
32+
```python
33+
import scikit_build_example
34+
35+
scikit_build_example.add(1, 2)
36+
```
37+
38+
## Files
39+
40+
This example has several files that are a good idea, but aren't strictly
41+
necessary. The necessary files are:
42+
43+
* `pyproject.toml`: The Python project file
44+
* `CMakeLists.txt`: The CMake configuration file
45+
* `src/main.cpp`: The source file for the C++ build
46+
* `src/scikit_build_example/__init__.py`: The Python portion of the module. The root of the module needs to be `<package_name>`, `src/<package_name>`, or `python/<package_name>` to be auto-discovered.
47+
48+
These files are also expected and highly recommended:
49+
50+
* `.gitignore`: Git's ignore list, also used by `scikit-build-core` to select files for the SDist
51+
* `README.md`: The source for the PyPI description
52+
* `LICENSE`: The license file
3453

35-
CI Examples
36-
-----------
54+
There are also several completely optional directories:
55+
56+
* `.github`: configuration for [Dependabot][] and [GitHub Actions][]
57+
* `conda.recipe`: Example recipe. Normally you should submit projects to conda-forge instead of building them yourself, but this is useful for testing the example.
58+
* `docs/`: Documentation
59+
* `tests/`: Tests go here
60+
61+
And some optional files:
62+
63+
* `.pre-commit-config.yaml`: Configuration for the fantastic static-check runner [pre-commit][].
64+
* `noxfile.py`: Configuration for the [nox][] task runner, which helps make setup easier for contributors.
65+
66+
This is a simplified version of the recommendations in the [Scientific-Python
67+
Development Guide][], which is a _highly_ recommended read for anyone
68+
interested in Python package development (Scientific or not). The guide also
69+
has a cookiecutter that includes scikit-build-core and pybind11 as a backend
70+
choice.
71+
72+
### CI Examples
3773

3874
There are examples for CI in `.github/workflows`. A simple way to produces
3975
binary "wheels" for all platforms is illustrated in the "wheels.yml" file,
40-
using [`cibuildwheel`][].
76+
using [cibuildwheel][].
4177

42-
License
43-
-------
78+
## License
4479

4580
pybind11 is provided under a BSD-style license that can be found in the LICENSE
4681
file. By using, distributing, or contributing to this project, you agree to the
4782
terms and conditions of this license.
4883

49-
Test call
50-
---------
51-
52-
```python
53-
import scikit_build_example
54-
55-
scikit_build_example.add(1, 2)
56-
```
57-
58-
[`cibuildwheel`]: https://cibuildwheel.readthedocs.io
84+
[cibuildwheel]: https://cibuildwheel.readthedocs.io
85+
[scientific-python development guide]: https://learn.scientific-python.org/development
86+
[dependabot]: https://docs.github.com/en/code-security/dependabot
87+
[github actions]: https://docs.github.com/en/actions
88+
[pre-commit]: https://pre-commit.com
89+
[nox]: https://nox.thea.codes
90+
[pybind11]: https://pybind11.readthedocs.io
91+
[scikit-build-core]: https://scikit-build-core.readthedocs.io
92+
[scikit-build (classic)]: https://scikit-build.readthedocs.io

pyproject.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.9",
2222
"Programming Language :: Python :: 3.10",
2323
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
2425
]
2526

2627
[project.optional-dependencies]
@@ -35,9 +36,9 @@ wheel.expand-macos-universal-tags = true
3536
minversion = "6.0"
3637
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
3738
xfail_strict = true
39+
log_cli_level = "INFO"
3840
filterwarnings = [
3941
"error",
40-
"ignore:(ast.Str|Attribute s|ast.NameConstant|ast.Num) is deprecated:DeprecationWarning:_pytest", # Python 3.12
4142
]
4243
testpaths = ["tests"]
4344

@@ -77,9 +78,10 @@ extend-select = [
7778
"PD", # pandas-vet
7879
]
7980
ignore = [
80-
"PLR", # Design related pylint codes
81+
"PLR09", # Too many X
82+
"PLR2004", # Magic comparison
8183
]
8284
isort.required-imports = ["from __future__ import annotations"]
8385

84-
[tool.ruff.per-file-ignores]
86+
[tool.ruff.lint.per-file-ignores]
8587
"tests/**" = ["T20"]

0 commit comments

Comments
 (0)