Fill in authors filed during uv init (#7756)

## Summary

Fill in the `authors` field of `pyproject.toml` by fetching author info
from Git.

Resolves #7718
This commit is contained in:
Jo 2024-10-09 03:06:37 +08:00 committed by GitHub
parent 56521937b7
commit 15e5e3f6af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 288 additions and 11 deletions

View file

@ -2346,6 +2346,17 @@ impl ExternalCommand {
}
}
#[derive(Debug, Default, Copy, Clone, clap::ValueEnum)]
pub enum AuthorFrom {
/// Fetch the author information from some sources (e.g., Git) automatically.
#[default]
Auto,
/// Fetch the author information from Git configuration only.
Git,
/// Do not infer the author information.
None,
}
#[derive(Args)]
#[allow(clippy::struct_excessive_bools)]
pub struct InitArgs {
@ -2432,6 +2443,14 @@ pub struct InitArgs {
#[arg(long)]
pub no_readme: bool,
/// Fill in the `authors` field in the `pyproject.toml`.
///
/// By default, uv will attempt to infer the author information from some sources (e.g., Git) (`auto`).
/// Use `--author-from git` to only infer from Git configuration.
/// Use `--author-from none` to avoid inferring the author information.
#[arg(long, value_enum)]
pub author_from: Option<AuthorFrom>,
/// Do not create a `.python-version` file for the project.
///
/// By default, uv will create a `.python-version` file containing the minor version of