From b5336eacc20a5330a9f5d176f8a5dc27bd0965cf Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Tue, 9 Dec 2025 17:35:08 +0000 Subject: [PATCH 1/9] add run target to Makefile and implement main script --- project_template/Makefile.jinja | 4 +++ project_template/{{module_name}}/__main__.py | 26 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 project_template/{{module_name}}/__main__.py diff --git a/project_template/Makefile.jinja b/project_template/Makefile.jinja index e149a49..e0ab16b 100644 --- a/project_template/Makefile.jinja +++ b/project_template/Makefile.jinja @@ -34,6 +34,10 @@ test: ## Run the tests and check coverage. mypy: ## Run mypy. {{ package_manager }} run mypy {{ module_name }} +.PHONY: run +run: ## Run the python script + {{ package_manager }} run python -m {{ module_name }} + .PHONY: install install: ## Install the dependencies excluding dev. {% if package_manager == "poetry" -%} diff --git a/project_template/{{module_name}}/__main__.py b/project_template/{{module_name}}/__main__.py new file mode 100644 index 0000000..2da40d1 --- /dev/null +++ b/project_template/{{module_name}}/__main__.py @@ -0,0 +1,26 @@ +from decimal import Decimal + +from .calculator import Calculator + + +def main() -> None: + calc = Calculator() + # Demonstrate cumulative operations using Decimal inputs + a, b = Decimal("2"), Decimal("3") + sum_result = calc.add(a) + diff_result = calc.subtract(Decimal("1")) + prod_result = calc.multiply(b) + try: + quot_result = calc.divide(Decimal("2")) + except ValueError: + quot_result = "undefined" + + print(f"Using Calculator with a={a}, b={b}") + print(f"add: {sum_result}") + print(f"subtract: {diff_result}") + print(f"multiply: {prod_result}") + print(f"divide: {quot_result}") + + +if __name__ == "__main__": + main() From 3ad7ca3b547098c682102c9d6dea4bfc4fa88b18 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 14:29:45 +0000 Subject: [PATCH 2/9] Irrelevant code removed and main file renamed. --- project_template/{{module_name}}/__main__.py | 26 ------------------- .../{{module_name}}/__main__.py.jinja | 0 2 files changed, 26 deletions(-) delete mode 100644 project_template/{{module_name}}/__main__.py create mode 100644 project_template/{{module_name}}/__main__.py.jinja diff --git a/project_template/{{module_name}}/__main__.py b/project_template/{{module_name}}/__main__.py deleted file mode 100644 index 2da40d1..0000000 --- a/project_template/{{module_name}}/__main__.py +++ /dev/null @@ -1,26 +0,0 @@ -from decimal import Decimal - -from .calculator import Calculator - - -def main() -> None: - calc = Calculator() - # Demonstrate cumulative operations using Decimal inputs - a, b = Decimal("2"), Decimal("3") - sum_result = calc.add(a) - diff_result = calc.subtract(Decimal("1")) - prod_result = calc.multiply(b) - try: - quot_result = calc.divide(Decimal("2")) - except ValueError: - quot_result = "undefined" - - print(f"Using Calculator with a={a}, b={b}") - print(f"add: {sum_result}") - print(f"subtract: {diff_result}") - print(f"multiply: {prod_result}") - print(f"divide: {quot_result}") - - -if __name__ == "__main__": - main() diff --git a/project_template/{{module_name}}/__main__.py.jinja b/project_template/{{module_name}}/__main__.py.jinja new file mode 100644 index 0000000..e69de29 From 99e1bdfa9847be8ba1d5226f780abd099ee6cdb4 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 14:52:01 +0000 Subject: [PATCH 3/9] Implement main function in __main__.py.jinja --- project_template/{{module_name}}/__main__.py.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project_template/{{module_name}}/__main__.py.jinja b/project_template/{{module_name}}/__main__.py.jinja index e69de29..047ac14 100644 --- a/project_template/{{module_name}}/__main__.py.jinja +++ b/project_template/{{module_name}}/__main__.py.jinja @@ -0,0 +1,2 @@ +def main() -> None: + pass From c5e18d6fec60a39e07d24d717ac742d37e534f81 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 14:56:37 +0000 Subject: [PATCH 4/9] Implement main function in __main__.py.jinja to perform basic calculator operations --- .../{{module_name}}/__main__.py.jinja | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/project_template/{{module_name}}/__main__.py.jinja b/project_template/{{module_name}}/__main__.py.jinja index 047ac14..25d692f 100644 --- a/project_template/{{module_name}}/__main__.py.jinja +++ b/project_template/{{module_name}}/__main__.py.jinja @@ -1,2 +1,28 @@ +from decimal import Decimal + +from {{module_name}}.calculator import Calculator + def main() -> None: - pass + calculator = Calculator() + + total = calculator.add(Decimal("10.50")) + print(f"After add: {total}") + + total = calculator.subtract(Decimal("2.25")) + print(f"After subtract: {total}") + + total = calculator.multiply(Decimal("3")) + print(f"After multiply: {total}") + + try: + total = calculator.divide(Decimal("4")) + print(f"After divide: {total}") + except ValueError as exc: + print(f"Calculation failed: {exc}") + + calculator.reset_cumulative_total() + print(f"After reset: {calculator.cumulative_total}") + + +if __name__ == "__main__": + main() From 4a9b72b0755f6d1ea9cc95fd6843a6038b1f627d Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 15:08:54 +0000 Subject: [PATCH 5/9] Code formatted --- project_template/{{module_name}}/__main__.py.jinja | 1 + 1 file changed, 1 insertion(+) diff --git a/project_template/{{module_name}}/__main__.py.jinja b/project_template/{{module_name}}/__main__.py.jinja index 25d692f..b516a1a 100644 --- a/project_template/{{module_name}}/__main__.py.jinja +++ b/project_template/{{module_name}}/__main__.py.jinja @@ -2,6 +2,7 @@ from decimal import Decimal from {{module_name}}.calculator import Calculator + def main() -> None: calculator = Calculator() From 38520cc6fb551648092862786b0c2c3bed148b09 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 15:22:08 +0000 Subject: [PATCH 6/9] Update issue templates to use consistent heading levels --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- project_template/.github/ISSUE_TEMPLATE/bug_report.md | 2 +- project_template/.github/ISSUE_TEMPLATE/feature_request.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7c1a33a..786fe47 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -### Summary +## Summary Provide a brief summary of the issue you're encountering. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5df86d2..f6fa2f2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: '' --- -### Is your feature request related to a problem? Please describe +## Is your feature request related to a problem? Please describe A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] diff --git a/project_template/.github/ISSUE_TEMPLATE/bug_report.md b/project_template/.github/ISSUE_TEMPLATE/bug_report.md index 7c1a33a..786fe47 100644 --- a/project_template/.github/ISSUE_TEMPLATE/bug_report.md +++ b/project_template/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -### Summary +## Summary Provide a brief summary of the issue you're encountering. diff --git a/project_template/.github/ISSUE_TEMPLATE/feature_request.md b/project_template/.github/ISSUE_TEMPLATE/feature_request.md index 5df86d2..f6fa2f2 100644 --- a/project_template/.github/ISSUE_TEMPLATE/feature_request.md +++ b/project_template/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: '' --- -### Is your feature request related to a problem? Please describe +## Is your feature request related to a problem? Please describe A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] From ac3883c40168d76b050ad2c3f50f7fb11ff2be5a Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 15:22:40 +0000 Subject: [PATCH 7/9] Refactor division operation in main function to remove error handling --- project_template/{{module_name}}/__main__.py.jinja | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/project_template/{{module_name}}/__main__.py.jinja b/project_template/{{module_name}}/__main__.py.jinja index b516a1a..ea5ac9f 100644 --- a/project_template/{{module_name}}/__main__.py.jinja +++ b/project_template/{{module_name}}/__main__.py.jinja @@ -15,11 +15,8 @@ def main() -> None: total = calculator.multiply(Decimal("3")) print(f"After multiply: {total}") - try: - total = calculator.divide(Decimal("4")) - print(f"After divide: {total}") - except ValueError as exc: - print(f"Calculation failed: {exc}") + total = calculator.divide(Decimal("4")) + print(f"After divide: {total}") calculator.reset_cumulative_total() print(f"After reset: {calculator.cumulative_total}") From 1a11babeaed285905075763b409113a12ca30230 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 15:55:34 +0000 Subject: [PATCH 8/9] Update issue templates to use consistent heading levels and add markdown lint configuration --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .markdown-lint.yml | 1 + project_template/.github/ISSUE_TEMPLATE/bug_report.md | 2 +- project_template/.github/ISSUE_TEMPLATE/feature_request.md | 2 +- project_template/.markdown-lint.yml | 1 + 6 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .markdown-lint.yml create mode 100644 project_template/.markdown-lint.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 786fe47..7c1a33a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -## Summary +### Summary Provide a brief summary of the issue you're encountering. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f6fa2f2..5df86d2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: '' --- -## Is your feature request related to a problem? Please describe +### Is your feature request related to a problem? Please describe A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] diff --git a/.markdown-lint.yml b/.markdown-lint.yml new file mode 100644 index 0000000..58dadc7 --- /dev/null +++ b/.markdown-lint.yml @@ -0,0 +1 @@ +MD001: false diff --git a/project_template/.github/ISSUE_TEMPLATE/bug_report.md b/project_template/.github/ISSUE_TEMPLATE/bug_report.md index 786fe47..7c1a33a 100644 --- a/project_template/.github/ISSUE_TEMPLATE/bug_report.md +++ b/project_template/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -## Summary +### Summary Provide a brief summary of the issue you're encountering. diff --git a/project_template/.github/ISSUE_TEMPLATE/feature_request.md b/project_template/.github/ISSUE_TEMPLATE/feature_request.md index f6fa2f2..5df86d2 100644 --- a/project_template/.github/ISSUE_TEMPLATE/feature_request.md +++ b/project_template/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: '' --- -## Is your feature request related to a problem? Please describe +### Is your feature request related to a problem? Please describe A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] diff --git a/project_template/.markdown-lint.yml b/project_template/.markdown-lint.yml new file mode 100644 index 0000000..58dadc7 --- /dev/null +++ b/project_template/.markdown-lint.yml @@ -0,0 +1 @@ +MD001: false From 7a9e8a92e4174bc7a1a0251adeccd66b0b77a8a8 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Thu, 8 Jan 2026 16:35:26 +0000 Subject: [PATCH 9/9] Standardise heading levels in issue templates and remove markdown lint configuration --- .github/ISSUE_TEMPLATE/bug_report.md | 12 ++++++------ .github/ISSUE_TEMPLATE/feature_request.md | 8 ++++---- .markdown-lint.yml | 1 - .../.github/ISSUE_TEMPLATE/bug_report.md | 12 ++++++------ .../.github/ISSUE_TEMPLATE/feature_request.md | 8 ++++---- project_template/.markdown-lint.yml | 1 - 6 files changed, 20 insertions(+), 22 deletions(-) delete mode 100644 .markdown-lint.yml delete mode 100644 project_template/.markdown-lint.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7c1a33a..7c45275 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -### Summary +## Summary Provide a brief summary of the issue you're encountering. @@ -19,15 +19,15 @@ Describe the steps you took when you encountered the bug: 2. ... 3. ... -### Expected Behavior +## Expected Behavior What did you expect to happen when you followed the steps above? -### Actual Behavior +## Actual Behavior Describe what actually happened. Include details like error messages or unexpected outcomes. -### Technical Details +## Technical Details Any relevant technical information. Include as much information as possible, including: @@ -35,10 +35,10 @@ Any relevant technical information. Include as much information as possible, inc - **Browser/Application Version**: - **Additional relevant software versions**: -### Proposed Solutions (Optional) +## Proposed Solutions (Optional) If you have any suggestions on how to fix this issue, please share them here. -### Screenshots +## Screenshots Attach any screenshots that help illustrate the issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5df86d2..5b86f27 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,18 +7,18 @@ assignees: '' --- -### Is your feature request related to a problem? Please describe +## Is your feature request related to a problem? Please describe A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -### Describe the solution you'd like +## Describe the solution you'd like A clear and concise description of what you want to happen. -### Describe alternatives you've considered +## Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. -### Additional context +## Additional context Add any other context or screenshots about the feature request here. diff --git a/.markdown-lint.yml b/.markdown-lint.yml deleted file mode 100644 index 58dadc7..0000000 --- a/.markdown-lint.yml +++ /dev/null @@ -1 +0,0 @@ -MD001: false diff --git a/project_template/.github/ISSUE_TEMPLATE/bug_report.md b/project_template/.github/ISSUE_TEMPLATE/bug_report.md index 7c1a33a..7c45275 100644 --- a/project_template/.github/ISSUE_TEMPLATE/bug_report.md +++ b/project_template/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -### Summary +## Summary Provide a brief summary of the issue you're encountering. @@ -19,15 +19,15 @@ Describe the steps you took when you encountered the bug: 2. ... 3. ... -### Expected Behavior +## Expected Behavior What did you expect to happen when you followed the steps above? -### Actual Behavior +## Actual Behavior Describe what actually happened. Include details like error messages or unexpected outcomes. -### Technical Details +## Technical Details Any relevant technical information. Include as much information as possible, including: @@ -35,10 +35,10 @@ Any relevant technical information. Include as much information as possible, inc - **Browser/Application Version**: - **Additional relevant software versions**: -### Proposed Solutions (Optional) +## Proposed Solutions (Optional) If you have any suggestions on how to fix this issue, please share them here. -### Screenshots +## Screenshots Attach any screenshots that help illustrate the issue. diff --git a/project_template/.github/ISSUE_TEMPLATE/feature_request.md b/project_template/.github/ISSUE_TEMPLATE/feature_request.md index 5df86d2..5b86f27 100644 --- a/project_template/.github/ISSUE_TEMPLATE/feature_request.md +++ b/project_template/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,18 +7,18 @@ assignees: '' --- -### Is your feature request related to a problem? Please describe +## Is your feature request related to a problem? Please describe A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -### Describe the solution you'd like +## Describe the solution you'd like A clear and concise description of what you want to happen. -### Describe alternatives you've considered +## Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. -### Additional context +## Additional context Add any other context or screenshots about the feature request here. diff --git a/project_template/.markdown-lint.yml b/project_template/.markdown-lint.yml deleted file mode 100644 index 58dadc7..0000000 --- a/project_template/.markdown-lint.yml +++ /dev/null @@ -1 +0,0 @@ -MD001: false