Skip to content

Commit 59e020d

Browse files
authored
docs: add additional uv setup and packaging info, for those using the uv build backend (#22)
1 parent 43788e8 commit 59e020d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

docs/deployment.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ rye build --wheel
7373
uv build --wheel projects/the_project
7474
```
7575

76+
_Are you using the `uv` build backend (and not the recommended `hatch` build backend)?_
77+
_If so, you need to run the `poly build setup` and `poly build teardown` commands before and after the `uv build` command._
78+
_This is needed because of the missing build hook support of the uv build backend._
79+
7680
#### Maturin
7781
``` shell
7882
cd projects/the_project

docs/setup.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ __Choose the name wisely.__ Have a look in [PEP-423](https://peps.python.org/pep
193193
`--theme` the structure of the workspace, `loose` is the recommended structure for Python.
194194

195195
#### Edit the project configuration
196-
Make sure that the build backend for `uv` is set to Hatch, having this section in the `pyproject.toml`:
196+
The recommended build backend for `uv` is Hatch. This is because of the very useful build hook support.
197+
Make sure to add this section, if not already added, in the `pyproject.toml`:
197198

198199
``` toml
199200
[build-system]
@@ -213,6 +214,17 @@ Run the `sync` command to update the virtual environment:
213214
uv sync
214215
```
215216

217+
##### What about the uv Build Backend?
218+
You can use the `uv` build backend with Polylith, even if the `hatch` backend is the recommended one.
219+
220+
Add this configuration, to make `uv` aware of namespace packages and the top namespace.
221+
222+
``` toml
223+
[tool.uv.build-backend]
224+
namespace = true
225+
module-name = "<the polylith top namespace here>"
226+
module-root = ""
227+
```
216228

217229
### Maturin
218230
Add the `polylith-cli` as a development dependency to your `pyproject.toml` file:

0 commit comments

Comments
 (0)