Skip to content

Commit

Permalink
feat: make use of Python in init and new command
Browse files Browse the repository at this point in the history
  • Loading branch information
finswimmer committed Mar 10, 2024
1 parent aa71481 commit 30cb460
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from poetry.console.commands.command import Command
from poetry.console.commands.env_command import EnvCommand
from poetry.utils.dependency_specification import RequirementsParser
from poetry.utils.env.python_manager import Python


if TYPE_CHECKING:
Expand Down Expand Up @@ -96,7 +97,6 @@ def _init_pyproject(
from poetry.config.config import Config
from poetry.layouts import layout
from poetry.pyproject.toml import PyProjectTOML
from poetry.utils.env import EnvManager

is_interactive = self.io.is_interactive() and allow_interactive

Expand Down Expand Up @@ -174,11 +174,7 @@ def _init_pyproject(
config = Config.create()
python = (
"^"
+ EnvManager.get_python_version(
precision=2,
prefer_active_python=config.get("virtualenvs.prefer-active-python"),
io=self.io,
).to_string()
+ Python.get_preferred_python(config, self.io).minor_version.to_string()
)

if is_interactive:
Expand Down

0 comments on commit 30cb460

Please sign in to comment.