Skip to content

This article demonstrates how to enable Python/Jupyter application coding autocompletion feature. The demo application uses content from Refinitiv Data Platform (RDP) as an example library.

License

Notifications You must be signed in to change notification settings

LSEG-API-Samples/Article.DataLibrary.Python.NotebookAutoCompletion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to enable Autocompletion in JupyterLab application

Overview

Last Updated: April 2025

With the rise of Data Scientists, Financial coders, Casual Developers, or Traders (aka Citizen Developers), and the rapid growth of Jupyter application, the JupyterLab (aka Notebook) is a de-facto tool of those Citizen Developers. Thanks to the IPython kernel, Notebook provides a powerful interactive shell, interactive data visualization, embedded documentation, and supports various programming languages such as Python (native supported), R, Julia, and much more.

The Notebook application is easier to use when comparing to other traditional IDEs (Integrated development environment) or Editors. Citizen Developers do not need much programming language or technology experience to use the Notebook application. However, The Jupyter Notebook also provides Coding and Magic features which make Notebook a friendly development environment for both Citizen and Professional Developers.

This article demonstrates how to enable Python/Jupyter application coding autocompletion feature. The demo application uses content from the Data Library for Python as an example library.

Introduction to the Data Library for Python

The Data Library for Python provides a set of ease-of-use interfaces offering coders uniform access to the breadth and depth of financial data and services available on the Workspace, Data Platform, and Real-Time Platforms. The API is designed to provide consistent access through multiple access channels and target both Professional Developers and Financial Coders. Developers can choose to access content from the desktop, through their deployed streaming services, or directly to the cloud. With the Data Library, the same Python code can be used to retrieve data regardless of which access point you choose to connect to the platform.

Figure-1

The Data Library are available in the following programming languages:

For more deep detail regarding the Data Library for Python, please refer to the following articles and tutorials:

Disclaimer

This article is based on Data Library Python versions 2.1.1

Python built-in help

The Python programming language comes with a built-in help() function to display documentation of modules, functions, classes, objects, etc with the following syntax:

help([object])

However, the result is not always easy to read as the following examples:

Figure-1

or

Figure-2

For the library that keeps involving like Data Library for Python, this is inconvenient even the Library itself is easy to use.

IPython Autocompletion

Fortunately, the JupyterLab comes with the IPython magic command %config Completer.use_jedi = False statement that enables the library/function autocompletion (like IntelliSense in Microsoft development environment term).

You need to set the magic command %config Completer.use_jedi = False statement at the top cell of the Notebook application (like this Notebook).

Figure-3

Once you have enabled and run the %config Completer.use_jedi = False magic command, you can trigger the code autocompletion by pressing the tab button after the "." character.

Figure-4

This IPython command also enables the "shift + tab" buttons to show the function help and tooltip information.

Figure-5

You can also use "?" at the end of the function (without ()) to display documentation for objects and methods in the IPython environment.

Figure-5

Please see the full detail of IPython Autocompletion features with Data Library example in the tutorial notebook.

Prerequisite

This example requires the following dependencies software.

  1. LSEG Workspace desktop application with access to Data Library for Python.
  2. Python (Ananconda or MiniConda distribution/package manager also compatible).
  3. Jupyter Lab application.

Note:

  • This Project has been qualified with Python version 3.11.5
  • If you are not familiar with Jupyter Lab application, the following tutorial created by DataCamp may help you.

Please contact your LSEG's representative to help you to access the Workspace platform.

Project Application Files

This example project contains the following files and folders

  1. notebook_python/ld_notebook.ipynb: The example Jupyter Notebook application file.
  2. requirements.txt: The project Python dependencies configuration file.
  3. images: Project images folder.
  4. LICENSE.md: Project's license file.
  5. README.md: Project's README file.

Running the example Notebook.

  1. Open a Command Prompt and go to the project's folder

  2. Run the following command in a Command Prompt to create a Python virtual environment named ld_notebook for the project.

    $>python -m venv ld_notebook
  3. Once the environment is created, activate an environment named ld_notebook with this command.

    $>ld_notebook\Scripts\activate
  4. Run the following command to install Data Library for Python and all dependencies in ld_notebook environment

    (ld_notebook) $>pip install -r requirements.txt
  5. Go to project's notebook folder and update a contain in lseg-data.config.json file with the your App-Key

    {
        "logs": {
            "level": "debug",
            "transports": {
                "console": {
                    "enabled": false
                },
                "file": {
                    "enabled": false,
                    "name": "lseg-data-lib.log"
                }
            }
        },
        "sessions": {
            "default": "desktop.workspace",
            "desktop": {
                "workspace": {
                    "app-key": "YOUR APP KEY GOES HERE!"
                }
            }
        }
    }
  6. In the current Command Prompt, go to project's notebook folder. Run the following command to start Jupyter Lab in the notebook folder.

    $>(ld_notebook)>notebook>jupyter lab
  7. JupyterLab will open the web browser and open the notebook home page.

  8. Open ld_notebook.ipynb Notebook document, then follow through each notebook cell.

    Figure-6

Conclusion and Next Step

Some Professional Developers may think Jupyter Notebook (and JupyterLab) is just a learning tool for Casual Developers like Data Scientists. However, the tool provides enough coding/development features for a wide range of Developers. The IPython Code Autocompletion feature (and other Magics) helps developers implement the code logic and navigate through the libraries/APIs in the same experience as the traditional IDEs.

There is some new development project that tries to merge the benefits/features of the traditional IDEs and Jupyter Notebook like Netflix's Polynote. While the JupyterLab also keeps evolving to make a better development environment and easier to use.

At the same time, the Data Library for Python lets developers rapidly access LSEG content from various platforms with a few lines of code that easy to understand and maintain. Developers can focus on implement the business logic or analysis data without worry about the connection, authentication detail with the Platforms.

References

You can find more details regarding the Data Library and Jupyter Notebook from the following resources:

For any questions related to this article or Data Library, please use the Developers Community Q&A Forum.

About

This article demonstrates how to enable Python/Jupyter application coding autocompletion feature. The demo application uses content from Refinitiv Data Platform (RDP) as an example library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published