8
8
import pip
9
9
10
10
11
- class ProjectInitAutomator :
12
- def __init__ (self , repo_name , is_private ):
13
- self .repo_name = repo_name
14
- self .is_private = is_private
11
+ class ProjectInitializer :
12
+ def __init__ (self ):
13
+ self .repo_name = input ("Insert the new repo name:" )
14
+ if (_ := input ("Should the repo be private? [Y/N]" ).lower ()[0 ]) == "y" :
15
+ self .is_private = True
16
+ else :
17
+ self .is_private = False
15
18
self .repo_path = project_path + self .repo_name
16
19
20
+ def run (self ):
17
21
self .repo_full_name = self .create_github_repo (
18
22
self .repo_name , self .is_private )
19
23
self .clone_repo (self .repo_full_name , self .repo_path )
20
24
self .create_venv (self .repo_path )
21
- self .repo_config (self .repo_path )
22
25
self .gitignore_modifier (self .repo_path )
23
26
self .file_creator (self .repo_path )
24
27
25
28
# Command to open the folder in VS Code
26
29
subprocess .run (code_path + " -a " + self .repo_path )
27
- print ("All done! Enjoi :)" )
30
+ print ("All done! Enjoy :)" )
28
31
29
32
def create_github_repo (self , repo_name , is_private ):
30
33
""" This function creates a new Github repo(public or private), with its own .gitignore for Python and a Readme.md file """
@@ -66,21 +69,6 @@ def create_venv(self, repo_path):
66
69
except Exception as e :
67
70
print (e )
68
71
69
- def repo_config (self , repo_path ):
70
- """ Functions that updates pip and installs autopep8 and pylint inside
71
- the virual environment"""
72
- env = os .environ
73
- virtual_env = repo_path + "\\ .venv"
74
- env .update ({"VIRTUAL_ENV" : virtual_env })
75
-
76
- path = virtual_env + "\\ Scripts;" + env ["PATH" ]
77
- env .update ({"PATH" : path })
78
-
79
- subprocess .run ("pip install --upgrade pip" ,
80
- env = env , stdout = subprocess .DEVNULL )
81
- subprocess .run ("pip install autopep8 pylint" ,
82
- env = env , stdout = subprocess .DEVNULL )
83
-
84
72
def gitignore_modifier (self , repo_path ):
85
73
""" Function that excludes the VS Code folder and the secrets.py from
86
74
being tracked by git """
@@ -103,4 +91,5 @@ def file_creator(self, repo_path):
103
91
104
92
105
93
if __name__ == '__main__' :
106
- pia = ProjectInitAutomator ("repo_new_final" , True )
94
+ pi = ProjectInitializer ()
95
+ pi .run ()
0 commit comments