release.hooks¶
What a framework adds to the release of a model package.
The release of sbmlsim builds a release repository of every project: the
models, the simulations, the reports of the adopted fits and the assessment of
the credibility, the release notes and the pages of the site. A framework on
top of sbmlsim, e.g. one of pharmacokinetic models, adds the content of its
domain through a ReleaseHook, which ReleaseSettings.hook names
(sbmlsim.project.Project.release_hook):
templates: directories of templates which are searched before the ones of sbmlsim (sbmlsim/resources/release): a template of the same path replaces the one of sbmlsim, another one adds to them, e.g. a page of the site or a part which a template of sbmlsim includes when it exists. The page of the credibility includes, in the section of every context of use (contextthe context),docs/credibility-acceptance.md.j2right after its acceptance table (e.g. the tables of the rules of an extension),docs/credibility-uncertainty.md.j2between its parameter uncertainty and its variability (e.g. the inputs of the simulations) anddocs/credibility-context.md.j2at its end, anddocs/credibility-sections.md.j2after its sections of the core, seeCREDIBILITY_PARTS.pages: pages of the site of its own,docs/<page>.md.j2of its templates, with their titles in the navigation, before the release notes.values: further values of the pages of the site and of the README.credibility: the data of the page of the credibility, e.g. the evidence of the evidence extensions of the framework, seesbmlsim.credibility.extensions.data_study: the study a file of the data of the package belongs to, which the release notes list as added, removed or changed.notes_sections: sections of markdown at the end of the release notes.
Every method has a default, so a hook overrides only what it adds. The module imports nothing of the release at runtime.
ReleaseHook
¶
What a framework adds to the release of a model package, see the module.
The base class adds nothing; a framework derives from it and overrides what it adds.
templates
¶
Get the directories of the templates of the hook.
Returns:
| Type | Description |
|---|---|
Sequence[Path | Traversable]
|
The directories, searched in their order before the templates of |
Sequence[Path | Traversable]
|
sbmlsim; e.g. `importlib.resources.files("framework") / |
Sequence[Path | Traversable]
|
"resources/release"`. |
pages
¶
Get the pages the hook adds to the site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProjectContext
|
the project context of the release. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[tuple[str, str]]
|
The pages as |
Sequence[tuple[str, str]]
|
|
Sequence[tuple[str, str]]
|
the release notes in the navigation. |
values
¶
Get further values of the templates of the site and of the README.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProjectContext
|
the project context of the release. |
required |
release_path
|
Path
|
the built release repository. |
required |
Returns:
| Type | Description |
|---|---|
Mapping[str, Any]
|
The values by their name; a value of the release of the same name |
Mapping[str, Any]
|
is replaced. |
credibility
¶
Get the data of the page of the credibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
assessment
|
CredibilityAssessment
|
the assessment of the contexts of use of the release. |
required |
data
|
dict[str, Any]
|
the data of the page as sbmlsim shows it, see
|
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The data of the page, e.g. |
dict[str, Any]
|
extensions of the framework. |
data_study
¶
Get the study which a file of the data of the package belongs to.
The release notes key the files by their path in the release repository, so files of two data folders belong to one study only if this method gives them one name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dir
|
PurePosixPath
|
the data folder of the file relative to the root of the
package, one of the data paths of the project
( |
required |
path
|
PurePosixPath
|
the path of the file relative to |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The study, by default the folder of the file relative to the root |
str | None
|
of the package, e.g. |
str | None
|
belongs to no study, by default a file at the top of the data |
str | None
|
folder. |
notes_sections
¶
Get the sections of the release notes the hook adds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProjectContext
|
the project context of the release. |
required |
release
|
ReleaseRepo
|
the release repository with the new build in its working
tree and the previous release as |
required |
runner
|
Runner
|
runs git. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[str]
|
The sections as markdown, each starting with its heading of the |
Sequence[str]
|
second level, at the end of the release notes. |