Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

borco_nanobind_example-0.0.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl (48.3 kB view details)

Uploaded CPython 3.12+Windows x86-64

File details

Details for the file borco_nanobind_example-0.0.3.tar.gz.

File metadata

File hashes

Hashes for borco_nanobind_example-0.0.3.tar.gz
Algorithm Hash digest
SHA256 746a02854ce1b7a7487eff2c0a19bf0df69679736bad60cb05696d4f06a51a29
MD5 8fe2c6171cfaeb6822db56103f3c1b76
BLAKE2b-256 d00578e27e55aee51292f0045493619f50cf67f35a9d846621046e3cd9ce17e6

See more details on using hashes here.

File details

Details for the file borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8d92dbff162cd34aff6f271142af5ba3dbcf88c0043afea4bafb448fcf4a5d17
MD5 88ac9f788befc88df2f3c898229f4443
BLAKE2b-256 9cd792dc02eba1b097712b50b926667f71eae8958e440a916c23e3a051751fc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page