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.0 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
  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 = python
  7. #################################################################################
  8. # COMMANDS #
  9. #################################################################################
  10. ## Create virtualenv.
  11. ## Activate with the command:
  12. ## source env/bin/activate
  13. virtualenv:
  14. virtualenv -p $(PYTHON_INTERPRETER) env
  15. ## Install Python Dependencies.
  16. ## Make sure you activate the virtualenv first!
  17. requirements:
  18. $(PYTHON_INTERPRETER) -m pip install -U pip setuptools wheel
  19. $(PYTHON_INTERPRETER) -m pip install -r requirements.txt
  20. ## Create directories that are ignored by git but required for the project
  21. dirs:
  22. mkdir -p data/raw data/processed models
  23. ## Delete all compiled Python files
  24. clean:
  25. find . -type f -name "*.py[co]" -delete
  26. find . -type d -name "__pycache__" -delete
  27. ## Lint using flake8
  28. lint:
  29. flake8 src
  30. ## Upload Data to default DVC remote
  31. push:
  32. dvc push
  33. ## Download Data from default DVC remote
  34. pull:
  35. dvc pull
  36. ## Reproduce the DVC pipeline - recompute any modified outputs such as processed data or trained models
  37. reproduce:
  38. dvc repro eval.dvc
  39. #################################################################################
  40. # PROJECT RULES #
  41. #################################################################################
  42. #################################################################################
  43. # Self Documenting Commands #
  44. #################################################################################
  45. .DEFAULT_GOAL := help
  46. # Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
  47. # sed script explained:
  48. # /^##/:
  49. # * save line in hold space
  50. # * purge line
  51. # * Loop:
  52. # * append newline + line to hold space
  53. # * go to next line
  54. # * if line starts with doc comment, strip comment character off and loop
  55. # * remove target prerequisites
  56. # * append hold space (+ newline) to line
  57. # * replace newline plus comments by `---`
  58. # * print line
  59. # Separate expressions are necessary because labels cannot be delimited by
  60. # semicolon; see <http://stackoverflow.com/a/11799865/1968>
  61. .PHONY: help
  62. help:
  63. @echo "$$(tput bold)Available rules:$$(tput sgr0)"
  64. @echo
  65. @sed -n -e "/^## / Missing" $Missing \
  66. | LC_ALL='C' sort --ignore-case \
  67. | awk -F '---' \
  68. -v ncol=$$(tput cols) \
  69. -v indent=19 \
  70. -v col_on="$$(tput setaf 6)" \
  71. -v col_off="$$(tput sgr0)" \
  72. 'Missing \
  73. printf "%s ", words[i]; \
  74. } \
  75. printf "\n"; \
  76. }' \
  77. | 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...