Python

Python reference

Lightweight operations, result models, clients, profiles, and compatibility.

Suggest an edit

Public operations

The primary entry points are search, substructure, sample, and catalog. Each module-level sync operation owns and closes a short-lived HTTP client. deepmedchem.aio provides matching async operations.

Ranked search accepts method="morgan" (the unchanged default), method="shape", or method="esp". Substructure remains a separate operation because it has containment rather than ranking semantics and accepts SMILES or SMARTS.

Results

SearchResult, SubstructureResult, and SampleResult are ordered SMILES sequences. Their local, aligned views include:

  • smiles, scores, ids, and ranks
  • immutable typed hits
  • compact typed meta
  • typed warnings
  • the forward-compatible raw response
  • the existing dictionary-oriented results compatibility view

repr(result) is bounded and never includes the entire response. Reading any result field is local and performs no HTTP request. Use to_pandas() when pandas is installed.

Commercial offers are not exposed as a prices property. Pricing depends on destination, freshness, supplier, pack, and currency, and the v0.2 API does not yet define the required batch backend contract. A future commercial capability will use an explicit remote verb such as fetch_offers(ship_to="CZ") and preserve per-hit alignment and errors.

Explicit clients

Client and AsyncClient provide the same simple search methods plus the advanced selections and runs namespaces. Client.search_cheese and Client.search_substructure remain compatibility methods. DMCClient and AsyncDMCClient remain aliases for the announced compatibility window.

Profiles and authentication

deepmedchem login
deepmedchem login --profile dev
deepmedchem status --profile dev
deepmedchem logout --profile dev

The default profile uses https://cheese.deepmedchem.com and https://api.deepmedchem.com. The dev profile uses https://cheese-new-dev.deepmedchem.com and https://api-dev.deepmedchem.com. API and web hosts are explicit profile data; the SDK never derives one by editing the other.

Credential precedence is explicit constructor api_key, DEEPMEDCHEM_API_KEY and compatibility environment variables, a custom credential provider, then the selected profile's OS-keyring entry. Profile precedence is explicit profile, DEEPMEDCHEM_PROFILE, configured active profile, then default. Non-secret configuration lives at the platform-native path printed by deepmedchem status; API keys are never written there.

On this page