Skip to content

Commit 163c485

Browse files
committed
added mypy
1 parent c30f6bd commit 163c485

5 files changed

Lines changed: 29 additions & 8 deletions

File tree

cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"https"
4949
],
5050
"__template_repo": "https://github.com/btr1975/cookiecutter-python-library",
51-
"__template_version": "2.0.3",
51+
"__template_version": "2.0.4",
5252
"_new_lines": "\n",
5353
"_copy_without_render": [
5454
".github"

{{cookiecutter.git_repo_name}}/Makefile

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

66
.PHONY: all info build build-container coverage format pylint pytest start-container stop-container remove-container \
7-
gh-pages check-vuln pip-export
7+
gh-pages check-vuln pip-export mypy
88

99
info:
1010
@echo "make options"
@@ -15,6 +15,7 @@ info:
1515
@echo " check-security To check for vulnerabilities in the code"
1616
@echo " coverage To run coverage and display ASCII and output to htmlcov"
1717
@echo " format To format the code with black"
18+
@echo " mypy To run mypy"
1819
@echo " pylint To run pylint"
1920
@echo " pytest To run pytest with verbose option"
2021
@echo " start-container To start the container"
@@ -24,7 +25,7 @@ info:
2425

2526
{% if cookiecutter.package_manager == 'pip' %}
2627

27-
all: format pylint coverage check-security check-vuln
28+
all: format pylint mypy coverage check-security check-vuln
2829

2930
build:
3031
@python -m build
@@ -48,6 +49,9 @@ check-vuln:
4849
check-security:
4950
@bandit -c pyproject.toml -r .
5051

52+
mypy:
53+
@mypy {{cookiecutter.__library_name}}/
54+
5155
{% if cookiecutter.library_documents_location == 'github-pages' %}
5256
gh-pages:
5357
@rm -rf ./docs/source/code
@@ -57,7 +61,7 @@ gh-pages:
5761

5862
{% elif cookiecutter.package_manager == 'uv' %}
5963

60-
all: format pylint coverage check-security pip-export
64+
all: format pylint mypy coverage check-security pip-export
6165

6266
build:
6367
@uv build --wheel --sdist
@@ -78,6 +82,9 @@ pytest:
7882
check-security:
7983
@uv run bandit -c pyproject.toml -r .
8084

85+
mypy:
86+
@uv run mypy {{cookiecutter.__library_name}}/
87+
8188
pip-export:
8289
@uv export --no-dev --no-emit-project --no-editable > requirements.txt
8390
@uv export --no-emit-project --no-editable > requirements-dev.txt

{{cookiecutter.git_repo_name}}/make.bat

Lines changed: 14 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: 2.0.0
4+
REM Version: 2.0.1
55
REM
66

77
SET option=%1
@@ -16,6 +16,7 @@ IF "%option%" == "all" (
1616
black {{cookiecutter.__library_name}}/
1717
black tests/
1818
pylint {{cookiecutter.__library_name}}\
19+
mypy {{cookiecutter.__library_name}}\
1920
pytest --cov --cov-report=html -vvv
2021
bandit -c pyproject.toml -r .
2122
pip-audit -r requirements.txt
@@ -58,6 +59,11 @@ IF "%option%" == "check-security" (
5859
GOTO END
5960
)
6061

62+
IF "%option%" == "mypy" (
63+
mypy {{cookiecutter.__library_name}}\
64+
GOTO END
65+
)
66+
6167
{% if cookiecutter.library_documents_location == 'github-pages' %}
6268
IF "%option%" == "gh-pages" (
6369
rmdir /s /q docs\source\code
@@ -73,6 +79,7 @@ IF "%option%" == "all" (
7379
uv run black {{cookiecutter.__library_name}}/
7480
uv run black tests/
7581
uv run pylint {{cookiecutter.__library_name}}\
82+
uv run mypy {{cookiecutter.__library_name}}\
7683
uv run pytest --cov --cov-report=html -vvv
7784
uv run bandit -c pyproject.toml -r .
7885
uv export --no-dev --no-emit-project --no-editable > requirements.txt
@@ -111,6 +118,11 @@ IF "%option%" == "check-security" (
111118
GOTO END
112119
)
113120

121+
IF "%option%" == "mypy" (
122+
uv run mypy {{cookiecutter.__library_name}}\
123+
GOTO END
124+
)
125+
114126
IF "%option%" == "pip-export" (
115127
uv export --no-dev --no-emit-project --no-editable > requirements.txt
116128
uv export --no-emit-project --no-editable > requirements-dev.txt
@@ -136,6 +148,7 @@ IF "%option%" == "gh-pages" (
136148
@ECHO check-vuln To check for vulnerabilities in the dependencies
137149
@ECHO check-security To check for vulnerabilities in the code
138150
@ECHO format To format the code with black
151+
@ECHO mypy To run mypy
139152
@ECHO pylint To run pylint
140153
@ECHO pytest To run pytest with verbose option
141154
{% if cookiecutter.package_manager == 'uv' %}@ECHO pip-export To export the requirements.txt and requirements-dev.txt{% endif %}

{{cookiecutter.git_repo_name}}/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ classifiers = [
5656
{% if cookiecutter.minimum_python_version == '3.12' %}"Programming Language :: Python :: 3.12",
5757
"Programming Language :: Python :: 3.13",
5858
"Programming Language :: Python :: 3.14",{% endif -%}
59-
{% if cookiecutter.minimum_python_version == '3.13' %}
60-
"Programming Language :: Python :: 3.13",
59+
{% if cookiecutter.minimum_python_version == '3.13' %}"Programming Language :: Python :: 3.13",
6160
"Programming Language :: Python :: 3.14",{% endif -%}
6261
{% if cookiecutter.minimum_python_version == '3.14' %}"Programming Language :: Python :: 3.14",{% endif -%}
6362

@@ -80,6 +79,7 @@ dev = [
8079
"sphinx_rtd_theme",
8180
"sphinxcontrib-mermaid",
8281
"bandit",
82+
"mypy",
8383
{% if cookiecutter.use_requests == 'y' %}"requests-mock",{% endif %}
8484
]
8585
{% endif %}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ sphinx_rtd_theme
1414
sphinxcontrib-mermaid
1515
twine
1616
bandit
17+
mypy
1718
{% if cookiecutter.use_requests == 'y' %}requests-mock{% endif %}

0 commit comments

Comments
 (0)