Skip to main content

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

NameTypeRequired
Description
userstr | NoneThe user name of the repository owner. It needs to be the GitHub user name.
package_namestr | NoneThe name of the package rendered as the documentation. If not specified, will infer the name automatically.
sidebarlist[str | dict[str, Any]] | NoneThe rendered sidebar data of the API documentation. If not specified, will infer this sidebar structure automatically.
source_urisdict[str, dict[str, str]] | NoneThe list of source URIs. It is used for providing the links to the source codes. If not specified, will infer these URIs automatically.
source_versionsdict[str, str] | NoneA 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

NameType
Description
v_1dict[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

NameTypeRequired
Description
pkgModuleTypeThe package providing the name.

Returns

NameType
Description
v_1SelfThis data model.

set_sidebar

v_1: Self = self.set_sidebar(pkg_renderer: PackageRenderer)

Set the sidebar if it is not specified.

Requires

NameTypeRequired
Description
pkg_rendererPackageRendererThe package renderer providing the sidebar.

Returns

NameType
Description
v_1SelfThis 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

NameTypeRequired
Description
pkg_rendererPackageRendererThe package renderer providing the uris.
versionstr | NoneThe version text provided by the package.

Returns

NameType
Description
v_1SelfThis 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

NameTypeRequired
Description
versionsMapping[str, str] | NoneThe version mapping from version names to the version identifiers. If not specified, will use the keys of source_uris to infer this value.

Returns

NameType
Description
v_1SelfThis data model.