Skip to content

Commit 15b6c79

Browse files
committedOct 18, 2024
added vuln checking to created, add all option to created, added min python version
1 parent 3db45f6 commit 15b6c79

File tree

5 files changed

+91
-24
lines changed

5 files changed

+91
-24
lines changed
 

‎cookiecutter.json

+41-8
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,46 @@
66
"git_url": "https://github.com/{{ cookiecutter.git_username }}/{{ cookiecutter.git_repo_name }}",
77
"app_description": "A short description",
88
"app_version": "0.1.0",
9-
"app_documents_location": ["readthedocs.io", "github-pages"],
10-
"app_documents_theme": ["sphinx_rtd_theme", "alabaster"],
9+
"app_documents_location": [
10+
"readthedocs.io",
11+
"github-pages"
12+
],
13+
"app_documents_theme": [
14+
"sphinx_rtd_theme",
15+
"alabaster"
16+
],
1117
"__app_name": "{{ cookiecutter.git_repo_name.lower().replace(' ', '_').replace('-', '_') }}",
12-
"use_requests": ["n", "y"],
13-
"use_cryptography": ["n", "y"],
14-
"include_webpages": ["n", "y"],
15-
"container_runtime": ["podman", "docker"],
18+
"minimum_python_version": [
19+
"3.9",
20+
"3.10",
21+
"3.11",
22+
"3.12",
23+
"3.13"
24+
],
25+
"use_requests": [
26+
"n",
27+
"y"
28+
],
29+
"use_cryptography": [
30+
"n",
31+
"y"
32+
],
33+
"include_webpages": [
34+
"n",
35+
"y"
36+
],
37+
"container_runtime": [
38+
"podman",
39+
"docker"
40+
],
1641
"__template_repo": "https://github.com/btr1975/cookiecutter-python-fastapi-openapi",
1742
"__template_version": "1.0.10",
18-
"_new_lines":"\n",
43+
"_new_lines": "\n",
1944
"_copy_without_render": [
2045
"{{cookiecutter.__app_name}}/templates",
2146
".github"
2247
],
23-
"__prompts__": {
48+
"__prompts__": {
2449
"full_name": "Your Full Name",
2550
"email": "Your E-Mail Address",
2651
"git_username": "Your GitHub Username or GitHub Organization Name",
@@ -38,6 +63,14 @@
3863
"sphinx_rtd_theme": "Read the Docs Theme",
3964
"alabaster": "Alabaster Theme"
4065
},
66+
"minimum_python_version": {
67+
"__prompt__": "Which minimum Python version will be supported",
68+
"3.9": "3.9",
69+
"3.10": "3.10",
70+
"3.11": "3.11",
71+
"3.12": "3.12",
72+
"3.13": "3.13"
73+
},
4174
"use_requests": {
4275
"__prompt__": "Will you use the requests library",
4376
"n": "No",

‎{{cookiecutter.git_repo_name}}/Makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Makefile for project needs
22
# Author: Ben Trachtenberg
3-
# Version: 1.0.7
3+
# Version: 1.0.8
44
#
55

6-
.PHONY: info build build-container coverage format pylint pytest gh-pages build dev-run start-container \
7-
stop-container remove-container
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
88

99
info:
1010
@echo "make options"
11+
@echo " all To run coverage, format, pylint, and check-vuln"
1112
@echo " build To build a distribution"
1213
@echo " build-container To build a container image"
14+
@echo " check-vuln To check for vulnerabilities in the dependencies"
1315
@echo " coverage To run coverage and display ASCII and output to htmlcov"
1416
@echo " dev-run To run the app"
1517
@echo " format To format the code with black"
@@ -20,6 +22,8 @@ info:
2022
@echo " remove-container To remove the container"
2123
{% if cookiecutter.app_documents_location == 'github-pages' %} @echo " gh-pages To create the GitHub pages"{% endif %}
2224

25+
all: coverage format pylint check-vuln
26+
2327
build:
2428
@python -m build
2529

@@ -38,6 +42,7 @@ coverage:
3842

3943
format:
4044
@black {{cookiecutter.__app_name}}/
45+
@black tests/
4146

4247
pylint:
4348
@pylint {{cookiecutter.__app_name}}/
@@ -76,3 +81,6 @@ stop-container:
7681
remove-container:
7782
@docker rm {{ cookiecutter.git_repo_name }}
7883
{% endif %}
84+
85+
check-vuln:
86+
@pip-audit -r requirements.txt

‎{{cookiecutter.git_repo_name}}/make.bat

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
@ECHO OFF
22
REM Makefile for project needs
33
REM Author: Ben Trachtenberg
4-
REM Version: 1.0.5
4+
REM Version: 1.0.6
55
REM
66

7+
IF "%1" == "all" (
8+
pytest --cov --cov-report=html -vvv
9+
black {{cookiecutter.__app_name}}/
10+
black tests/
11+
pylint {{cookiecutter.__app_name}}\
12+
pip-audit -r requirements.txt
13+
GOTO END
14+
)
15+
716
IF "%1" == "build" (
817
python -m build
918
GOTO END
@@ -31,6 +40,12 @@ IF "%1" == "dev-run" (
3140

3241
IF "%1" == "format" (
3342
black {{cookiecutter.__app_name}}/
43+
black tests/
44+
GOTO END
45+
)
46+
47+
IF "%1" == "check-vuln" (
48+
pip-audit -r requirements.txt
3449
GOTO END
3550
)
3651

@@ -44,12 +59,14 @@ IF "%1" == "gh-pages" (
4459
{% endif %}
4560

4661
@ECHO make options
47-
@ECHO build To build a distribution
48-
@ECHO coverage To run coverage and display ASCII and output to htmlcov
49-
@ECHO dev-run To run the app
50-
@ECHO format To format the code with black
51-
@ECHO pylint To run pylint
52-
@ECHO pytest To run pytest with verbose option
62+
@ECHO all To run coverage, format, pylint, and check-vuln
63+
@ECHO build To build a distribution
64+
@ECHO check-vuln To check for vulnerabilities
65+
@ECHO coverage To run coverage and display ASCII and output to htmlcov
66+
@ECHO dev-run To run the app
67+
@ECHO format To format the code with black
68+
@ECHO pylint To run pylint
69+
@ECHO pytest To run pytest with verbose option
5370
{% if cookiecutter.app_documents_location == 'github-pages' %}@ECHO gh-pages To create the GitHub pages{% endif %}
5471

5572
:END

‎{{cookiecutter.git_repo_name}}/pyproject.toml

+14-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
88
[project]
99
name = "{{ cookiecutter.git_repo_name }}"
1010
dynamic = ["version", "readme", "dependencies"]
11-
requires-python = ">=3.8"
11+
requires-python = ">={{ cookiecutter.minimum_python_version }}"
1212
description = "{{ cookiecutter.app_description }}"
1313
keywords = [
1414
]
@@ -31,11 +31,22 @@ classifiers = [
3131
"Operating System :: Microsoft :: Windows",
3232
"Programming Language :: Python :: 3",
3333
"Programming Language :: Python :: 3 :: Only",
34-
"Programming Language :: Python :: 3.8",
35-
"Programming Language :: Python :: 3.9",
34+
{% if cookiecutter.minimum_python_version == '3.9' %}"Programming Language :: Python :: 3.9",
3635
"Programming Language :: Python :: 3.10",
3736
"Programming Language :: Python :: 3.11",
3837
"Programming Language :: Python :: 3.12",
38+
"Programming Language :: Python :: 3.13",{% endif -%}
39+
{% if cookiecutter.minimum_python_version == '3.10' %}"Programming Language :: Python :: 3.10",
40+
"Programming Language :: Python :: 3.11",
41+
"Programming Language :: Python :: 3.12",
42+
"Programming Language :: Python :: 3.13",{% endif -%}
43+
{% if cookiecutter.minimum_python_version == '3.11' %}"Programming Language :: Python :: 3.11",
44+
"Programming Language :: Python :: 3.12",
45+
"Programming Language :: Python :: 3.13",{% endif -%}
46+
{% if cookiecutter.minimum_python_version == '3.12' %}"Programming Language :: Python :: 3.12",
47+
"Programming Language :: Python :: 3.13",{% endif -%}
48+
{% if cookiecutter.minimum_python_version == '3.13' %}"Programming Language :: Python :: 3.13",{% endif -%}
49+
3950
]
4051

4152
[project.urls]
@@ -63,9 +74,6 @@ version = {attr = "{{cookiecutter.__app_name}}.version.__version__"}
6374
readme = {file = "README.md", content-type = "text/markdown"}
6475
dependencies = {file = "requirements.txt"}
6576

66-
[tool.distutils.bdist_wheel]
67-
universal = true
68-
6977
[tool.pytest.ini_options]
7078
addopts = "--strict-markers"
7179
markers = [

‎{{cookiecutter.git_repo_name}}/requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
-r requirements.txt
55
build
6+
pip-audit
67
black
78
tomli
89
pytest-cov

0 commit comments

Comments
 (0)