Add --bare option to uv init (#11192)

People are looking for a less opinionated version of `uv init`. The goal
here is to create a `pyproject.toml` and nothing else. With the `--lib`
or `--package` flags, we'll still configure a build backend but we won't
create the source tree. This disables things like the default
`description`, author behavior, and VCS.

See

- https://github.com/astral-sh/uv/issues/8178
- https://github.com/astral-sh/uv/issues/7181
- https://github.com/astral-sh/uv/issues/6750
This commit is contained in:
Zanie Blue 2025-02-05 10:12:27 -06:00 committed by GitHub
parent 989b103171
commit acbbb2b82a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 311 additions and 13 deletions

View file

@ -2518,6 +2518,13 @@ pub struct InitArgs {
#[arg(long, conflicts_with = "script")]
pub name: Option<PackageName>,
/// Only create a `pyproject.toml`.
///
/// Disables creating extra files like `README.md`, the `src/` tree, `.python-version` files,
/// etc.
#[arg(long, conflicts_with = "script")]
pub bare: bool,
/// Create a virtual project, rather than a package.
///
/// This option is deprecated and will be removed in a future release.
@ -2574,9 +2581,13 @@ pub struct InitArgs {
pub r#script: bool,
/// Set the project description.
#[arg(long, conflicts_with = "script")]
#[arg(long, conflicts_with = "script", overrides_with = "no_description")]
pub description: Option<String>,
/// Disable the description for the project.
#[arg(long, conflicts_with = "script", overrides_with = "description")]
pub no_description: bool,
/// Initialize a version control system for the project.
///
/// By default, uv will initialize a Git repository (`git`). Use `--vcs none` to explicitly