1
1
# Makefile for project needs
2
2
# Author: Ben Trachtenberg
3
- # Version: 1 .0.8
3
+ # Version: 2 .0.0
4
4
#
5
5
6
6
.PHONY : all info build build-container coverage format pylint pytest gh-pages build dev-run start-container \
7
- stop-container remove-container check-vuln check-security
7
+ stop-container remove-container check-vuln check-security pip-export
8
8
9
9
info :
10
10
@echo " make options"
@@ -21,23 +21,16 @@ info:
21
21
@echo " start-container To start the container"
22
22
@echo " stop-container To stop the container"
23
23
@echo " remove-container To remove the container"
24
+ {% if cookiecutter.package_manager == 'uv' %} @echo " pip-export To export the requirements to requirements.txt and requirements-dev.txt"{% endif %}
24
25
{% if cookiecutter.app_documents_location == 'github-pages' %} @echo " gh-pages To create the GitHub pages"{% endif %}
25
26
27
+ {% if cookiecutter.package_manager == 'pip' %}
28
+
26
29
all : format pylint coverage check-security check-vuln
27
30
28
31
build :
29
32
@python -m build
30
33
31
- {% if cookiecutter.container_runtime == "podman" %}
32
- build-container :
33
- @cd containers && podman build --ssh=default --build-arg=build_branch=main -t {{ cookiecutter.git_repo_name }}:latest -f Containerfile
34
- {% endif %}
35
-
36
- {% if cookiecutter.container_runtime == "docker" %}
37
- build-container :
38
- @cd containers && docker build --ssh=default --build-arg=build_branch=main -t {{ cookiecutter.git_repo_name }}:latest -f Dockerfile
39
- {% endif %}
40
-
41
34
coverage :
42
35
@pytest --cov --cov-report=html -vvv
43
36
@@ -54,14 +47,62 @@ pytest:
54
47
dev-run :
55
48
@python -c " from {{cookiecutter.__app_name}} import cli;cli()" start -p 8080 -r
56
49
50
+ check-vuln :
51
+ @pip-audit -r requirements.txt
52
+
53
+ check-security :
54
+ @bandit -c pyproject.toml -r .
55
+
57
56
{% if cookiecutter.app_documents_location == 'github-pages' %}
58
57
gh-pages :
59
58
@rm -rf ./docs/source/code
60
59
@sphinx-apidoc -o ./docs/source/code ./{{cookiecutter.__app_name}}
61
60
@sphinx-build ./docs ./docs/gh-pages
62
61
{% endif %}
63
62
63
+ {% elif cookiecutter.package_manager == 'uv' %}
64
+
65
+ all : format pylint coverage check-security pip-export
66
+
67
+ build :
68
+ @python -m build
69
+
70
+ coverage :
71
+ @uv run pytest --cov --cov-report=html -vvv
72
+
73
+ format :
74
+ @uv run black {{cookiecutter.__app_name}}/
75
+ @uv run black tests/
76
+
77
+ pylint :
78
+ @uv run pylint {{cookiecutter.__app_name}}/
79
+
80
+ pytest :
81
+ @uv run pytest --cov -vvv
82
+
83
+ dev-run :
84
+ @uv run python -c " from {{cookiecutter.__app_name}} import cli;cli()" start -p 8080 -r
85
+
86
+ check-security :
87
+ @uv run bandit -c pyproject.toml -r .
88
+
89
+ pip-export :
90
+ @uv export --no-dev --no-emit-project --no-editable > requirements.txt
91
+ @uv export --no-emit-project --no-editable > requirements-dev.txt
92
+
93
+ {% if cookiecutter.app_documents_location == 'github-pages' %}
94
+ gh-pages :
95
+ @rm -rf ./docs/source/code
96
+ @uv run sphinx-apidoc -o ./docs/source/code ./{{cookiecutter.__app_name}}
97
+ @uv run sphinx-build ./docs ./docs/gh-pages
98
+ {% endif %}
99
+
100
+ {% endif %}
101
+
64
102
{% if cookiecutter.container_runtime == "podman" %}
103
+ build-container :
104
+ @cd containers && podman build --ssh=default --build-arg=build_branch=main -t {{ cookiecutter.git_repo_name }}:latest -f Containerfile
105
+
65
106
start-container :
66
107
@podman run -itd --name {{ cookiecutter.git_repo_name }} -p 8080:8080 localhost/{{ cookiecutter.git_repo_name }}:latest
67
108
@@ -73,6 +114,9 @@ remove-container:
73
114
{% endif %}
74
115
75
116
{% if cookiecutter.container_runtime == "docker" %}
117
+ build-container :
118
+ @cd containers && docker build --ssh=default --build-arg=build_branch=main -t {{ cookiecutter.git_repo_name }}:latest -f Dockerfile
119
+
76
120
start-container :
77
121
@docker run -itd --name {{ cookiecutter.git_repo_name }} -p 8080:8080 localhost/{{ cookiecutter.git_repo_name }}:latest
78
122
@@ -82,9 +126,3 @@ stop-container:
82
126
remove-container :
83
127
@docker rm {{ cookiecutter.git_repo_name }}
84
128
{% endif %}
85
-
86
- check-vuln :
87
- @pip-audit -r requirements.txt
88
-
89
- check-security :
90
- @bandit -c pyproject.toml -r .
0 commit comments