PackageInformation
ClassDataClassSource
PackageInformation(
user: str | None = None,
package_name: str | None = None,
sidebar: list[str | dict[str, Any]] | None = None,
source_uris: dict[str, dict[str, str]] | None = None,
source_versions: dict[str, str] | None = None
)
The basic information of a package. All fields are optional and can be inferred from the solved results.
Fields
| Name | Type | Required | |
|---|---|---|---|
user | str | None | The user name of the repository owner. It needs to be the GitHub user name. | |
package_name | str | None | The name of the package rendered as the documentation. If not specified, will infer the name automatically. | |
sidebar | list[str | dict[str, Any]] | None | The rendered sidebar data of the API documentation. If not specified, will infer this sidebar structure automatically. | |
source_uris | dict[str, dict[str, str]] | None | The list of source URIs. It is used for providing the links to the source codes. If not specified, will infer these URIs automatically. | |
source_versions | dict[str, str] | None | A mapping from the version names to the version identifiers. The version names are used as the keys of source_uris, and the version identifiers are used for locating the version links. If not spcified, will infer this mapping from the source_uris. |
Methods
as_vardict
v_1: dict[str, Any] = self.as_vardict()
Dump the information as a variable dictionary.
Returns
| Name | Type | |
|---|---|---|
v_1 | dict[str, Any] | The variable dictionary to be used in resource rendering. |
set_pkg_info
v_1: Self = self.set_pkg_info(pkg: ModuleType)
Set the package_name if it is not specified.
Requires
| Name | Type | Required | |
|---|---|---|---|
pkg | ModuleType | The package providing the name. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Self | This data model. |
set_sidebar
v_1: Self = self.set_sidebar(pkg_renderer: PackageRenderer)
Set the sidebar if it is not specified.
Requires
| Name | Type | Required | |
|---|---|---|---|
pkg_renderer | PackageRenderer | The package renderer providing the sidebar. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Self | This data model. |
set_source_uris
v_1: Self = self.set_source_uris(pkg_renderer: PackageRenderer, version: str | None = None)
Set the source_uris if it is not specified.
Requires
| Name | Type | Required | |
|---|---|---|---|
pkg_renderer | PackageRenderer | The package renderer providing the uris. | |
version | str | None | The version text provided by the package. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Self | This data model. |
set_source_versions
v_1: Self = self.set_source_versions(versions: Mapping[str, str] | None = None)
Set the source_versions if it is not specified.
Requires
| Name | Type | Required | |
|---|---|---|---|
versions | Mapping[str, str] | None | The version mapping from version names to the version identifiers. If not specified, will use the keys of source_uris to infer this value. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Self | This data model. |