Getting Started with the API
Welcome to the Edge Python API! This is a Python library which you can use to access nearly every feature of Edge from Python code. It can help with the following tasks:
- Scripting in a Jupyter notebook: Access the Edge file system and data
connectors, directly from a notebook in the Analysis App. The built-in
edgeobject is already set up in your notebook, and has all the access needed.
- Data access and ingestion: With an API token, you can upload and download files to Edge from anywhere. This makes it easy to get data into Edge, and retrieve the results of analysis for use elsewhere.
- Application development: You can use the Edge Python API to programmatically add new apps or app versions. This can be used on your laptop as part of a build script, or in an automated build workflow like GitHub Actions.
The Edge Python API is already installed in the Analysis App. You can access
it via the built-in
edge object in your Jupyter Notebook. The instructions
below are for installing on a computer outside of Edge, for example a
developer's laptop or an automated build system.
Step 1: Get EDM
The Edge Python API is delivered via the
Enthought Deployment Manager,
a tool for creating and managing Python development environments. Follow
the instruction in the linked page to install EDM. When finished, make sure
you can run the
edm command line tool in a terminal:
$ edm --version
If you haven't used EDM before, you may want to bookmark the EDM official docs.
Step 2: Configure EDM
First, in a terminal run
$ edm configure, and provide the information
Then, in your home directory, locate the file
.edm.yaml. This is EDM's
configuration file. You should check the following items:
- Make sure that
enthought/edgeare listed in the "repositories" section.
- If you are not using the main Edge server at
edge.enthought.com, you may need to set the
store_urlparameter to point to your company's package server.
When finished, the file should look something like this:
Step 3: Install the library
In a terminal, type:
$ edm install enthought_edge
For ease of use, you may also wish to install ipython:
$ edm install ipython
Python 3.8.12 |Enthought, Inc. (x86_64)| (default, Sep 27 2021, 11:51:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.
Verify you can import the library:
In : from edge.api import EdgeSession
The center of the Edge Python API is the
EdgeSession class. Through it, you
can access files, data connectors, applications and all other capabilities
exposed through the API.
See the next section to learn how to use EdgeSession.