The cortex-python library and its optional add-ons are replacing the cortex-client library. The new libraries are more lightweight and use-case focussed. Cortex-python may be used for development with or without the add-ons.
To use the new Cortex libraries, cortex-python and cortex-python-builders you must uninstall the cortex-client library; cortex-client and cortex-pythoncannot be installed simultaneously in your python environment.
> pip uninstall cortex-client
To install:
> pip install cortex-python
To install the optional components:
> pip install cortex-python[viz]
> pip install cortex-python[jupyter]
> pip install cortex-python[builders]
The way Client functionalities can be imported has changed.
To import cortex :
> import cortex
To import ConnectionClient :
> from cortex.connection import ConnectionClient
Use ManagedContentClient to upload and download to your account's managed content. In cortex-client, ConnectionClient was used for these functionalities. The methods to upload and download remain the same.
To import ManagedContentClient:
> from cortex.content import ManagedContentClient
ConnectionClient can be used to save and retrieve connections.
Cortex magics can be used only when the optional builders dependency is installed:
> %reload_ext cortex_builders
- The
InputMessageandOutputMessageclasses have been deprecated. Instead, use theMessageclass:
> from cortex.message import Message
-
ModelClient,ModelProcess, andModelRouterhave been deprecated. Instead, use theexperimentAPI in theClientclass to run experiments, save and retrieve your models. -
JobsClienthas been deprecated. Instead, use theactionAPI inClientclass to save or retrieve actions. Also, you can use theactionin the builder class inside client class to build your actions. (Can be used only when optional dependency of builders is installed) -
SecretsClienthas been deprecated. There is no equivalent replacement functionality in the python library, but you can manage secrets through the Cortex Vault in the Cortex Console or via the CLIcortex variables [command] [options]. -
Message.with_payload()has been removed. This method was previously deprecated incortex-clientv5.5.4. Instead, use theClient.message()method:
> from cortex.client import Cortex
> cortex = Cortex.client()
> message = cortex.message(payload={'value': 'hello world'})
LocalExperiment.set_pipeline()has been removed. This method was previously deprecated incortex-clientv5.5.0. There is no replacement method for this functionality.