Skip to content

Volumes#

bookshelf.Volume #

Bases: Describable

A volume indexed by version, resolving each into a published Book.

name instance-attribute #

name: str = name

The volume's name.

title property #

title: str | None

The human-readable title, when the volume states one.

description property #

description: str | None

A concise summary of the volume, when it states one.

license property #

license: str | None

The SPDX identifier of the licence the volume is published under.

discovery property #

discovery: dict[str, Any]

The volume's whole discovery profile, as JSON-compatible values.

metadata property #

metadata: dict[str, Any]

The free-form metadata the volume carries.

versions property #

versions: tuple[str, ...]

Every version this volume has published, oldest first.

latest property #

latest: str | None

The newest published version, or None for a volume that has published nothing.

editions #

editions(version: str) -> tuple[int, ...]

The published editions of one version, oldest first.

A version the volume has not published raises VersionNotFoundError, which is also a KeyError.

__iter__ #

__iter__() -> Iterator[str]

Iterate over versions, oldest first.

__len__ #

__len__() -> int

Count the published versions.

__contains__ #

__contains__(version: str) -> bool

Whether this volume has published the version.

book #

book(version: str | None = None, *, edition: int | None = None, refresh: bool = False) -> Book

Resolve one published Book, defaulting to the newest version and edition.

__getitem__ #

__getitem__(version: str) -> Book

Resolve the newest edition of one version, the same as book(version).

A version the volume has not published raises VersionNotFoundError, which is also a KeyError.