Skip to content

Commit

Permalink
Remove secho from pipenv.utils.pipfile
Browse files Browse the repository at this point in the history
  • Loading branch information
oz123 committed Jul 21, 2023
1 parent d6bcff2 commit ecbc2bf
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions pipenv/utils/pipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

from pipenv import environments, exceptions
from pipenv.patched.pip._vendor import rich
from pipenv.utils import console, err
from pipenv.utils.requirements import import_requirements
from pipenv.vendor import click

console = rich.console.Console()
err = rich.console.Console(stderr=True)


def walk_up(bottom):
Expand Down Expand Up @@ -74,12 +71,8 @@ def ensure_pipfile(project, validate=True, skip_requirements=False, system=False
# If there's a requirements file, but no Pipfile...
if project.requirements_exists and not skip_requirements:
requirements_dir_path = os.path.dirname(project.requirements_location)
click.echo(
"{} found in {} instead of {}! Converting...".format(
click.style("requirements.txt", bold=True),
click.style(requirements_dir_path, fg="yellow", bold=True),
click.style("Pipfile", bold=True),
)
console.print(
f"[bold]requirements.txt[/bold] found in [bold yellow]{requirements_dir_path}[/bold yellow] instead of [bold]Pipfile[/bold]! Converting...".

Check failure on line 75 in pipenv/utils/pipfile.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E501)

pipenv/utils/pipfile.py:75:138: E501 Line too long (156 > 137 characters)
)
# Create a Pipfile...
project.create_pipfile(python=python)
Expand All @@ -96,18 +89,12 @@ def ensure_pipfile(project, validate=True, skip_requirements=False, system=False
environments.PIPENV_SPINNER_OK_TEXT.format("Success!")
)
# Warn the user of side-effects.
click.echo(
"{0}: Your {1} now contains pinned versions, if your {2} did. \n"
"We recommend updating your {1} to specify the {3} version, instead."
"".format(
click.style("Warning", fg="red", bold=True),
click.style("Pipfile", bold=True),
click.style("requirements.txt", bold=True),
click.style('"*"', bold=True),
)
console.print(
"[bold red]Warning[/bold red]: Your [bold]Pipfile[/bold] now contains pinned versions, if your [bold]requirements.txt[/bold] did. \n"
"We recommend updating your [bold]Pipfile[/bold] to specify the [bold]"*"[/bold] version, instead."
)
else:
click.secho("Creating a Pipfile for this project...", bold=True, err=True)
err.print("Creating a Pipfile for this project...", style="bold")
# Create the pipfile if it doesn't exist.
project.create_pipfile(python=python)
# Validate the Pipfile's contents.
Expand All @@ -117,7 +104,5 @@ def ensure_pipfile(project, validate=True, skip_requirements=False, system=False
changed = project.ensure_proper_casing()
# Write changes out to disk.
if changed:
click.echo(
click.style("Fixing package names in Pipfile...", bold=True), err=True
)
err.print("Fixing package names in Pipfile...", style="bold")
project.write_toml(p)

0 comments on commit ecbc2bf

Please sign in to comment.