Improve errors / diagnostics when package is missing __init__.py
#8212
Labels
question
Asking for clarification or support
__init__.py
#8212
uv 0.4.18
Running
uv build --package my-project
in a project (within a workspace, though I suspect a more minimal repro is possible) where the workspace member package is laid out in a typical style:I've seen this error a few times:
but it can be a confusing and frustrating error when there is a directory with that name.
The actual problem is that python doesn't recognise the directory as a module/package due to the lack of
__init__.py
.Forgetting/losing your
__init__.py
is a silly error to make but I think it's common enough that it is worth mentioning in uv's error that your directory also needs an__init__.py
. You've done the hard part in naming the directory that is problematic.I might suggest the following:
Before
After
Bonus points if uv actually checks and works out what is missing: __init__.py or the directory
The text was updated successfully, but these errors were encountered: