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 2.3 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  1. import os
  2. from pathlib import Path
  3. import logging
  4. logging.basicConfig(level=logging.INFO,format="[%(asctime)s]:%(message)s: ")
  5. package_name = "DeepClassifier"
  6. ## List of files that we wish to create
  7. list_of_files = [
  8. "github/workflows/.gitkeep", ## .gitkeep is an place holder file
  9. f"src/{package_name}/__init__.py" , ## this will help to understand its a package
  10. f"src/{package_name}/components/__init__.py", ## src is a script folder
  11. f"src/{package_name}/utils/__init__.py",
  12. f"src/{package_name}/config/__init__.py",
  13. f"src/{package_name}/pipeline/__init__.py",
  14. f"src/{package_name}/entity/__init__.py",
  15. f"src/{package_name}/constants/__init__.py",
  16. f"src/{package_name}/components/__init__.py",
  17. "tests/__init__.py",
  18. "tests/unit/__init__.py",
  19. "tests/integration/__init__.py",
  20. "configs/config.yaml",
  21. "dvc.yaml" , ## for data version control (dvc) pipeline
  22. "params.yaml",
  23. "init_setup.sh" , ## A shell script file that will help to create the environment
  24. "requirements.txt",
  25. "requirements_dev.txt", ## this help to create development requirements
  26. "setup.py",
  27. "setup.cfg",
  28. "pyproject.toml",
  29. "tox.ini" , ## this is done for testing of project
  30. "research/trials.ipynb",
  31. ]
  32. for filepath in list_of_files:
  33. filepath = Path(filepath)
  34. file_dir , filename = os.path.split(filepath)
  35. if file_dir != "":
  36. os.makedirs(file_dir,exist_ok=True)
  37. logging.info(f"Creating directory : {file_dir} for file : {filename}")
  38. if (not os.path.exists(filepath)) or (os.path.getsize(filepath) == 0): ## this is to prevent overiding of files
  39. with open(filepath,"w") as f:
  40. pass ## create an empty file
  41. logging.info(f"Creating empty file : {filepath}")
  42. else:
  43. logging.info(f" {filename} already exists ")
Tip!

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

Comments

Loading...