Skip to content

Commit 64aec49

Browse files
committed
updated makes for uv option
1 parent d3609c3 commit 64aec49

File tree

2 files changed

+126
-19
lines changed

2 files changed

+126
-19
lines changed

{{cookiecutter.git_repo_name}}/Makefile

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Makefile for project needs
22
# Author: Ben Trachtenberg
3-
# Version: 1.0.8
3+
# Version: 2.0.0
44
#
55

66
.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
88

99
info:
1010
@echo "make options"
@@ -21,23 +21,16 @@ info:
2121
@echo " start-container To start the container"
2222
@echo " stop-container To stop the container"
2323
@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 %}
2425
{% if cookiecutter.app_documents_location == 'github-pages' %} @echo " gh-pages To create the GitHub pages"{% endif %}
2526

27+
{% if cookiecutter.package_manager == 'pip' %}
28+
2629
all: format pylint coverage check-security check-vuln
2730

2831
build:
2932
@python -m build
3033

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-
4134
coverage:
4235
@pytest --cov --cov-report=html -vvv
4336

@@ -54,14 +47,62 @@ pytest:
5447
dev-run:
5548
@python -c "from {{cookiecutter.__app_name}} import cli;cli()" start -p 8080 -r
5649

50+
check-vuln:
51+
@pip-audit -r requirements.txt
52+
53+
check-security:
54+
@bandit -c pyproject.toml -r .
55+
5756
{% if cookiecutter.app_documents_location == 'github-pages' %}
5857
gh-pages:
5958
@rm -rf ./docs/source/code
6059
@sphinx-apidoc -o ./docs/source/code ./{{cookiecutter.__app_name}}
6160
@sphinx-build ./docs ./docs/gh-pages
6261
{% endif %}
6362

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+
64102
{% 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+
65106
start-container:
66107
@podman run -itd --name {{ cookiecutter.git_repo_name }} -p 8080:8080 localhost/{{ cookiecutter.git_repo_name }}:latest
67108

@@ -73,6 +114,9 @@ remove-container:
73114
{% endif %}
74115

75116
{% 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+
76120
start-container:
77121
@docker run -itd --name {{ cookiecutter.git_repo_name }} -p 8080:8080 localhost/{{ cookiecutter.git_repo_name }}:latest
78122

@@ -82,9 +126,3 @@ stop-container:
82126
remove-container:
83127
@docker rm {{ cookiecutter.git_repo_name }}
84128
{% endif %}
85-
86-
check-vuln:
87-
@pip-audit -r requirements.txt
88-
89-
check-security:
90-
@bandit -c pyproject.toml -r .

{{cookiecutter.git_repo_name}}/make.bat

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@ECHO OFF
22
REM Makefile for project needs
33
REM Author: Ben Trachtenberg
4-
REM Version: 1.0.7
4+
REM Version: 2.0.0
55
REM
66

77
SET option=%1
@@ -10,6 +10,8 @@ IF "%option%" == "" (
1010
GOTO BAD_OPTIONS
1111
)
1212

13+
{% if cookiecutter.package_manager == 'pip' %}
14+
1315
IF "%option%" == "all" (
1416
black {{cookiecutter.__app_name}}/
1517
black tests/
@@ -70,6 +72,72 @@ IF "%option%" == "gh-pages" (
7072
)
7173
{% endif %}
7274

75+
{% elif cookiecutter.package_manager == 'uv' %}
76+
77+
IF "%option%" == "all" (
78+
uv run black {{cookiecutter.__app_name}}/
79+
uv run black tests/
80+
uv run pylint {{cookiecutter.__app_name}}\
81+
uv run pytest --cov --cov-report=html -vvv
82+
uv run bandit -c pyproject.toml -r .
83+
uv export --no-dev --no-emit-project --no-editable > requirements.txt
84+
uv export --no-emit-project --no-editable > requirements-dev.txt
85+
GOTO END
86+
)
87+
88+
IF "%option%" == "build" (
89+
uv build --wheel --sdist
90+
GOTO END
91+
)
92+
93+
IF "%option%" == "coverage" (
94+
uv run pytest --cov --cov-report=html -vvv
95+
GOTO END
96+
)
97+
98+
IF "%option%" == "pylint" (
99+
uv run pylint {{cookiecutter.__app_name}}\
100+
GOTO END
101+
)
102+
103+
IF "%option%" == "pytest" (
104+
uv run pytest --cov -vvv
105+
GOTO END
106+
)
107+
108+
IF "%option%" == "dev-run" (
109+
uv run python -c "from {{cookiecutter.__app_name}} import cli;cli()" start -p 8080 -r
110+
GOTO END
111+
)
112+
113+
IF "%option%" == "format" (
114+
uv run black {{cookiecutter.__app_name}}/
115+
uv run black tests/
116+
GOTO END
117+
)
118+
119+
IF "%option%" == "check-security" (
120+
uv run bandit -c pyproject.toml -r .
121+
GOTO END
122+
)
123+
124+
IF "%option%" == "pip-export" (
125+
uv export --no-dev --no-emit-project --no-editable > requirements.txt
126+
uv export --no-emit-project --no-editable > requirements-dev.txt
127+
GOTO END
128+
)
129+
130+
{% if cookiecutter.app_documents_location == 'github-pages' %}
131+
IF "%option%" == "gh-pages" (
132+
rmdir /s /q docs\source\code
133+
uv run sphinx-apidoc -o ./docs/source/code ./{{cookiecutter.__app_name}}
134+
uv run sphinx-build ./docs ./docs/gh-pages
135+
GOTO END
136+
)
137+
{% endif %}
138+
139+
{% endif %}
140+
73141
:OPTIONS
74142
@ECHO make options
75143
@ECHO all To run coverage, format, pylint, and check-vuln
@@ -81,6 +149,7 @@ IF "%option%" == "gh-pages" (
81149
@ECHO format To format the code with black
82150
@ECHO pylint To run pylint
83151
@ECHO pytest To run pytest with verbose option
152+
{% if cookiecutter.package_manager == 'uv' %}@ECHO pip-export To export the requirements.txt and requirements-dev.txt{% endif %}
84153
{% if cookiecutter.app_documents_location == 'github-pages' %}@ECHO gh-pages To create the GitHub pages{% endif %}
85154
GOTO END
86155

0 commit comments

Comments
 (0)