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.1 KB

Comment on lines L36

Dean Pleban

@ShambhaviCodes How does this line work? Can we have an install_precommits that automatically adds all the pre-commit hooks?

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
  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. ## To use the pre-commit hooks
  28. precommit:
  29. pre-commit run <hook-id>
  30. ## Lint using flake8
  31. lint:
  32. flake8 src
  33. ## Upload Data to default DVC remote
  34. push:
  35. dvc push
  36. ## Download Data from default DVC remote
  37. pull:
  38. dvc pull
  39. ## Reproduce the DVC pipeline - recompute any modified outputs such as processed data or trained models
  40. reproduce:
  41. dvc repro
  42. #################################################################################
  43. # PROJECT RULES #
  44. #################################################################################
  45. #################################################################################
  46. # Self Documenting Commands #
  47. #################################################################################
  48. .DEFAULT_GOAL := reproduce
  49. # Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
  50. # sed script explained:
  51. # /^##/:
  52. # * save line in hold space
  53. # * purge line
  54. # * Loop:
  55. # * append newline + line to hold space
  56. # * go to next line
  57. # * if line starts with doc comment, strip comment character off and loop
  58. # * remove target prerequisites
  59. # * append hold space (+ newline) to line
  60. # * replace newline plus comments by `---`
  61. # * print line
  62. # Separate expressions are necessary because labels cannot be delimited by
  63. # semicolon; see <http://stackoverflow.com/a/11799865/1968>
  64. .PHONY: help
  65. help:
  66. @echo "$$(tput bold)Available rules:$$(tput sgr0)"
  67. @echo
  68. @sed -n -e "/^## / Missing" $Missing \
  69. | LC_ALL='C' sort --ignore-case \
  70. | awk -F '---' \
  71. -v ncol=$$(tput cols) \
  72. -v indent=19 \
  73. -v col_on="$$(tput setaf 6)" \
  74. -v col_off="$$(tput sgr0)" \
  75. 'Missing \
  76. printf "%s ", words[i]; \
  77. } \
  78. printf "\n"; \
  79. }' \
  80. | 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

Dean Pleban

commented in commit2dcd1f3e96on branch master

1 year ago

@ShambhaviCodes How does this line work? Can we have an install_precommits that automatically adds all the pre-commit hooks?

Shambhavi Mishra

commented in commit2dcd1f3e96

1 year ago

Updated, now 'make precommit' should add all the pre-commit hooks!

Loading...