# nanobind example
Example creating a Python binding for C++ with
[nanobind](https://github.com/wjakob/nanobind). Based on the
[nanobind docs](https://nanobind.readthedocs.io/en/latest/index.html).
## Using the bindings
```bash
$ 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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "borco-nanobind-example",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "c++, cmake, cpp, cxx, example, nanobind, python, scikit-build-core",
"author": null,
"author_email": "Ioan C\u0103lin <iborco@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d0/05/78e27e55aee51292f0045493619f50cf67f35a9d846621046e3cd9ce17e6/borco_nanobind_example-0.0.3.tar.gz",
"platform": null,
"description": "# nanobind example\n\nExample creating a Python binding for C++ with\n[nanobind](https://github.com/wjakob/nanobind). Based on the\n[nanobind docs](https://nanobind.readthedocs.io/en/latest/index.html).\n\n## Using the bindings\n\n```bash\n$ uv venv --python 3.12\n$ uv pip install borco-nanobind-example\n$ uv run python\n>>> import borco_nanobind_example as ex\n>>> ex.Dog(\"Max\").bark()\n'Max: woof!'\n>>> ex.the_answer\n42\n>>> ex.add(3)\n4\n>>> ex.add(3, 4)\n7\n```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Example creating a Python binding for C++ with nanobind",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://gitlab.com/iborco-pyside/demos/borco-nanobind-example",
"Issues": "https://gitlab.com/iborco-pyside/demos/borco-nanobind-example/-/issues",
"Repository": "https://gitlab.com/iborco-pyside/demos/borco-nanobind-example"
},
"split_keywords": [
"c++",
" cmake",
" cpp",
" cxx",
" example",
" nanobind",
" python",
" scikit-build-core"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9cd792dc02eba1b097712b50b926667f71eae8958e440a916c23e3a051751fc9",
"md5": "88ac9f788befc88df2f3c898229f4443",
"sha256": "8d92dbff162cd34aff6f271142af5ba3dbcf88c0043afea4bafb448fcf4a5d17"
},
"downloads": -1,
"filename": "borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "88ac9f788befc88df2f3c898229f4443",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.12",
"size": 48267,
"upload_time": "2024-12-07T17:39:57",
"upload_time_iso_8601": "2024-12-07T17:39:57.980135Z",
"url": "https://files.pythonhosted.org/packages/9c/d7/92dc02eba1b097712b50b926667f71eae8958e440a916c23e3a051751fc9/borco_nanobind_example-0.0.3-cp312-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d00578e27e55aee51292f0045493619f50cf67f35a9d846621046e3cd9ce17e6",
"md5": "8fe2c6171cfaeb6822db56103f3c1b76",
"sha256": "746a02854ce1b7a7487eff2c0a19bf0df69679736bad60cb05696d4f06a51a29"
},
"downloads": -1,
"filename": "borco_nanobind_example-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "8fe2c6171cfaeb6822db56103f3c1b76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 9329,
"upload_time": "2024-12-07T17:39:59",
"upload_time_iso_8601": "2024-12-07T17:39:59.699288Z",
"url": "https://files.pythonhosted.org/packages/d0/05/78e27e55aee51292f0045493619f50cf67f35a9d846621046e3cd9ce17e6/borco_nanobind_example-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-07 17:39:59",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "iborco-pyside",
"gitlab_project": "demos",
"lcname": "borco-nanobind-example"
}