https://github.com/jurihock/nanobind_uv_workspace_example
https://github.com/jurihock/nanobind_uv_workspace_example
cpp nanobind python uv
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jurihock/nanobind_uv_workspace_example
- Owner: jurihock
- License: mit
- Created: 2025-08-18T14:18:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-29T11:53:07.000Z (10 months ago)
- Last Synced: 2025-08-29T15:07:06.813Z (10 months ago)
- Topics: cpp, nanobind, python, uv
- Language: CMake
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nanobind_uv_workspace_example
This is a [nanobind](https://github.com/wjakob/nanobind) example project featuring [uv](https://github.com/astral-sh/uv) [workspace](https://docs.astral.sh/uv/concepts/projects/workspaces) containing several interdependent `.whl` packages.
## Goals
* Figure out how a single `.whl` package can be split into multiple interdependent `.whl` packages.
* Trigger rebuilding of C++ bindings on every `uv run` during development.
## Caveats
* Since nanobind depends on the [Python interpreter](https://nanobind.readthedocs.io/en/latest/building.html#preliminaries), build isolation must be disabled in editable mode.
* Both `uv sync --no-build-isolation` and `uv build --no-build-isolation` require preinstalled [build dependencies](https://docs.astral.sh/uv/reference/settings/#no-build-isolation).
* See also `sync` and `build` in `tasks.py`.
## Basic usage
Build and run `test.py` example:
```
tasks.{bat,sh} sync
tasks.{bat,sh} test
```
Build `dist/*.whl` files:
```
tasks.{bat,sh} sync
tasks.{bat,sh} build
```
## Advanced usage
Serve built `dist/*.whl` files:
```
tasks.{bat,sh} serve
```
Use served `dist/*.whl` files:
```
cd example
uv run example.py
```
## Dependencies
C++:
|C++ Library|Dependency|
|-----------|----------|
|`pet`||
|`cat`|`pet`|
|`dog`|`pet`|
Python:
|Python Library|Python Dependency|C++ Dependency|
|--------------|-----------------|--------------|
|`pypet`||`pet`|
|`pycat`|`pypet`|`cat`|
|`pydog`|`pypet`|`dog`|
|`pypets`|`pypet` `pycat` `pydog`||