Skip to content

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

UV_VERSION = '0.13.6'

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 module:attribute, which the specs of the build and the commands of the release repository name.

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. "3.14": the Python of the Docker image and of the docs.

pythons tuple[str, ...]

the Python versions the release supports, those of the classifiers of the source, e.g. ("3.14", "3.15"): the tests of the release repository run on every one.

dependencies tuple[str, ...]

the dependencies of the source project.

constraints tuple[str, ...]

name==version for every registry package of the source lock.

framework_path Path | None

local checkout of the framework to use instead of the registry (ReleaseSettings.framework).

year int

the year of the release.

requires_python str

the requires-python of the source project.

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, None before the build.

repo_name property

repo_name

The name of the release repository.

package property

package

The dotted name of the model package.

Raises:

Type Description
ReleaseError

for a project without a package.

top_package property

top_package

The first component of the model package, the folder below src.

copyright_years property

copyright_years

The years of the copyright, 2026 or 2024-2026.

steps cached property

steps

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

project_context(
    project,
    reference,
    settings,
    source,
    version,
    framework_path=None,
)

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 module:attribute.

required
settings ReleaseSettings

the release settings of the project.

required
source SourceRepo

the source repository with pyproject.toml and uv.lock.

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 pyproject.toml, its requires-python or uv.lock, or its Python version is unknown, or the release hook of the project is not resolved.

environment

environment(hook=None)

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 (TEMPLATES).

None

Returns:

Type Description
Environment

The environment with the filters toml, query and cell.

render

render(name, context, extra=None)

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 environment.

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

zenodo_json(context)

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 .zenodo.json.

write_project_files

write_project_files(context, release_path)

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.