From bc30a3a949b6a5a90a0f2bb027a811130d11b795 Mon Sep 17 00:00:00 2001 From: Bartosz Sokorski Date: Thu, 23 Oct 2025 13:44:55 +0200 Subject: [PATCH 1/2] Switch init pyproject to dulwich --- src/poetry/console/commands/init.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/poetry/console/commands/init.py b/src/poetry/console/commands/init.py index a0921fdd1eb..70d03e3797e 100644 --- a/src/poetry/console/commands/init.py +++ b/src/poetry/console/commands/init.py @@ -91,7 +91,7 @@ def _init_pyproject( readme_format: str = "md", allow_layout_creation_on_empty: bool = False, ) -> int: - from poetry.core.vcs.git import GitConfig + from dulwich.config import StackedConfig from poetry.config.config import Config from poetry.layouts import layout @@ -116,8 +116,6 @@ def _init_pyproject( ) return 1 - vcs_config = GitConfig() - if is_interactive: self.line("") self.line( @@ -148,10 +146,11 @@ def _init_pyproject( if not description and is_interactive: description = self.ask(self.create_question("Description []: ", default="")) + vcs_config = StackedConfig.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 not author and (vcs_username := vcs_config.get("user", "name")): + author = vcs_username + author_email = vcs_config.get("user", "email") if author_email: author += f" <{author_email}>" From 81f32b3ce5350ee58a39cf7dfb3b476d35e95568 Mon Sep 17 00:00:00 2001 From: Bartosz Sokorski Date: Tue, 30 Dec 2025 14:04:04 +0100 Subject: [PATCH 2/2] WIP --- src/poetry/console/commands/init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/poetry/console/commands/init.py b/src/poetry/console/commands/init.py index 70d03e3797e..04f36c6aa76 100644 --- a/src/poetry/console/commands/init.py +++ b/src/poetry/console/commands/init.py @@ -149,8 +149,8 @@ def _init_pyproject( vcs_config = StackedConfig.default() author = self.option("author") if not author and (vcs_username := vcs_config.get("user", "name")): - author = vcs_username - author_email = vcs_config.get("user", "email") + author = vcs_username.decode() + author_email = vcs_config.get("user", "email").decode() if author_email: author += f" <{author_email}>"