Installation#
neat
is distributed as a Python package. It is intended to be used in a notebook environment such as, for example,
Jupyter Notebooks. Another notebook environment is the CDF notebooks.
CDF Notebooks Environment#
CDF Notebooks are a part of the Cognite Data Fusion (CDF) platform. These notebooks are a great way to get started with
neat
, even if you have no coding experience.
Limitations
CDF Notebooks are running in your browser. This have some limitations compared to running neat
locally. The
main difference is that locally neat can use a more powerful storge backend. This means that if you are working
with large amounts of metadata, you might want to consider running neat
locally.
- Go to Cognite Data Fusion
- Login to your account
- Ensure you have selected the
Data Management
workspace. - Select
Build solutions
in your left menubar. - Click on
Jupyter Notebooks
under the expandedBuild solutions
menu. - Launch a new notebook.
- Install
cognite-neat
by running%pip install cognite-neat
in a cell. - Import
NeatSession
andCogniteClient
and start using it as shown below
from cognite.client import CogniteClient
from cognite.neat import NeatSession
client = CogniteClient()
neat = NeatSession(client)
# Start using neat by typing neat.<TAB>
Local Notebook Environment#
Running neat
locally requires a Python environment as well as a notebook environment. The following steps will
guide youy through the installation process using Jupyter Lab as the notebook environment.
Prerequisites: Installed Python 3.10 or later, see python.org
- Create and enter directory for
neat
installation - Create a virtual environment:
- Activate your virtual environment
- Install
cognite-neat
- Install a notebook environment,
pip install jupyterlab
- Start your notebook environment,
jupyter lab
- Import
NeatSession
andget_cognite_client
and start using it
In a notebook cell, you can now import NeatSession
and get_cognite_client
and start using it as shown below
from cognite.neat import NeatSession, get_cognite_client
client = get_cognite_client(".env")
neat = NeatSession(client)
# Start using neat by typing neat.<TAB>
Helper get_cognite_client function
The get_cognite_client
function is a helper function that reads the environment variables from a .env
file
and creates a CogniteClient
instance. This is a common pattern when working with Cognite Data Fusio through
Python. Note that if you dont' have a .env
file, it will prompt you to enter environment variables
interactively and offer to save them to a .env
file. You can instantiate a CogniteClient
instance directly
if you prefer.