Skip to content

Legacy (0.4)#

bookshelf.legacy keeps the 0.4 consumer API working on top of Bookshelf. Every call warns with a DeprecationWarning, and the module is removed in bookshelf 2.0. See Migrating from 0.4 for the replacements.

bookshelf.legacy #

The 0.4 consumer API, kept alive on top of the platform facade.

Every call here warns with a :class:DeprecationWarning and routes to :class:bookshelf.Bookshelf. Data comes from the platform, never from the old S3 bucket, so a remote_bookshelf URL is reported and then ignored.

UnknownBook #

Bases: ValueError

An unknown book is requested.

UnknownVersion #

UnknownVersion(name: str, version: str | None, edition: int | None = None)

Bases: ValueError

An unknown version is requested.

UnknownEdition #

UnknownEdition(name: str, version: str | None, edition: int | None = None)

Bases: UnknownVersion

An unknown edition is requested.

BookShelf #

BookShelf(path: str | Path | None = None, remote_bookshelf: str | None = None)

The 0.4 BookShelf, backed by the platform.

path becomes the content cache directory. remote_bookshelf has no effect, because the platform is the only source now.

load #

load(name: str, version: str | None = None, edition: int | None = None, force: bool = False) -> LocalBook

Load a book, defaulting to the latest version and edition.

force is accepted and ignored, because there is no metadata cache to refresh.

list_versions #

list_versions(name: str) -> list[str]

List the published versions of a volume, oldest first.

is_available #

is_available(name: str, version: str | None = None, edition: int | None = None) -> bool

Report whether a matching published book exists on the platform.

is_cached #

is_cached(name: str, version: str, edition: int) -> bool

Report whether every resource of a book is already in the local cache.

The book itself still has to be resolved on the platform, so this is best effort.

list_books #

list_books() -> list[str]

Not supported in 0.4 either.

LocalBook #

LocalBook(book: Book)

The 0.4 LocalBook, reading each resource from the platform.

long_version #

long_version() -> str

Return the {version}_e{edition:03} identifier, for example v1.0.1_e002.

metadata #

metadata() -> dict[str, Any]

Return a plain dict in the shape of the old datapackage.json descriptor.

timeseries #

timeseries(timeseries_name: str) -> ScmRun

Return a timeseries resource as an :class:scmdata.ScmRun.

get_long_format_data #

get_long_format_data(timeseries_name: str) -> pd.DataFrame

Return a timeseries resource in the 0.4 long format.