astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
27.17k stars 785 forks source link

Changing the directory structure for uv init --package #9316

Closed benedikt-mue closed 19 hours ago

benedikt-mue commented 1 day ago

Hi, I am currently implementing uv as our package manager to replace poetry. In poetry, we defined the package entrypoints with packages = [{ include = "backend", from = "src" }] . Is there something similar possible with uv?

charliermarsh commented 1 day ago

I think uv init --lib will use a src layout by default.

zanieb commented 1 day ago

So does uv init --package:

❯ uv init --package example
Initialized project `example` at `/Users/zb/workspace/uv/example`
❯ tree example
example
├── README.md
├── pyproject.toml
└── src
    └── example
        └── __init__.py
benedikt-mue commented 20 hours ago

Thanks for your quick response. I was rather curious if it is possible to change this behavior like in poetry with [{ include = "whatever", from = "whereever" }] ?

charliermarsh commented 20 hours ago

I'm not sure exactly what you mean, but I think you're describing something that's specific to Poetry's build backend.

benedikt-mue commented 20 hours ago

like changing the default layout? Say, I only want to have a flat structure:

example
├── README.md
├── pyproject.toml
└── project
           └── __init__.py
charliermarsh commented 19 hours ago

You can't change the default layout that we create, but you can certainly change your project to use that layout!