Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

template.py 1.4 KB

You have to be logged in to leave a comment. Sign In
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  1. import os
  2. from pathlib import Path
  3. import logging
  4. logging.basicConfig(level=logging.INFO, format='[%(asctime)s]: %(message)s:')
  5. project_name = "mlProject"
  6. list_of_files = [
  7. ".github/workflows/.gitkeep",
  8. f"src/{project_name}/__init__.py",
  9. f"src/{project_name}/components/__init__.py",
  10. f"src/{project_name}/utils/__init__.py",
  11. f"src/{project_name}/utils/common.py",
  12. f"src/{project_name}/config/__init__.py",
  13. f"src/{project_name}/config/configuration.py",
  14. f"src/{project_name}/pipeline/__init__.py",
  15. f"src/{project_name}/entity/__init__.py",
  16. f"src/{project_name}/entity/config_entity.py",
  17. f"src/{project_name}/constants/__init__.py",
  18. "config/config.yaml",
  19. "params.yaml",
  20. "schema.yaml",
  21. "main.py",
  22. "app.py",
  23. "Dockerfile",
  24. "requirements.txt",
  25. "setup.py",
  26. "research/trials.ipynb",
  27. "templates/index.html",
  28. ]
  29. for filepath in list_of_files:
  30. filepath = Path(filepath)
  31. filedir, filename = os.path.split(filepath)
  32. if filedir !="":
  33. os.makedirs(filedir, exist_ok=True)
  34. logging.info(f"Creating directory; {filedir} for the file: {filename}")
  35. if (not os.path.exists(filepath)) or (os.path.getsize(filepath) == 0):
  36. with open(filepath, "w") as f:
  37. pass
  38. logging.info(f"Creating empty file: {filepath}")
  39. else:
  40. logging.info(f"{filename} is already exists")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...