Skip to content

uv init --package creates invalid pyproject.toml if git username contains quotes #16765

@NMertsch

Description

@NMertsch

Summary

uv init does not escape quotes when inserting the git "user.name" config value as "project.author.name".

How to reproduce

Steps:

# create new directory
mkdir my-new-project
cd my-new-project

# configure git user
git init
git config user.name 'Tony "Iron Man" Stark'
git config user.email '[email protected]'

# create new uv package
uv init --package

This creates the following project.authors field in pyproject.toml:

[project]
authors = [
    { name = "Tony "Iron Man" Stark", email = "[email protected]" }
]

Note the string "Tony "Iron Man" Stark", which should be "Tony \"Iron Man\" Stark"

(This came up while testing. I don't suggest that quotes in a git username are a good idea.)

Platform

Linux 6.17.0-6-generic x86_64 GNU/Linux

Version

uv 0.9.10

Python version

Python 3.13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions