|
1 | 1 | [build-system]
|
2 |
| -requires = ["setuptools", "wheel", "setuptools-rust"] |
| 2 | +requires = ["setuptools", "setuptools-rust"] |
3 | 3 | build-backend = "setuptools.build_meta"
|
4 | 4 |
|
5 | 5 | [project]
|
6 | 6 | name = "hello-world"
|
7 | 7 | version = "1.0"
|
8 | 8 |
|
9 |
| -[project.scripts] # Python entry-point wrapper to be installed in `$venv/bin` |
10 |
| -sum-cli = "hello_world.sum_cli:main" |
| 9 | +[project.scripts] |
| 10 | +# Python entry-point wrapper to be installed in `$venv/bin` |
| 11 | +sum-cli = "hello_world.sum_cli:main" # Python function that uses Rust |
| 12 | +rust-demo = "hello_world._lib:demo" # Rust function that uses Python |
11 | 13 |
|
12 |
| -[tool.setuptools.packages] # pure Python packages/modules |
| 14 | +[tool.setuptools.packages] |
| 15 | +# Pure Python packages/modules |
13 | 16 | find = { where = ["python"] }
|
14 | 17 |
|
15 | 18 | [[tool.setuptools-rust.ext-modules]]
|
16 |
| -target = "hello_world._lib" # private module to be nested into Python package |
17 |
| -py-limited-api = "auto" |
18 |
| -args = ["--profile", "release-lto"] |
| 19 | +# Private Rust extension module to be nested into Python package |
| 20 | +target = "hello_world._lib" # The last part of the name (e.g. "_lib") has to match lib.name in Cargo.toml, |
| 21 | + # but you can add a prefix to nest it inside of a Python package. |
| 22 | +py-limited-api = "auto" # Default value, can be omitted |
| 23 | +binding = "PyO3" # Default value, can be omitted |
| 24 | +# See reference for RustExtension in https://setuptools-rust.readthedocs.io/en/latest/reference.html |
19 | 25 |
|
20 |
| -[[tool.setuptools-rust.binaries]] # executable to be installed in `$venv/bin` |
21 |
| -target = "print-hello" |
22 |
| -args = ["--profile", "release-lto"] |
| 26 | +[[tool.setuptools-rust.binaries]] |
| 27 | +# Rust executable to be installed in `$venv/bin` |
| 28 | +target = "print-hello" # Needs to match bin.name in Cargo.toml |
| 29 | +args = ["--profile", "release-lto"] # Extra args for Cargo |
| 30 | +# See reference for RustBin in https://setuptools-rust.readthedocs.io/en/latest/reference.html |
| 31 | +# Note that you can also use Python entry-points as alternative to Rust binaries |
0 commit comments