Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ update-template-packages: ## Update the project using the initial copier templa
.PHONY: clean
clean: ## Clean the temporary files.
rm -rf megalinter-reports

.PHONY: run
run: ## Run the application
poetry run python {{module_name}}
Comment on lines +41 to +43
Copy link
Collaborator

@MebinAbraham MebinAbraham Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

  1. This is the wrong file; you need to add this to https://github.com/ONSdigital/ons-python-template/blob/main/project_template/Makefile.jinja (templates makefile, not this repo's root template)

  2. You also need to make it agnostic to the package manager, so it should be:

{{ package_manager }} run python {{ module_name }}
  1. Please add this new __main__.py file to https://github.com/ONSdigital/ons-python-template#structure

8 changes: 8 additions & 0 deletions project_template/{{module_name}}/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from calculator import Calculator
calc = Calculator()

calc.add(5)

calc.subtract(2)

print(calc.cumulative_total)
Comment on lines +1 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would currently raise lint failures.

Suggested change
from calculator import Calculator
calc = Calculator()
calc.add(5)
calc.subtract(2)
print(calc.cumulative_total)
from calculator import Calculator
calc = Calculator()
calc.add(5)
calc.subtract(2)
print(calc.cumulative_total)