Client#

lcmd_db.load_dataset

lcmd_db.load_molecules

Load molecules from the list endpoint with simple server-side filters.

lcmd_db.clear_cache

Remove cached data files.

lcmd_db.schema

Fetch property definitions for a subset from the API.

lcmd_db.settings.Settings

Loading#

load_dataset(subset, **kwargs)[source]#
Return type:

SubsetData

load_molecules(*, subset=None, smarts=None, smiles=None, molecular_formula=None, limit=None)[source]#

Load molecules from the list endpoint with simple server-side filters.

Filters are optional, single-value, and combined with AND semantics. Pass subset to restrict the search to one subset; omit it to search across all molecules in the database.

Parameters:
  • subset (str | None (default: None)) – Restrict the search to a single subset slug.

  • smarts (str | None (default: None)) – SMARTS substructure pattern.

  • smiles (str | None (default: None)) – SMILES substring.

  • molecular_formula (str | None (default: None)) – Molecular-formula substring.

  • limit (int | None (default: None)) – Stop after this many molecules. Passing a limit also opts out of the unbounded-result safety check.

Raises:

ResultTooLargeError – When no limit is given and the query matches more than settings.max_molecules molecules. Narrow the query, pass limit, or raise LCMD_DB_MAX_MOLECULES.

Return type:

MoleculeDataset[dict[str, Value]]

clear_cache(subset=None, cache_dir=None)[source]#

Remove cached data files.

Parameters:
  • subset (str | None (default: None)) – If given, only clear the cache for this subset. Otherwise clear all.

  • cache_dir (str | Path | None (default: None)) – Override the default cache directory.

Return type:

None

Schema#

schema(subset, entity_type=EntityType.MOLECULES)[source]#

Fetch property definitions for a subset from the API.

Raises:
Return type:

list[PropertyInfo]

Settings#

class Settings[source]#

Bases: BaseSettings

max_molecules: int#

Safety ceiling for an unbounded load_molecules call (0 disables it).

Exceptions#

exception LCMDError[source]#

Bases: Exception

Base exception for all LCMD client errors.

exception DatasetNotFoundError[source]#

Bases: LCMDError

exception DownloadError[source]#

Bases: LCMDError

exception SchemaError[source]#

Bases: LCMDError

exception AssemblyError[source]#

Bases: LCMDError