beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 353 forks source link

Creating a new project using quoted inputs results in an invalid pyproject.toml #1746

Closed rmartin16 closed 1 month ago

rmartin16 commented 2 months ago

Describe the bug

Several of the user inputs for the briefcase new command are inserted verbatim in to the pyproject.toml. This TOML document uses double quotes to enclose these strings; therefore, if the user inputs contain double quotes, the TOML will be invalid.

While entering text with double quotes in to the prompts wouldn't normally be expected, at least for some of the fields, such as name (perhaps for a quoted nickname) or the description, this character should be supported.

Steps to reproduce

  1. Run briefcase new
  2. For the author, enter Harald "Bluetooth" Gormsson
  3. Run briefcase dev in the project

Expected behavior

pyproject.toml is valid.

A similar tactic to https://github.com/beeware/briefcase-template/pull/66 seems reasonable.

Screenshots

No response

Environment

Logs

❯ briefcase dev

Briefcase configuration error: Invalid pyproject.toml: Expected newline or end of document after a statement (at line 8, column 19)

Additional context

No response

mfreydavis commented 1 month ago

Working on this at PyconUS 2024 sprints.

mfreydavis commented 1 month ago

The supporting template pull request is https://github.com/beeware/briefcase-template/pull/125

mhsmith commented 1 month ago

Can we close this issue, or are some more changes required?

freakboy3742 commented 1 month ago

@mhsmith This also needs #1811, which is currently waiting for CI to complete.