File tree Expand file tree Collapse file tree
{{cookiecutter.project_slug}} Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,10 +32,6 @@ def post_gen_project():
3232 else :
3333 remove_file (".envrc" )
3434
35- if "{{ cookiecutter.enable_aws }}" == "True" :
36- with open ("requirements.txt" , "w" ) as f :
37- f .write (f"boto3" )
38-
3935 print ("Creating virtual python environment..." )
4036 os .system ("python -m venv .venv" )
4137
@@ -47,7 +43,7 @@ def post_gen_project():
4743 if "{{ cookiecutter.enable_direnv }}" != "True" :
4844 out += " && . .venv/bin/activate"
4945 if "{{ cookiecutter.enable_aws }}" == "True" :
50- out += " && make piplock "
46+ out += " && make install boto3 "
5147 print (out )
5248
5349
Original file line number Diff line number Diff line change @@ -15,18 +15,24 @@ init:
1515 direnv allow .
1616 type python
1717
18- # # piplock: installs dependencies in requirements.txt and generates piplock.txt
19- .PHONY : piplock
20- piplock :
21- python -m pip install --upgrade pip
22- pip install -r requirements.txt
23- pip freeze > piplock.txt
24-
25- # # install: install project dependencies from piplock.txt
18+ # # install: add a new package (make install <package>), or install all project dependencies from piplock.txt (make install)
2619.PHONY : install
2720install :
2821 python -m pip install --upgrade pip
22+ ifeq ($(filter-out $@ ,$(MAKECMDGOALS ) ) ,)
23+ @echo "Installing dependencies from piplock.txt"
2924 pip install -r piplock.txt
25+ else
26+ @echo "Adding package $(filter-out $@,$(MAKECMDGOALS)) to requirements.txt"
27+ @grep -q "^$(filter-out $@,$(MAKECMDGOALS))$$" requirements.txt || echo "$(filter-out $@,$(MAKECMDGOALS))" >> requirements.txt
28+ pip install $(filter-out $@,$(MAKECMDGOALS))
29+ pip install -r requirements.txt
30+ pip freeze > piplock.txt
31+ endif
32+
33+ # Empty rule to handle package name argument
34+ % :
35+ @:
3036
3137# # start: run local project
3238.PHONY : start
Original file line number Diff line number Diff line change 88 Choose a make command to run
99
1010 init initialize a new python project
11- piplock installs dependencies in requirements.txt and generates piplock.txt
12- install install project dependencies from piplock.txt
11+ install: add a new package (make install <package>), or install all project dependencies from piplock.txt (make install)
1312 start run local project
1413```
1514
You can’t perform that action at this time.
0 commit comments