camel_tools.data
This sub-module contains utilities for locating datastes for the various CAMeL Tools components.
Classes
- class camel_tools.data.DownloaderError(msg)
Exception raised when an error occurs during data download.
- class camel_tools.data.FileEntry(path: str, sha256: str)
Data class containing information about a given file.
- class camel_tools.data.PackageType(value)
Enum indicating the type of a package.
- HTTP = 1
Indicates package is a zip file that can be downloaded via HTTP/HTTPS.
- META = 0
Indicates a package is a meta package (ie. contains no files, only dependencies)
- class camel_tools.data.PackageEntry(name: str, description: str, size: int | None, version: str | None, license: str, package_type: PackageType, url: str | None, destination: Path | None, dependencies: Set[str] | None, files: List[FileEntry] | None, private: bool, sha256: str | None, post_install: dict | None)
Data class containing information about a given package.
- package_type: PackageType
Type of this package.
- class camel_tools.data.DatasetEntry(name: str, component: str, path: str)
Data class containing information about an individual dataset.
- class camel_tools.data.ComponentEntry(name: str, default: str, datasets: Mapping[str, DatasetEntry])
Data class that contains dataset information for a given component.
- datasets: Mapping[str, DatasetEntry]
A mapping of dataset names to their respective entries.
- class camel_tools.data.CatalogueError(msg: str)
Exception raised when an error occurs during data download.
- class camel_tools.data.Catalogue(version: str, packages: Mapping[str, PackageEntry], components: Mapping[str, ComponentEntry])
This class allows downloading and querying datasets provided by CAMeL Tools.
- components: Mapping[str, ComponentEntry]
Mapping of component names with their respective entries.
- download_package(package: str, recursive: bool = True, force: bool = False, print_status: bool = False)
Download and install package with a given name.
- Parameters:
package (
str) – Name of package to download and install.recursive (
bool, Optional) – If True, dependencies are recursively installed. Otherwise, only the package contents are installed. Defaults to True.force (
bool, Optional) – If True, packages that are already installed and up-to-date will be reinstalled, otherwise they are ignored. Defaults to False.print_status (
bool, Optional) – If True, prints out the download status to standard output. Defaults to False.
- get_component(component: str) ComponentEntry
Get component entry for a given component name.
- Parameters:
component (
str) – Name of component to query.- Returns:
Entry associated with given component name.
- Return type:
- Raises:
CatalogueError – When component is not a valid component name.
- get_dataset(component: str, dataset: str | None = None) DatasetEntry
Get dataset entry for a given component name and dataset name.
- Parameters:
- Returns:
The dataset entry for the given component and dataset names.
- Return type:
- static get_default_catalogue_path() Path
Returns the default catalogue path, respecting the CAMELTOOLS_DATA environment variable if it is set.
- Returns:
Path to the catalogue file.
- Return type:
Path
- get_package(package: str) PackageEntry
Get a package entry for a given package name.
- Parameters:
package (
str) – Name of package to query.- Returns:
Entry associated with given package name.
- Return type:
- Raises:
CatalogueError – When package is not a valid package name.
- get_public_packages() List[str]
Returns a list of all package names marked as public in the catalogue.
- packages: Mapping[str, PackageEntry]
Mapping of package names to their respective entries.
- static update_catalogue()
Download latest catalogue for the current version of CAMeL Tools.
- Raises:
DownloaderError – When an error occurs while downloading catalogue.