Manifest¶
Declare the version of the format that a document uses.
Manifest¶
-
class creator_studio_doc_format.core.Manifest(package_version=
None)[source]¶ The package manifest, which records the version of the package format.
Saving writes the package format version this library supports, whatever
package_versionholds, so the attribute reports the version that was read, and a round trip doesn’t preserve it.- Parameters:
- package_version : str | None¶
The package format version, in
major.minorform.
- Raises:
ValueError–package_versionhas a newer major version than this library supports.
- classmethod parse(data)[source]¶
Creates a manifest from the decoded contents of a manifest file.
parsereads apackage_versionwritten as a JSON number, such as1.0, or as a{"major": ..., "minor": ...}object as the"major.minor"string it spells, and checks it the same way.- Parameters:
- data : object¶
The decoded
manifest.jsonvalue, which can beNoneor malformed.
- Returns:
The parsed manifest, or a default one when
datais missing, is malformed, or has nopackage_version.- Return type:
- Raises:
DocumentVersionError– thepackage_versionindatahas a newer major version than this library supports.
Version¶
-
class creator_studio_doc_format.core.Version(major, minor=
0)[source]¶ A version number in major.minor form, as the file writes it.
The value is either an object’s
versionor the manifest’spackage_version.parseaccepts a"major.minor"or"major"string, a{"major": ..., "minor": ...}mapping, whereminoris optional, or aVersion. A missing minor reads as 0, andparseignores leading zeros.- Parameters: