Modules
Define and parse package manifests.
Manifest
¶
Bases: BaseModel
Represent the metadata and file lists defined by a package manifest.
Source code in src/mkp_forge/manifest.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
id
property
¶
Return the package identifier for this manifest.
Returns:
| Name | Type | Description |
|---|---|---|
PackageID |
PackageID
|
The canonical package identifier composed from the package name and version. |
file_content()
¶
Return the manifest as a pretty-printed Python dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The manifest content rendered with alias names and file paths as strings in a human-readable Python literal format. |
Source code in src/mkp_forge/manifest.py
73 74 75 76 77 78 79 80 81 82 83 84 | |
json_file_content()
¶
Return the manifest serialized as JSON using alias field names.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The manifest content as a JSON string. |
Source code in src/mkp_forge/manifest.py
86 87 88 89 90 91 92 | |
parse_python_string(raw)
classmethod
¶
Parse a manifest definition from a Python literal string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw
|
str
|
A Python dictionary literal describing the manifest. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A validated Manifest instance created from the parsed data. |
Source code in src/mkp_forge/manifest.py
94 95 96 97 98 99 100 101 102 103 104 | |
PackagePart
¶
Bases: StrEnum
A category of files included in a package manifest.
Source code in src/mkp_forge/manifest.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
ident
property
¶
Return the manifest identifier string for this package part.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The canonical string value used in manifest files. |
read_manifest(manifest_path)
¶
Load and validate a package manifest from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
Path
|
Path to the manifest file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Manifest |
Manifest
|
The validated manifest parsed from the file contents. |
Source code in src/mkp_forge/manifest.py
117 118 119 120 121 122 123 124 125 126 | |
Create and write MKP package archives.
create_mkp(manifest, project_path)
¶
Combines project_path with manifest to create mkp byte
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
Manifest
|
Manifest from plugin info file. |
required |
project_path
|
Path
|
Project path of Plugin Project. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
description |
Source code in src/mkp_forge/packaging.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
create_tar(name, loc, filenames)
¶
Creates a list of Bytes which represent the content of filenames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of tar file |
required |
loc
|
Path
|
location of file in project dir |
required |
filenames
|
Iterable[Path]
|
names of files from manifest |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, bytes]
|
tuple[str, bytes]: group of bytes per filename |
Source code in src/mkp_forge/packaging.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
create_tar_info(filename, size)
¶
Creates tar GNU file information
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
filename of tarinfo |
required |
size
|
int
|
Size of the filename |
required |
Returns:
| Type | Description |
|---|---|
TarInfo
|
tarfile.TarInfo: minimalized tar info for tar packaging. |
Source code in src/mkp_forge/packaging.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
create_tgz(files)
¶
Creates tar.gz bytes based on given files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
Iterable[tuple[str, bytes]]
|
files which will be included into tar.gz |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
tar.gz bytes object. |
Source code in src/mkp_forge/packaging.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
write_mkp(manifest, mkp_bytes)
¶
Writes given mkp_bytes to mkp files based on manifest information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
Manifest
|
Manifest from plugin info file. |
required |
mkp_bytes
|
bytes
|
mkp bytes created from manifest. |
required |
Source code in src/mkp_forge/packaging.py
15 16 17 18 19 20 21 22 23 24 | |