Skip to content

licenses

The license texts of a model, e.g. for its COMBINE archive.

A model is published under two licenses: the models and the documentation under CC BY-SA 4.0, the source code under MIT. The texts are resources of the package; the text of CC BY-SA 4.0 is the same for every model, the text of MIT starts with the copyright of the model, e.g. Copyright (c) 2024-2025 Matthias König, which is the only part in which the MIT texts of two models differ. The texts are byte for byte the license files of the models of pkdb_models, src/sbmlsim/resources/licenses/, whose line endings git never converts (.gitattributes).

write_license writes a text as cc-by-sa-4.0.txt or mit.txt into a directory, from where the factory of a model adds it to the COMBINE archive.

License

Bases: StrEnum

A license of a model, its value is the name of its file without .txt.

CC_BY_SA_4_0 class-attribute instance-attribute

CC_BY_SA_4_0 = 'cc-by-sa-4.0'

Creative Commons Attribution-ShareAlike 4.0 International, the models and the documentation.

MIT class-attribute instance-attribute

MIT = 'mit'

The MIT license, the source code; its text starts with the copyright.

filename property

filename

The name of the file of the license text, e.g. mit.txt.

license_text

license_text(license, copyright=None)

Get the text of a license.

Parameters:

Name Type Description Default
license License | str

the license, or its value ("mit").

required
copyright str | None

the year or years and the holders of the copyright, e.g. 2024-2025 Matthias König, which make the first line of the MIT text Copyright (c) 2024-2025 Matthias König. Required for MIT, not allowed for CC BY-SA 4.0, whose text has no copyright line.

None

Returns:

Type Description
str

The text of the license, every line ends with a line feed.

Raises:

Type Description
ValueError

for a missing or a superfluous copyright, or a copyright which is empty, spans several lines or starts with Copyright itself.

write_license

write_license(directory, license, copyright=None)

Write the text of a license into a directory.

The file is named after the license (cc-by-sa-4.0.txt, mit.txt) and is written in UTF-8 with line feeds as line endings on every platform, so it is the same file byte for byte wherever a model is created; an existing file is replaced.

Parameters:

Name Type Description Default
directory Path

the directory of the file, which has to exist, e.g. the folder whose files the factory of a model packs into its COMBINE archive.

required
license License | str

the license, or its value ("mit").

required
copyright str | None

the year or years and the holders of the copyright, required for MIT, see license_text.

None

Returns:

Type Description
Path

The path of the written file.