Skip to content

Latest commit

 

History

History
195 lines (143 loc) · 4.84 KB

File metadata and controls

195 lines (143 loc) · 4.84 KB

Data Library - Project Setup Guide

Overview

A step-by-step Copilot guide to set up a Data Library for Python development environment with Python and JupyterLab on Windows and macOS.

Prerequisites

  • Python 3.11 or higher installed and available on your PATH
  • Git installed and configured
  • Network access to PyPI (or a trusted mirror)

Working Directory (Important)

Run all commands in this guide from the workspace root folder.

Expected Project Layout

Before running setup commands, confirm the project structure should match this layout:

/
├── .github/
│   └── copilot-instructions.md
├── .vscode/
│   └── settings.json
├── .gitignore
├── LICENSE.md
├── Project_README.md
├── README.md (for the repository)
├── images/
├── requirements.txt
├── .venv/
└── notebook/
    ├── ld_notebook.ipynb
    └── lseg-data.config.json

Notes:

  • .venv/ must be inside the workspace root.
  • notebook/ must contain both ld_notebook.ipynb and lseg-data.config.json.

Part 1: Set Up the Python Virtual Environment

  1. Create a virtual environment named .venv inside the workspace root:

    python -m venv .venv

    This must create .venv at the workspace root.

  2. Activate the environment:

    • Windows (PowerShell):
      .\.venv\Scripts\Activate.ps1
    • Windows (CMD):
      .venv\Scripts\activate.bat
    • macOS / Linux:
      source .venv/bin/activate
  3. Update pip to the latest version:

    • Windows (PowerShell/CMD):
      python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir --upgrade pip
    • macOS:
      python3 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir --upgrade pip
  4. Install the required packages:

    • Windows (PowerShell/CMD):
      python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir lseg-data jupyterlab
    • macOS:
      python3 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir lseg-data jupyterlab
  5. Save the installed dependencies to requirements.txt:

    • Windows (PowerShell/CMD):
      python -m pip freeze > requirements.txt
    • macOS:
      python3 -m pip freeze > requirements.txt
  6. Create .vscode/settings.json with the following content:

    {
      "git.ignoreLimitWarning": true
    }
  7. Create the following file and folder structure under the project root:

    notebook/
    ├── ld_notebook.ipynb
    └── lseg-data.config.json
    
  8. Create lseg-data.config.json inside notebook with the following content:

    {
      "logs": {
        "level": "debug",
        "transports": {
          "console": {
            "enabled": false
          },
          "file": {
            "enabled": false,
            "name": "lseg-data-lib.log"
          }
        }
      }
    }

Part 2: Notebook Code

Open notebook/ld_notebook.ipynb in JupyterLab and run the following cells in order.

  1. Import the library:

    import lseg.data as ld
  2. Open a session (connects to LSEG Workspace):

    ld.open_session()
  3. Retrieve market data (BID/ASK for EUR and JPY):

    ld.get_data(universe = ['/EUR=','/JPY='], fields = ['BID','ASK'])
  4. Do not need to run the notebook cells. Developers can run them by themselves to verify the setup is working.


Part 3: Create a Project Setup Branch

Prerequisite: The Part 3 must be completed and the notebook should have outputs saved back into ld_notebook.ipynb before proceeding with these steps.

  1. Add a Project_README.md with # Data Library Jupyter Notebook title.

  2. Add a .gitignore file suitable for Python projects (e.g., from gitignore.io).

  3. Add the .venv/ virtual environment folder to .gitignore.

  4. Verify that the current branch is main:

    git branch --show-current

    If the command does not return main, switch to main before continuing.

  5. Check out a new git branch named setup-project:

    git checkout -b setup-project
  6. Stage all files and create a commit on setup-project:

    git add .
    git commit -m "setup: initial project structure with notebook and dependencies"