diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ce5f2a..e73f169 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,8 +34,14 @@ repos: rev: "v3.6.2" hooks: - id: prettier + exclude_types: [markdown] exclude: ^pixi\.lock$ + - repo: https://github.com/rvben/rumdl-pre-commit + rev: "v0.2.73" + hooks: + - id: rumdl-fmt + - repo: https://github.com/codespell-project/codespell rev: "v2.4.1" hooks: diff --git a/.prettierrc.toml b/.prettierrc.toml index 7f00d77..614531e 100644 --- a/.prettierrc.toml +++ b/.prettierrc.toml @@ -1,6 +1 @@ -proseWrap = "always" printWidth = 80 - -[[overrides]] -files = "slides/*.md" -options.proseWrap = "never" diff --git a/.rumdl.toml b/.rumdl.toml new file mode 100644 index 0000000..5f59587 --- /dev/null +++ b/.rumdl.toml @@ -0,0 +1,31 @@ +# Markdown linting and formatting; replaces prettier for *.md. + +[global] +flavor = "myst" +# rumdl refuses to format any file with conflict markers, even inside a code +# block, and the rule cannot be disabled. +exclude = ["content/week01_git/advanced_steps.md"] +disable = [ + "MD014", # `$ ` prefixes are required by the `console` lexer + "MD024", # repeated headings are normal across course sections + "MD025", # heading levels are a content decision + "MD026", # headings keep their "!" and ":" + "MD028", # separate blockquotes are intentional + "MD033", # inline HTML is used in some chapters + "MD041", # chapters can start with frontmatter or a directive + "MD045", # some images are decorative + "MD053", # link definitions are shared between chapters + "MD059", # "this page" link text is fine in prose +] + +[per-file-flavor] +"slides/*.md" = "standard" + +[per-file-ignores] +# Marp decks keep one line per paragraph, as prettier's proseWrap = "never" did. +"slides/*.md" = ["MD013"] + +[MD013] +line-length = 80 +reflow = true +code-blocks = false diff --git a/AGENTS.md b/AGENTS.md index 642ad7e..28bcb50 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,13 +47,16 @@ MyST MD course site for _Software Engineering for Scientific Computing_. ## Lint / format / pre-commit - Always use `prek -a --quiet` instead of `pre-commit run -a`. -- Hooks include: ruff-format, blacken-docs, nbstripout, prettier, codespell, - blocklint, plus a **custom `disallow-caps` hook** that rejects +- Hooks include: ruff-format, blacken-docs, nbstripout, rumdl, prettier, + codespell, blocklint, plus a **custom `disallow-caps` hook** that rejects miscapitalizations of names like pybind11, NumPy, CMake, ccache, GitHub, and pytest — always use the canonical spelling (the hook also applies to this file). -- Prettier config (`.prettierrc.toml`): prose wraps at 80 chars by default, - **but never for `slides/*.md`**. +- `rumdl` formats all Markdown; config is `.rumdl.toml`. Prose wraps at 80 + chars, **but `slides/*.md` keep one line per paragraph**. The MyST flavor is + on, so `` ```{directive} `` fences are understood. +- Prettier (`.prettierrc.toml`) now covers only the non-Markdown files: YAML, + JSON, CSS, and JavaScript. ## CI / deploy diff --git a/README.md b/README.md index 0ffe87e..4f29cf9 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ too. Tuesday/Thursday variation (fall 2026 dates): -``` +```text ┌──────────┬──────────────────────────┬─────────────┐ │ Week │ Topic │ Date │ ├──────────┼──────────────────────────┼─────────────┤ diff --git a/content/week00_intro/practices.md b/content/week00_intro/practices.md index cc72c71..87cafcf 100644 --- a/content/week00_intro/practices.md +++ b/content/week00_intro/practices.md @@ -135,7 +135,7 @@ Notice the style: A function's signature should be a contract between the function implementer (you) and the function user (might also be you). Something like this: -``` +```text output1, output2, ... = function(input1, input2, ...) ``` diff --git a/content/week01_git/intro.md b/content/week01_git/intro.md index 69ca18c..8c16fb4 100644 --- a/content/week01_git/intro.md +++ b/content/week01_git/intro.md @@ -107,13 +107,13 @@ Things to keep in mind during our exercise Your git branching sandbox -Open a browser to this URL: https://learngitbranching.js.org/?NODEMO +Open a browser to this URL: Other resources for git: -- https://gitimmersion.com/ -- https://think-like-a-git.net/ -- http://ndpsoftware.com/git-cheatsheet.html -- https://ohshitgit.com/ -- https://gitready.com/ -- https://explainshell.com/ +- +- +- +- +- +- diff --git a/content/week02_agents/agents_md.md b/content/week02_agents/agents_md.md index 9aade3e..eec0d11 100644 --- a/content/week02_agents/agents_md.md +++ b/content/week02_agents/agents_md.md @@ -46,7 +46,12 @@ works on files in that directory. This is useful for a monorepo, where each package has its own conventions. ```{attention} Claude Code -Claude Code does not read this standard file, so you need to either `ln -s AGENTS.md CLAUDE.md` or make a `CLAUDE.md` that has `@AGENTS.md` mentioned in it somewhere. Other {term}`harnesses ` also have custom files too, but they do read AGENTS.md automatically. You can gitignore `CLAUDE.md` or commit the symlink (also `.claude/`, Claude puts local stuff there). +Claude Code does not read this standard file, so you need to either +`ln -s AGENTS.md CLAUDE.md` or make a `CLAUDE.md` that has `@AGENTS.md` +mentioned in it somewhere. Other {term}`harnesses ` also have custom +files too, but they do read AGENTS.md automatically. You can gitignore +`CLAUDE.md` or commit the symlink (also `.claude/`, Claude puts local stuff +there). ``` ## To commit or not to commit diff --git a/content/week02_agents/ci_and_bugfixes.md b/content/week02_agents/ci_and_bugfixes.md index 44f53ea..884d545 100644 --- a/content/week02_agents/ci_and_bugfixes.md +++ b/content/week02_agents/ci_and_bugfixes.md @@ -51,9 +51,10 @@ mean it's correct or the best fix. Great tests and lints become more important with AI; the harder it is to produce an incorrect fix, the better. ```{tip} -Add regression tests first, then fix. High end models and {term}`harnesses ` might do -this for you; you can always request this in your user AGENTS.md or project -AGENTS.md files, see [](./agents_md.md) and [](./writing_tests.md). +Add regression tests first, then fix. High end models and +{term}`harnesses ` might do this for you; you can always request this +in your user AGENTS.md or project AGENTS.md files, see [](./agents_md.md) and +[](./writing_tests.md). ``` ## Exercise diff --git a/content/week02_agents/inspection.md b/content/week02_agents/inspection.md index 16cccb4..b3b9067 100644 --- a/content/week02_agents/inspection.md +++ b/content/week02_agents/inspection.md @@ -30,7 +30,8 @@ history and trace through to find answers. You can ask it to record artifacts instead of just answering. ```{tip} -Harnesses have a way to copy the last response in markdown. Usually `/copy` or a similar shortcut. +Harnesses have a way to copy the last response in markdown. Usually `/copy` or a +similar shortcut. ``` ## Watch it work diff --git a/content/week02_agents/intro.md b/content/week02_agents/intro.md index ba14c97..9bb52a9 100644 --- a/content/week02_agents/intro.md +++ b/content/week02_agents/intro.md @@ -36,7 +36,7 @@ converging on the same repos and even identical features. The OpenClaw repository itself became the most famous victim: it went from about 2 PRs per week in December 2025 to about 3,400 per week by February 2026, and the merge rate fell from roughly 48% to under 10%. One contributor opened 106 PRs in a -single day, with a median gap of _three seconds_ between submissions +single day, with a median gap of *three seconds* between submissions ([Greptile's statistical study](https://www.greptile.com/blog/prs-on-openclaw)). Security maintainers report the same pattern with AI-generated vulnerability reports whose submitters cannot answer follow-up questions @@ -238,8 +238,9 @@ it cannot be traced back to an AI company at all, but most are happy with the Linux kernel trailer. Knowing the model helps when reviewing. ```{tip} Claude Code -Claude Code adds itself as a coauthor by default. You can turn it off in settings, then -you are free to add the Linux style trailer in via `~/.claude/CLAUDE.md` (below). +Claude Code adds itself as a coauthor by default. You can turn it off in +settings, then you are free to add the Linux style trailer in via +`~/.claude/CLAUDE.md` (below). ``` ````{tip} User configuration @@ -261,7 +262,9 @@ Linux kernel trailer or have the AI text below marker somewhere in the description. ```{tip} User configuration -Prefix PR descriptions and comments on PRs with the line ":robot: *AI text below* :robot:" to indicate you are an agent speaking on a user's behalf. +Prefix PR descriptions and comments on PRs with the line ":robot: +*AI text below* :robot:" to indicate you are an agent speaking on a user's +behalf. ``` Follow the golden rule (LLVM/curl): a contribution should be worth more than the diff --git a/content/week02_agents/new_features.md b/content/week02_agents/new_features.md index 70baabe..6bdb27a 100644 --- a/content/week02_agents/new_features.md +++ b/content/week02_agents/new_features.md @@ -117,7 +117,11 @@ alternatives: [cibuildwheel#2946](https://github.com/pypa/cibuildwheel/pull/2946) ```{note} Model choice matters when building features -This is the place to use the best model you have available. You are asking for novel code rather than a mechanical transformation, so you want the highest chance that what comes back is usable. A weak model here produces plausible-looking code that costs you far more time in review than it saved in writing. +This is the place to use the best model you have available. You are asking for +novel code rather than a mechanical transformation, so you want the highest +chance that what comes back is usable. A weak model here produces +plausible-looking code that costs you far more time in review than it saved in +writing. ``` ## Validate beyond your own repo @@ -176,5 +180,7 @@ not merge it from a human contributor, do not merge it from the agent. ## Exercise ```{exercise} -Take a small written spec, plan it out in plan mode, implement it in `agentic-ai-example`, and review the result. Ideas: a scatter plot artist, a log-scale axis, or axis labels/titles. +Take a small written spec, plan it out in plan mode, implement it in +`agentic-ai-example`, and review the result. Ideas: a scatter plot artist, a +log-scale axis, or axis labels/titles. ``` diff --git a/content/week02_agents/profiling.md b/content/week02_agents/profiling.md index e97cde7..79b8f40 100644 --- a/content/week02_agents/profiling.md +++ b/content/week02_agents/profiling.md @@ -124,5 +124,6 @@ measurements into a suite you already have: ## Exercise ```{exercise} -Profile a slow function in `agentic-ai-example`, test two optimization ideas, and report the numbers. +Profile a slow function in `agentic-ai-example`, test two optimization ideas, +and report the numbers. ``` diff --git a/content/week02_agents/reviewing.md b/content/week02_agents/reviewing.md index 299ebd2..8072e0a 100644 --- a/content/week02_agents/reviewing.md +++ b/content/week02_agents/reviewing.md @@ -88,8 +88,7 @@ above. This is called Rubber Duck, and it is built into GitHub Copilot CLI; GitHub reports that Claude Sonnet 4.6 reviewed by GPT-5.4 closed 74.7% of the gap to Claude Opus 4.6 running alone.[^rubber-duck] -[^rubber-duck]: - [GitHub Copilot CLI combines model families for a second opinion](https://github.blog/ai-and-ml/github-copilot/github-copilot-cli-combines-model-families-for-a-second-opinion/), +[^rubber-duck]: [GitHub Copilot CLI combines model families for a second opinion](https://github.blog/ai-and-ml/github-copilot/github-copilot-cli-combines-model-families-for-a-second-opinion/), Nick McKenna and Bartek Perz, 2026-04-06. If you try this with matching models, they will generally just praise the work. diff --git a/content/week02_agents/writing_tests.md b/content/week02_agents/writing_tests.md index 3773d8f..542614f 100644 --- a/content/week02_agents/writing_tests.md +++ b/content/week02_agents/writing_tests.md @@ -76,7 +76,11 @@ This process can occur in two different contexts: in this case, even with small models. ```{note} Model choice matters when writing tests -Writing a good test requires a model that understands the codebase and the requirements. Small models may be able to write simple tests, but often they will not be able to write a meaningful test, in the sense that it checks for the right things. Larger models are also much better at identifying edge cases and weak points, and at writing tests to check them. +Writing a good test requires a model that understands the codebase and the +requirements. Small models may be able to write simple tests, but often they +will not be able to write a meaningful test, in the sense that it checks for the +right things. Larger models are also much better at identifying edge cases and +weak points, and at writing tests to check them. ``` ## Improving the test suite diff --git a/content/week03_testing/pytest.md b/content/week03_testing/pytest.md index a0405cf..060f24b 100644 --- a/content/week03_testing/pytest.md +++ b/content/week03_testing/pytest.md @@ -122,10 +122,11 @@ operations on floating point numbers, and you can customize it via keyword arguments. ```{admonition} Correct calculations -If this bothers you, there are two libraries in the standard library -that help with exact calculations: `decimal.Decimal` and `fraction.Fraction`. These -do exact arithmetic, but are many times slower and bulkier than normal floating point calculations. -99% of the time, you just learn to work around floating point limitations. +If this bothers you, there are two libraries in the standard library that help +with exact calculations: `decimal.Decimal` and `fraction.Fraction`. These do +exact arithmetic, but are many times slower and bulkier than normal floating +point calculations. 99% of the time, you just learn to work around floating +point limitations. ``` ## Fixtures @@ -493,9 +494,12 @@ more running tips. ```{admonition} Further reading and useful links * [Scikit-HEP Developer Pages](https://scikit-hep.org/developer/pytest) -* [Test and Code](https://testandcode.com): a podcast on testing and related topics -* [The Good Research Code Handbook](https://goodresearch.dev): General resource with a strong focus on testing -* [Research Software Engineering with Python](https://merely-useful.tech/py-rse/): Also has a testing section. +* [Test and Code](https://testandcode.com): a podcast on testing and related + topics +* [The Good Research Code Handbook](https://goodresearch.dev): General resource + with a strong focus on testing +* [Research Software Engineering with Python](https://merely-useful.tech/py-rse/): + Also has a testing section. ``` [hypothesis]: https://hypothesis.readthedocs.io diff --git a/content/week03_testing/testing.md b/content/week03_testing/testing.md index e360776..1cc8ad5 100644 --- a/content/week03_testing/testing.md +++ b/content/week03_testing/testing.md @@ -124,7 +124,6 @@ Here's a non-exhaustive list of some types of testing: - Static "testing" (**static checking** is the more common term) will be covered later. With this, you do not need to run the code. Dynamic testing (often just called **testing**) runs your code. - - **Black box**: You can't "see inside" the unit you are testing, and have to just test input/output. - **White box** (really a bright box or clear box, IMO): You can "see inside", diff --git a/content/week04_package/using_packages.md b/content/week04_package/using_packages.md index 6034bcc..e1cce76 100644 --- a/content/week04_package/using_packages.md +++ b/content/week04_package/using_packages.md @@ -183,7 +183,7 @@ packages (often but not always with matching names). All systems have an environment specification, something like this: -``` +```text requests rich >=9.8 ``` @@ -223,7 +223,7 @@ happened to me with `IPython` and `jedi`, by the way). How do you recover a working version without going back to your computer? With a lock file! This would look something like this: -``` +```text requests ==2.25.1 rich ==9.8.0 typing-extensions ==3.7.4 diff --git a/content/week05_ci/docs.md b/content/week05_ci/docs.md index b725640..98315f1 100644 --- a/content/week05_ci/docs.md +++ b/content/week05_ci/docs.md @@ -119,7 +119,7 @@ $ sphinx-quickstart docs You can answer the questions, and it will set up a docs folder. A classic starting docs folder looks like this: -``` +```text - docs - make.bat - Makefile diff --git a/content/week06_compiled/debugging.md b/content/week06_compiled/debugging.md index 3013786..b7d9a92 100644 --- a/content/week06_compiled/debugging.md +++ b/content/week06_compiled/debugging.md @@ -43,6 +43,7 @@ When a code crashes it usually writes out a cryptic error message - log of a number less or equal to zero - Does not always crash your code! (depends on compilation and system settings) + - The code can keep going for a long time with `NaN` or `inf` values - `SIGSEGV`: segmentation violation (see “man 7 signal”) @@ -79,7 +80,7 @@ x[345] = 0.0; // panics at run-time - No space left on disk - `checkquota` will check for memory and inodes overflow -``` +```text $ checkquota Storage/size quota filesystem report for user: rt3504 Filesystem Mount Used Limit MaxLim Comment @@ -237,7 +238,7 @@ All compilers accept the `-g` option. - where - info stack -``` +```text $ apropos debug __after_morecore_hook (3) - malloc debugging variables __free_hook (3) - malloc debugging variables @@ -581,7 +582,7 @@ pdb.set_trace() - Use `help` to see the commands -``` +```text (base) ➜ ~ ./map2deb.py Work/tom/velx_00001.map Reading Work/tom/velx_00001.map > /Users/rt3504/map2deb.py(21)() @@ -605,7 +606,7 @@ exec pdb Let's see another example -``` +```text (base) ➜ ~ ./map2deb.py Work/tom/velx_00001.map Reading Work/tom/velx_00001.map > /Users/rt3504/map2deb.py(21)() @@ -727,7 +728,7 @@ int main() { We can compile this code using the `-g` option but nothing will be detected both at compilation time and at run time. -``` +```text $ g++ -g ml.cpp -o ml $ ./ml ``` @@ -736,7 +737,7 @@ Using the `top` command at several times, one can see the virtual memory (`VIRT` below) slowly increasing from slightly less than 0.,5GB to more than 14GB and counting. With more than 200 loops, the code would have crashed. -``` +```text $ top -n 1 | grep -B1 ml PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3092916 rt3504 20 0 4316088 81436 2232 R 94.4 0.0 0:02.29 ml @@ -847,7 +848,7 @@ The `ddt` debugger is a good option for C/C++. See web page Just type: -``` +```text $ ddt a.out ``` diff --git a/content/week06_compiled/rust_example/compiled.md b/content/week06_compiled/rust_example/compiled.md index 9a9e61f..4a9303d 100644 --- a/content/week06_compiled/rust_example/compiled.md +++ b/content/week06_compiled/rust_example/compiled.md @@ -260,7 +260,7 @@ warning: `foo` (bin "foo" test) generated 1 warning (run `cargo clippy --fix --b ``` > Note: you might not have `cargo-clippy` if you installed Rust minimally. See -> https://doc.rust-lang.org/stable/clippy/installation.html for info if so. +> for info if so. This will run the checker (clippy) on all targets (including the test target). However, not much is enabled by default. Add the following to your `Cargo.toml`: diff --git a/content/week07_parallel/concepts.md b/content/week07_parallel/concepts.md index 46b483e..e10d3ee 100644 --- a/content/week07_parallel/concepts.md +++ b/content/week07_parallel/concepts.md @@ -125,7 +125,9 @@ these exist for `put` as well. And, like locks, you can end up with deadlocks if you are not careful. ```{admonition} Error checking -This example will swallow errors if you play with it and make a mistake. To fix that, you need to save the returned values from the `.submit(...)`'s, and then call `.result()` on them; that will reraise the exception in the current thread. +This example will swallow errors if you play with it and make a mistake. To fix +that, you need to save the returned values from the `.submit(...)`'s, and then +call `.result()` on them; that will reraise the exception in the current thread. ``` ## Barrier diff --git a/content/week07_parallel/threading.md b/content/week07_parallel/threading.md index 6b0c3e6..324c6f1 100644 --- a/content/week07_parallel/threading.md +++ b/content/week07_parallel/threading.md @@ -137,7 +137,7 @@ fractal = run(c, fractal) For me, I see: -``` +```text Took 2.677322351024486s to run ``` diff --git a/content/week09_binding/06-rust.md b/content/week09_binding/06-rust.md index db495ce..0949c9a 100644 --- a/content/week09_binding/06-rust.md +++ b/content/week09_binding/06-rust.md @@ -24,7 +24,7 @@ parts). Check the flags with `--help/-h`. Now, you should have a project like this: -``` +```text rust_example ├── Cargo.toml ├── pyproject.toml diff --git a/content/week10_oop/oodesign.md b/content/week10_oop/oodesign.md index 2ca8f27..960a0fe 100644 --- a/content/week10_oop/oodesign.md +++ b/content/week10_oop/oodesign.md @@ -68,10 +68,10 @@ Let's define some terminology we've been seeing, along with a bit of new stuff: - Associate functions to a specific type (varies by language) ```{admonition} Interfaces -Python refers to an Interface (Java terminology, technically) as a Protocol. C++20 -calls it a Concept. The basic idea is simply that a set of methods/members are -required in order for a class to be used, without requiring formal inheritance. -We'll save this until we look at static typing, however. +Python refers to an Interface (Java terminology, technically) as a Protocol. +C++20 calls it a Concept. The basic idea is simply that a set of methods/members +are required in order for a class to be used, without requiring formal +inheritance. We'll save this until we look at static typing, however. We also will refer to "interface" meaning the interaction with your API by consumers (possibly also you). diff --git a/content/week11_design/designpatt.md b/content/week11_design/designpatt.md index 73a903a..cd96e29 100644 --- a/content/week11_design/designpatt.md +++ b/content/week11_design/designpatt.md @@ -65,7 +65,8 @@ Now we can call this with ints or floats, but nothing else. It dispatches different versions depending on the types it sees. ```{admonition} Python specific tips -* Only the first argument will be used for the dispatch. Other arguments are ignored. +* Only the first argument will be used for the dispatch. Other arguments are + ignored. * You can use type annotations instead * You can stack multiple registers * Or use Unions (Python 3.11+) @@ -97,8 +98,8 @@ value of this function is not an int, it's an iterable object. Expressions like value. ````{admonition} Empty generator -The presence of a `yield` anywhere in a function causes a function to be a generator. So -this is actually an empty generator: +The presence of a `yield` anywhere in a function causes a function to be a +generator. So this is actually an empty generator: ```python def empty(): @@ -526,8 +527,8 @@ you might see it happen before you can make it to the collect call. ```{admonition} Garbage collector vs. refcount CPython will automatically delete anything that has a refcount that drops to 0 when that happens. The garbage collector is there to detect reference cycles and -also delete those. You can disable the garbage collector with `gc.disable()`, and -you will only lose reference cycle deletion. +also delete those. You can disable the garbage collector with `gc.disable()`, +and you will only lose reference cycle deletion. If you ask `sys.getrefcount(...)` for the refcount of an object, it will start at 2; the use of it as a parameter increases it by one during the `getrefcount` diff --git a/content/week11_design/functional.md b/content/week11_design/functional.md index 93602e1..c401585 100644 --- a/content/week11_design/functional.md +++ b/content/week11_design/functional.md @@ -478,8 +478,9 @@ library that takes advantage of these things. ```{admonition} No JAX in our environment -We will not be including or running JAX since it is quite large and would slow down setting up an environment. All -examples will be pre-computed, and we'll not be using it in homework. +We will not be including or running JAX since it is quite large and would slow +down setting up an environment. All examples will be pre-computed, and we'll not +be using it in homework. ``` A library that makes use of this is JAX. JAX is a ML inspired library that is a @@ -545,6 +546,6 @@ is a great GPU NumPy replacement. Etc. JAX here is just intended to be an example of what thinking in a functional mindset can do. ``` -``` +```text ``` diff --git a/content/week12_typing/typing.md b/content/week12_typing/typing.md index 6bcefe2..76fc18f 100644 --- a/content/week12_typing/typing.md +++ b/content/week12_typing/typing.md @@ -234,10 +234,10 @@ bypass checking, especially if your code is not fully typed yet. The reason In a compiled language, you have to make the types work. But since they are optional in Python and only checked by an optional step, you can simply disable them on a line or a file if you need to. In fact, you can even lie about types. -You can claim something only takes a subset of the types it really could support, you -can exclude an object type that only exists for backward compatibility or is -deprecated, etc - all things you could not do in a compiled language. In -general, you should be more strict with typing than with runtime. +You can claim something only takes a subset of the types it really could +support, you can exclude an object type that only exists for backward +compatibility or is deprecated, etc - all things you could not do in a compiled +language. In general, you should be more strict with typing than with runtime. ``` ## Typing basics @@ -760,8 +760,8 @@ will immediately notify you if you add an item to Direction but forget to update the usage! ````{admonition} Historical note -The implementation of `NoReturn`, the type for a function that never makes it to a -return statement, is also an empty union, so in the past this was how we could +The implementation of `NoReturn`, the type for a function that never makes it to +a return statement, is also an empty union, so in the past this was how we could implement this feature: ```python @@ -1131,7 +1131,8 @@ Results may vary, and it's not as fast as normal compiled code, but it could be very useful and basically free once you are statically typed. ```{admonition} Useful links -* [Awesome Python Typing](https://github.com/typeddjango/awesome-python-typing): A curated list of links to Python typing related things +* [Awesome Python Typing](https://github.com/typeddjango/awesome-python-typing): + A curated list of links to Python typing related things * [Adam Johnson's Typing series](https://adamj.eu/tech/tag/mypy/) * [MyPy's cheat sheet](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html) ``` diff --git a/notes/week3b.md b/notes/week3b.md index 74903a3..314d049 100644 --- a/notes/week3b.md +++ b/notes/week3b.md @@ -15,16 +15,19 @@ Design patterns in OOP - See class notes for some definitions, read on your own - didn't really cover in class except inline as we went. + - Why design classes? - Modular - not going to give this one up! - Can make an API easy to use correctly - hard to use incorrectly - Keep values & data together & organized (there's a ~256 or so parameter limit in C! I met someone who discovered that first hand.) - DRY code + - Two patterns for making classes - Inheritance - "is a" & code reuse - spaghetti code warning! - Composition - "has a" & restrict interface (you can't delete attributes with ) - verbose! + - UML diagrams - Can show classes, interface, relationships - Several links to read more if interested diff --git a/notes/week6a.md b/notes/week6a.md index a2d9cab..e649765 100644 --- a/notes/week6a.md +++ b/notes/week6a.md @@ -2,7 +2,7 @@ Structural subtyping - Protocols (Interfaces in Java, Concepts in C++20) - Formalized duck typing -- Example: PlottableHistogram from https://uhi.readthedocs.io +- Example: PlottableHistogram from - Boost-histogram/hist & uproot can produce histograms, but can't depend on each other - Histoprint & mplhep can visualize histograms, but don't want to be dependent diff --git a/notes/week7b.md b/notes/week7b.md index a0c1efe..01b3322 100644 --- a/notes/week7b.md +++ b/notes/week7b.md @@ -15,7 +15,8 @@ Packaging - Minimal setup to build a package - Building an sdist/wheel - Installing -- Read more at https://packaging.python.org or https://scikit-hep.org/developer +- Read more at or + Pre-commit (static checks) diff --git a/slides/week-12-1.md b/slides/week-12-1.md index 148837b..ddd0fdf 100644 --- a/slides/week-12-1.md +++ b/slides/week-12-1.md @@ -174,7 +174,7 @@ What will this output? A function should be of the form -``` +```text name(input, ...) -> output ``` diff --git a/slides/week-12-2.md b/slides/week-12-2.md index 8a23315..f34816c 100644 --- a/slides/week-12-2.md +++ b/slides/week-12-2.md @@ -526,7 +526,7 @@ def f(x: T) -> T: TL;DR: Do whatever the type checker tells you -``` +```text A -> B -> C ```