Contributing
Contributions are welcome as issues and pull requests on GitHub. The package follows ColPrac and is formatted with Runic.
Workflow
Open or find an issue that describes the change.
Work on a branch, never on
main.Write a failing test first, commit it, then make it pass and commit again.
Run the checks below before opening a pull request.
Checks
Common tasks run through the Taskfile.
| Task | What it runs |
|---|---|
task test-fast | the unit and use-case tests, without the quality gates |
task test-quality | Aqua, formatting, linting and doctests |
task test-ad | gradient tests on every AD backend |
task format | Runic over the source, tests and docs |
task docs-fast | the documentation, with heavy tutorials stubbed |
task precommit | the pre-commit hooks |
On a shared machine, run one Julia process at a time.
Use-case tests
A new operator, modifier or coupling adds a use case when it replaces code in a modelling package. Run the use-case tests with julia --project=test test/runtests.jl usecase_only.
Documentation
Pages, tutorials and docstrings follow the style sheet. Docstrings describe the maths and name no other package. Tutorials are Literate scripts under docs/src/getting-started/tutorials/, registered in docs/docs_config.jl. A heavy tutorial runs on its own with julia --project=docs docs/run_literate_tutorial.jl <tutorial.jl> <outdir>. Navigation is generated into docs/pages.jl, which is not edited by hand.
Style
The standards tests check the banned words, one sentence per line, sentence length and code line length. The rest of the style sheet is for review.
The reference page is docs/src/explanation/operators.md.
Language
Write in UK English, one sentence per line, at most 35 words; most sentences have 10 to 25.
Write plain expository prose: each sentence says one thing and follows from the last. Join short sentences about one thing with "and", "so" or "because". Do not write lists of fragments.
Start with the content: no "This page lists", "This page covers" or "This tutorial gets", and no closing questions such as
Want X? See Y.Say each thing once per page; a summary points back and does not restate.
State what is true now: no "was timed", "used to" or issue numbers. Measurement conditions go in table columns or one sentence.
Use few adjectives, and none of the banned words.
Define a term in a sentence at its first use on a page, or link its home. Do not use private words, such as mirror, twin, whole-step or local step, as if they were known.
Format
Write headings in sentence case, with no colons:
#for the title,##for sections and###for a sub-step only.A tutorial has an introduction of two or three sentences on what it models, then Packages used, one
##per model, Performance, References if cited, and Learning more. Performance is one sentence naming the model timed.A model section has a motivation sentence, display maths, a "where" sentence, a "Here" sentence with values, code, a plot and result sentences with numbers. The "where" sentence reads "where X is ..., Y the ... and Z the ...", with at most 3 symbols per sentence and never a run of "X is ...".
List items are full sentences ending in a full stop. Learning more items read
- [Page](@ref id): what it adds.Link the first mention of a public name on each page as
; later mentions are bare backticks. Code lines are at most 80 characters in pages, tutorials and docstrings.
Table cells hold at most about 15 words; long code goes below the table.
An extension page starts
Loading A with ComposableRecurrences loads XExt.and then says what it adds. Its title is the nav label followed by " extension".A docstring has a summary sentence, maths with a "where" sentence, the arguments not obvious from the signature, one doctest and a link to the page that teaches the concept. The summary of a type is a noun phrase, and that of a function is imperative. It has no manual signature line.
Glossary
Each term has one meaning.
stratum, strata: series run side by side, such as towns or patches.
kernel: weights on lags.
movement matrix: strata × strata weights.
gain (
): multiplies the coupled sum, such as for a renewal. add (
): the input added after the gain. pressure: the coupled weighted sum, not
force.value before the modifiers (
): "new infections before depletion" in infection models, not renewal value.pool: what a
Depletioncarries, notcompartmentorstock.depletion form:
Hazard,Floor,TruncateorShare, notvariant.part: a draw or flow of a
Depletiononly.component: a coupling, modifier or form.
rule: the package's reverse pass.
plain AD: the backend differentiating the forward code; spell out "automatic differentiation (AD)" once per page.
history: values before
start.seed: a history built to start an outbreak.
innovations (
): not noise.
Symbols
is time from 1, a lag and a length. and are the receiving and giving stratum, and the input or cohort time. is a kernel, a generation interval and a delay. is a coupling, the susceptible pool and a population. is a reporting share and the imports. is a count of strata only in array shapes, as in .
Maths before code
A section that introduces a model, a modifier, a coupling or a transformation gives the equation first. It names every symbol, then shows the code. Take the equation from the docstring of the part the code uses, so the two stay the same. A section that reuses a model defined above on the same page links to it instead. The standards tests check the first use of each built-in operator in the tutorials listed in test/package/standards_config.jl.