-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.py
More file actions
27 lines (21 loc) · 763 Bytes
/
generator.py
File metadata and controls
27 lines (21 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
# Getting a list off al the packages
os.system("mkdir .modules")
os.system("pip freeze > .modules/modules.txt")
file_reader = open(".modules/modules.txt", "r")
file_writer = open("requirements.txt", "w")
# List of packages to make the requirements file
packages = [
"textblob","torch","torchtext","nltk","jiwer",
"flask-restful","flask" ,"flask-cors","pygame","spacy"
]
lines = file_reader.readlines()
os.system("rm .modules/modules.txt")
os.system("rm -r .modules")
for package in packages:
for line in lines:
line = line.split("==")
name, verssion = line[0].strip(), line[-1].strip()
if(package == name.lower()):
print(f"{name}=={verssion}")
file_writer.write(f"{name}=={verssion}\n")