From befa80c282e65ba9ad3ecbaf91ed2b6d62f55ee1 Mon Sep 17 00:00:00 2001 From: Dhruvil Date: Sun, 22 Feb 2026 23:23:16 -0800 Subject: [PATCH] feat: allow multiple --author flags in poetry init Change the --author option to accept multiple=True so users can pass multiple --author flags (e.g. --author "Alice " --author "Bob "). Update the author processing logic in _init_pyproject to build the authors list directly from all provided --author values, falling back to the existing interactive/vcs-config behaviour when no flag is given. Fixes #8864 Co-Authored-By: Claude Sonnet 4.6 --- src/poetry/console/commands/init.py | 39 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/poetry/console/commands/init.py b/src/poetry/console/commands/init.py index 48ea6e206ed..c3781ed5874 100644 --- a/src/poetry/console/commands/init.py +++ b/src/poetry/console/commands/init.py @@ -39,7 +39,13 @@ class InitCommand(Command): options: ClassVar[list[Option]] = [ option("name", None, "Name of the package.", flag=False), option("description", None, "Description of the package.", flag=False), - option("author", None, "Author name of the package.", flag=False), + option( + "author", + None, + "Author name of the package.", + flag=False, + multiple=True, + ), option("python", None, "Compatible Python versions.", flag=False), option( "dependency", @@ -148,21 +154,26 @@ def _init_pyproject( if not description and is_interactive: description = self.ask(self.create_question("Description []: ", default="")) - author = self.option("author") - if not author and vcs_config.get("user.name"): - author = vcs_config["user.name"] - author_email = vcs_config.get("user.email") - if author_email: - author += f" <{author_email}>" + authors_from_option = list(self.option("author")) + if authors_from_option: + authors = authors_from_option + else: + author = None + if vcs_config.get("user.name"): + author = vcs_config["user.name"] + author_email = vcs_config.get("user.email") + if author_email: + author += f" <{author_email}>" - if is_interactive: - question = self.create_question( - f"Author [{author}, n to skip]: ", default=author - ) - question.set_validator(lambda v: self._validate_author(v, author)) - author = self.ask(question) + if is_interactive: + question = self.create_question( + f"Author [{author}, n to skip]: ", + default=author, + ) + question.set_validator(lambda v: self._validate_author(v, author)) + author = self.ask(question) - authors = [author] if author else [] + authors = [author] if author else [] license_name = self.option("license") if not license_name and is_interactive: