2
2
3
3
from pipenv import environments , exceptions
4
4
from pipenv .patched .pip ._vendor import rich
5
+ from pipenv .utils import console , err
5
6
from pipenv .utils .requirements import import_requirements
6
- from pipenv .vendor import click
7
-
8
- console = rich .console .Console ()
9
- err = rich .console .Console (stderr = True )
10
7
11
8
12
9
def walk_up (bottom ):
@@ -74,12 +71,8 @@ def ensure_pipfile(project, validate=True, skip_requirements=False, system=False
74
71
# If there's a requirements file, but no Pipfile...
75
72
if project .requirements_exists and not skip_requirements :
76
73
requirements_dir_path = os .path .dirname (project .requirements_location )
77
- click .echo (
78
- "{} found in {} instead of {}! Converting..." .format (
79
- click .style ("requirements.txt" , bold = True ),
80
- click .style (requirements_dir_path , fg = "yellow" , bold = True ),
81
- click .style ("Pipfile" , bold = True ),
82
- )
74
+ console .print (
75
+ f"[bold]requirements.txt[/bold] found in [bold yellow]{ requirements_dir_path } [/bold yellow] instead of [bold]Pipfile[/bold]! Converting..." .
83
76
)
84
77
# Create a Pipfile...
85
78
project .create_pipfile (python = python )
@@ -96,18 +89,12 @@ def ensure_pipfile(project, validate=True, skip_requirements=False, system=False
96
89
environments .PIPENV_SPINNER_OK_TEXT .format ("Success!" )
97
90
)
98
91
# Warn the user of side-effects.
99
- click .echo (
100
- "{0}: Your {1} now contains pinned versions, if your {2} did. \n "
101
- "We recommend updating your {1} to specify the {3} version, instead."
102
- "" .format (
103
- click .style ("Warning" , fg = "red" , bold = True ),
104
- click .style ("Pipfile" , bold = True ),
105
- click .style ("requirements.txt" , bold = True ),
106
- click .style ('"*"' , bold = True ),
107
- )
92
+ console .print (
93
+ "[bold red]Warning[/bold red]: Your [bold]Pipfile[/bold] now contains pinned versions, if your [bold]requirements.txt[/bold] did. \n "
94
+ "We recommend updating your [bold]Pipfile[/bold] to specify the [bold]" * "[/bold] version, instead."
108
95
)
109
96
else :
110
- click . secho ("Creating a Pipfile for this project..." , bold = True , err = True )
97
+ err . print ("Creating a Pipfile for this project..." , style = "bold" )
111
98
# Create the pipfile if it doesn't exist.
112
99
project .create_pipfile (python = python )
113
100
# Validate the Pipfile's contents.
@@ -117,7 +104,5 @@ def ensure_pipfile(project, validate=True, skip_requirements=False, system=False
117
104
changed = project .ensure_proper_casing ()
118
105
# Write changes out to disk.
119
106
if changed :
120
- click .echo (
121
- click .style ("Fixing package names in Pipfile..." , bold = True ), err = True
122
- )
107
+ err .print ("Fixing package names in Pipfile..." , style = "bold" )
123
108
project .write_toml (p )
0 commit comments