From 0a9b581fb76ca12322406350b7feccc779a75c18 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Mon, 22 Dec 2025 11:59:05 +0100 Subject: [PATCH] vault backup: 2025-12-22 11:59:05 --- AGENT.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 AGENT.md diff --git a/AGENT.md b/AGENT.md new file mode 100644 index 0000000..d85ef20 --- /dev/null +++ b/AGENT.md @@ -0,0 +1,34 @@ +# Markdown +Use Obsidian-flavored Markdown. +Use fenced code blocks for code snippets, indicating the language when appropriate. +Avoid extra new lines, prefer fewer new lines and compact formatting. + +# Coding +The rest of this document describes coding conventions to follow when writing code. +## General +- Do not create comments nor docstrings when updating code unless asked. +- Do not create a summary .md file unless asked. +- Do not create a README.md file unless asked. +- When installing a new dependency, prefer to use the latest version. + +## Python +- Avoid exceptions if possible +- When exceptions are necessary, use specific exception types, provide meaningful messages, and handle them appropriately. +- Exceptions try/except blocks should be as narrow as possible, try extra hard to avoid catching exceptions you did not intend to catch. +- Use type hints for all functions and methods. + +## Python unit testing: +- Use pytest framework, version 9 or higher. +- Prefer parametrized tests for functions that need to be tested with multiple sets of inputs and expected outputs. +- Use the new `with pytest.test(...)ยด for that purpose: + +```python +import pytest +def test_parametrized(subtests: pytest.Subtests) -> None: + # ... setup code ... + parameters = [...] + for ... in parameters: + with subtests.test(x=...): + assert ... + # ... tear down ... +```