release.project¶
The project files of a release repository, written from templates.
The files which are the same in structure for every model (pyproject.toml,
Dockerfile, the workflows, .zenodo.json) are rendered from the templates in
sbmlsim/resources/release with the settings of the model and the
dependencies of the source project. The templates of the release hook of the
project (sbmlsim.release.hooks.ReleaseHook.templates) are searched first, so
a framework replaces a template or adds one.
UV_VERSION
module-attribute
¶
The uv of a release repository: its Docker image and its workflows.
The latest uv when it was set; at least 0.13.4, the first uv whose bundled CA store lacks the emSign roots (GHSA-hq85-5cpj-mr62).
ProjectContext
dataclass
¶
ProjectContext(
project,
reference,
settings,
version,
python,
pythons,
dependencies,
constraints,
framework_path,
year,
requires_python,
hook=ReleaseHook(),
source_commit=None,
built_steps=None,
)
The values the templates of the project files are rendered with.
Attributes:
| Name | Type | Description |
|---|---|---|
project |
Project
|
the project which is released. |
reference |
str
|
the project as |
settings |
ReleaseSettings
|
the release settings of the project. |
version |
str
|
the version of the release. |
python |
str
|
the Python version of the source, e.g. |
pythons |
tuple[str, ...]
|
the Python versions the release supports, those of the
classifiers of the source, e.g. |
dependencies |
tuple[str, ...]
|
the dependencies of the source project. |
constraints |
tuple[str, ...]
|
|
framework_path |
Path | None
|
local checkout of the framework to use instead of the
registry ( |
year |
int
|
the year of the release. |
requires_python |
str
|
the |
hook |
ReleaseHook
|
the release hook of the project. |
source_commit |
str | None
|
the commit of the source repository. |
built_steps |
tuple[BuildStep, ...] | None
|
the steps the build ran, |
package
property
¶
The dotted name of the model package.
Raises:
| Type | Description |
|---|---|
ReleaseError
|
for a project without a package. |
steps
cached
property
¶
The steps of the build: the ones it ran, built_steps.
Before the build the steps of the source package, see
sbmlsim.release.build.build_steps; computed once per context, the
check of the distributions of the default variant reads its SBML.
project_context
¶
Read the dependencies of the source project into a project context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
the project which is released. |
required |
reference
|
str
|
the project as |
required |
settings
|
ReleaseSettings
|
the release settings of the project. |
required |
source
|
SourceRepo
|
the source repository with |
required |
version
|
str
|
the version of the release. |
required |
framework_path
|
Path | None
|
local checkout of the framework, which then replaces the registry package in the release project. |
None
|
Returns:
| Type | Description |
|---|---|
ProjectContext
|
The context of the templates. |
Raises:
| Type | Description |
|---|---|
ReleaseError
|
if the source lacks |
environment
¶
Get the environment of the templates of a release.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hook
|
ReleaseHook | None
|
the release hook, whose templates are searched before the ones
of sbmlsim ( |
None
|
Returns:
| Type | Description |
|---|---|
Environment
|
The environment with the filters |
render
¶
Render a template of a release.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the path of the template below the directories of the templates,
see |
required |
context
|
ProjectContext
|
the values of the template, available by field name. |
required |
extra
|
Mapping[str, Any] | None
|
further values of the template, e.g. the changes of the release notes. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered text. |
Raises:
| Type | Description |
|---|---|
UndefinedError
|
if the template uses a value the context lacks. |
zenodo_json
¶
Get the metadata of the Zenodo record of the release.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProjectContext
|
the project context. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The content of |
write_project_files
¶
Write the project files into the release repository.
Workflows in .github/workflows which are not written are removed. A
repository without README.md gets one with the title of the model, the
readme of pyproject.toml which the build installs; the docs stage
replaces it, and writes the configuration of the site with its pages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProjectContext
|
the project context. |
required |
release_path
|
Path
|
the folder of the release repository. |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
The written files. |