Example creating a Python binding for C++ with nanobind
Project description
nanobind example
Example creating a Python binding for C++ with nanobind. Based on the nanobind docs.
Using the bindings
$ uv venv --python 3.12
$ uv pip install borco-nanobind-example
$ uv run python
>>> import borco_nanobind_example as ex
>>> ex.Dog("Max").bark()
'Max: woof!'
>>> ex.the_answer
42
>>> ex.add(3)
4
>>> ex.add(3, 4)
7
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file borco_nanobind_example-0.0.3.tar.gz.
File metadata
- Download URL: borco_nanobind_example-0.0.3.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
746a02854ce1b7a7487eff2c0a19bf0df69679736bad60cb05696d4f06a51a29
|
|
| MD5 |
8fe2c6171cfaeb6822db56103f3c1b76
|
|
| BLAKE2b-256 |
d00578e27e55aee51292f0045493619f50cf67f35a9d846621046e3cd9ce17e6
|
File details
Details for the file borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 48.3 kB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d92dbff162cd34aff6f271142af5ba3dbcf88c0043afea4bafb448fcf4a5d17
|
|
| MD5 |
88ac9f788befc88df2f3c898229f4443
|
|
| BLAKE2b-256 |
9cd792dc02eba1b097712b50b926667f71eae8958e440a916c23e3a051751fc9
|