Skip to main content
Alpha
This lesson is in the alpha phase, which means that it has been taught once and lesson authors are iterating on feedback.
Key Points
- We hope to improve on executing instructions from a README.
- Use
# for comments in Makefiles.
- Write rules as
target: dependencies.
- Specify update actions in a tab-indented block under the rule.
- Use
.PHONY to mark targets that don’t correspond to
files.
- A well designed directory tree rather than a single heap of large
scripts can make a project easier to understand.
- Separating plotting from calculation lets you focus on separate
tasks separately and saves redoing expensive calculations when tweaking
appearance.
- While the automatic variables in a Makefile look mysterious, they
support the DRY principle. Here we have used:
-
$(@D) which refers to the directory of the target of
the current rule.
-
$@ which refers to the target of the current rule.
-
$^ which refers to the dependencies of the current
rule.
-
$< which refers to the first dependency of the
current rule.
- Use unit tests for finding bugs quickly, and checking changes.
- For Python code pytest works.
- Use a coverage tool for finding code that the testing suit
missed.
- For Python code coverage works.
- We use yapf to coerce Python code into standard use of white
space.
- We use lint to detect deviations of our Python code from standards
specified in pylintrc.
- We use mypy to check our use of Python type hints.
- Sphinx can move information from Python souce files to
documentation.
- That supports the DRY principal.
- It also supports having good information in Python source
files.