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

Makefile 3.5 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  1. .PHONY: clean dirs virtualenv lint requirements push pull reproduce
  2. #################################################################################
  3. # GLOBALS #
  4. #################################################################################
  5. PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
  6. PYTHON_INTERPRETER = python3
  7. #################################################################################
  8. # COMMANDS #
  9. #################################################################################
  10. ## Activate virtualenv.
  11. activate:
  12. $(PYTHON_INTERPRETER) -m pipenv shell
  13. ## Install Python Dependencies.
  14. dependencies:
  15. $(PYTHON_INTERPRETER) -m pip install -U pipenv setuptools wheel
  16. $(PYTHON_INTERPRETER) -m pipenv install
  17. ## Import Python Dependencies from requirements.txt.
  18. import:
  19. $(PYTHON_INTERPRETER) -m pip install -U pipenv setuptools wheel
  20. $(PYTHON_INTERPRETER) -m pipenv shell
  21. $(PYTHON_INTERPRETER) -m pipenv import -r requirements.txt
  22. $(PYTHON_INTERPRETER) -m pipenv install
  23. ## Install dependencies defined on Pipenv.lock
  24. install:
  25. $(PYTHON_INTERPRETER) -m pipenv install --ignore-pipfile
  26. ## Check if all the dependencies are installed correctly
  27. check:
  28. $(PYTHON_INTERPRETER) -m pipenv check
  29. ## Dependencies graph
  30. graph:
  31. $(PYTHON_INTERPRETER) -m pipenv graph
  32. ## Update Pipfile.lock dependencies
  33. lock:
  34. $(PYTHON_INTERPRETER) -m pipenv lock
  35. ## Create directories that are ignored by git but required for the project
  36. dirs:
  37. mkdir -p data/raw data/processed models
  38. ## Delete all compiled Python files
  39. clean:
  40. find . -type f -name "*.py[co]" -delete
  41. find . -type d -name "__pycache__" -delete
  42. ## Lint using flake8
  43. lint:
  44. flake8 src
  45. ## Upload Data to default DVC remote
  46. push:
  47. dvc push
  48. ## Download Data from default DVC remote
  49. pull:
  50. dvc pull
  51. ## Reproduce the DVC pipeline - recompute any modified outputs such as processed data or trained models
  52. reproduce:
  53. dvc repro eval.dvc
  54. #################################################################################
  55. # PROJECT RULES #
  56. #################################################################################
  57. #################################################################################
  58. # Self Documenting Commands #
  59. #################################################################################
  60. .DEFAULT_GOAL := help
  61. # Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
  62. # sed script explained:
  63. # /^##/:
  64. # * save line in hold space
  65. # * purge line
  66. # * Loop:
  67. # * append newline + line to hold space
  68. # * go to next line
  69. # * if line starts with doc comment, strip comment character off and loop
  70. # * remove target prerequisites
  71. # * append hold space (+ newline) to line
  72. # * replace newline plus comments by `---`
  73. # * print line
  74. # Separate expressions are necessary because labels cannot be delimited by
  75. # semicolon; see <http://stackoverflow.com/a/11799865/1968>
  76. .PHONY: help
  77. help:
  78. @echo "$$(tput bold)Available rules:$$(tput sgr0)"
  79. @echo
  80. @sed -n -e "/^## / Missing" $Missing \
  81. | LC_ALL='C' sort --ignore-case \
  82. | awk -F '---' \
  83. -v ncol=$$(tput cols) \
  84. -v indent=19 \
  85. -v col_on="$$(tput setaf 6)" \
  86. -v col_off="$$(tput sgr0)" \
  87. 'Missing \
  88. printf "%s ", words[i]; \
  89. } \
  90. printf "\n"; \
  91. }' \
  92. | more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
Tip!

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

Comments

Loading...