lusid-express


Namelusid-express JSON
Version 1.2.2 PyPI version JSON
download
home_pagehttps://gitlab.com/orlando.calvo1/lusid-express
Summarylusid-express is a python package that makes it quick and easy to get started using Lusid and Luminesce.
upload_time2024-06-25 00:17:28
maintainerNone
docs_urlNone
authorOrlando Calvo
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![pypi](https://img.shields.io/pypi/v/lusid-express)](https://pypi.org/project/lusid-express/)
[![python](https://img.shields.io/pypi/pyversions/lusid-express.svg)](https://pypi.org/project/lusid-express/)

# 1. lusid-express
##### 1.0.0.0.1. *`lusid-express` is a python package that makes it quick and easy to get started using Lusid and Luminesce. It is particularly geared toward creating a good notebook user experience when working locally.*



<!-- vscode-markdown-toc -->
* 1. [Getting Started](#GettingStarted)
	* 1.1. [Requirements](#Requirements)
		* 1.1.1. [Environmental Variable setup](#EnvironmentalVariablesetup)
	* 1.2. [Installation](#Installation)
* 2. [Convenience package installations](#Conveniencepackageinstallations)
* 3. [Luminesce Magic Command](#LuminesceMagicCommand)
	* 3.1. [Why use this?](#Whyusethis)
* 4. [Pre-loaded Variables](#Pre-loadedVariables)
* 5. [Formatting](#Formatting)
	* 5.1. [Lusid Objects](#LusidObjects)
	* 5.2. [Copy to Clipboard](#CopytoClipboard)
* 6. [Widgets](#Widgets)

<!-- vscode-markdown-toc-config
	numbering=true
	autoSave=true
	/vscode-markdown-toc-config -->
<!-- /vscode-markdown-toc -->




This repository holds the source code for lusid-express, a python package that makes it quick and easy to get started using Lusid and Luminesce. The package provides convenience in 4 distinct ways.

1. Ease of installation of finbourne packages.
2.  `%%luminesce` cell magic in your local jupyter installation.
3.  Preset variables that make it possible to ommit boiler plate code.
4.  Widgets and other visual representations of Lusid objects.

```mermaid
flowchart LR

LE-->UTILS[utils]
LE-->WIDGETS[widgets]
LE-->MAIN[CLI]
LE[lusid_express]-->API[apis]
LE-->DISPLAY[display]




WIDGETS-->Transaction(Transaction Forms):::F
MAIN-->O(Optional Styling Overrides):::F
MAIN-->Vars(Optional startup variables):::F
MAIN-->Mag(Optional magics):::F
DISPLAY-->M(markdown render tools):::F
DISPLAY-->H(HTML render tools):::F
DISPLAY-->S(Styling):::F
DISPLAY-->Scr(javaScript):::F
API-->Ap(authed lusid apis):::F
UTILS-->L(datetime tools):::F
UTILS-->V(case adjustment tools):::F
UTILS-->X(idempotentcy tools):::F

classDef F fill:#e1dddd
```

##  1. <a name='GettingStarted'></a>Getting Started
###  1.1. <a name='Requirements'></a>Requirements
In order to authenticate the lusid api clients you will need to have generated a secrets file. furthermore, you will need to have an environmental variable named `FBN_SECRETS_PATH` set to the full path to your secrets file. 

####  1.1.1. <a name='EnvironmentalVariablesetup'></a>Environmental Variable setup
##### 1.1.1.1.1. Mac OS
Assuming `~/.secret/secrets.json` exists
```bash
echo 'export FBN_SECRETS_PATH="~/.secret/secrets.json"' >> ~/.zshrc
```


NOTE: Your secrets file needs to include the lumi api url under the key: `lumiApiUrl`. This url usually takes the form `https://{your-domain}.lusid.com/honeycomb`.

###  1.2. <a name='Installation'></a>Installation 

```sh
pip install -U lusid-express
python -m lusid_express --enable all
```
 The above commands install the `lusid-express` package and enable enhancements to your IPython environment. If running from a virtual environment these enhancements are limited to that virtual environment.
 enabling `magic` adds the `luminesce` magic command. `vars` adds preloaded variables to IPython sessions. `format` adds tables with finbourne branding, as well as branded automatic rendering of lusid objects when displayed. The `--disable` command is available should you wish to disable these. 




##  2. <a name='Conveniencepackageinstallations'></a>Convenience package installations

```mermaid
graph LR;
    lu[lusid_express]-->lusid_express[Lusid_blundle]
    lusid_express --> luminesce_sdk_preview
    lusid_express --> lusid_jam
    lusid_express --> lusid_sdk_preview
    lusid_express --> fbnlab_preview
    lusid_express --> finbourne_access_sdk
    lusid_express --> finbourne_identity_sdk
    lusid_express --> finbourne_insights_sdk_preview
    lusid_express --> finbourne_sdk_utilities
    lusid_express --> lusid_configuration_sdk_preview
    lusid_express --> lusid_drive_sdk_preview
    lusid_express --> lusid_notifications_sdk_preview
    lusid_express --> lusid_scheduler_sdk_preview
    lusid_express --> lusid_workflow_sdk_preview
    lusid_express --> lusidtools
    lusid_express --> dve_lumipy_preview

    luminesce_sdk_preview["luminesce-sdk-preview==1.14.758"]
    lusid_jam["lusid-jam==0.1.2"]
    lusid_sdk_preview["lusid-sdk-preview==1.1.120"]
    fbnlab_preview["fbnlab-preview==0.1.108"]
    finbourne_access_sdk["finbourne-access-sdk==0.0.3751"]
    finbourne_identity_sdk["finbourne-identity-sdk==0.0.2834"]
    finbourne_insights_sdk_preview["finbourne-insights-sdk-preview==0.0.763"]
    finbourne_sdk_utilities["finbourne-sdk-utilities==0.0.10"]
    lusid_configuration_sdk_preview["lusid-configuration-sdk-preview==0.1.514"]
    lusid_drive_sdk_preview["lusid-drive-sdk-preview==0.1.617"]
    lusid_notifications_sdk_preview["lusid-notifications-sdk-preview==0.1.923"]
    lusid_scheduler_sdk_preview["lusid-scheduler-sdk-preview==0.0.829"]
    lusid_workflow_sdk_preview["lusid-workflow-sdk-preview==0.1.810"]
    lusidtools["lusidtools==1.0.14"]
    dve_lumipy_preview["dve-lumipy-preview==0.1.1075"]

```


##  3. <a name='LuminesceMagicCommand'></a>Luminesce Magic Command

```bash
python -m lusid_express -e magic
```

###  3.1. <a name='Whyusethis'></a>Why use this?
The main motivation to use this cell magic is to enable SQL syntax highlighting through the use of SQL jupyter cells. That is, rather than display a cell on a notebook that holds an SQL string such as:
```python
sql_string = """
@raw_equities =
SELECT *,
    'training' as Scope,
    Currency as domCcy,
    Ticker as DisplayName
FROM @equitiesCSV
WHERE Ticker IS NOT null;
where Ticker is null
    and "type" is not "FundsIn";
SELECT *
FROM Lusid.Instrument.Equity.Writer
WHERE toWrite = @raw_equities;
"""

```

You would instead have a cell with pure SQL that looks like this:
```SQL
%%luminesce

@raw_equities =
SELECT *,
    'training' as Scope,
    Currency as domCcy,
    Ticker as DisplayName
FROM @equitiesCSV
WHERE Ticker IS NOT null;
where Ticker is null
    and "type" is not "FundsIn";
SELECT *
FROM Lusid.Instrument.Equity.Writer
WHERE toWrite = @raw_equities;
```
VSCode allows the SQL auto-formatting of Jupyter cells. This query runs when the cell is excecuted.



##  4. <a name='Pre-loadedVariables'></a>Pre-loaded Variables
```bash
python -m lusid_express -e vars
```
Enabling this feature provides the convenience of automatically loading important variables into python notebooks. This allows us to omit boler-plate code from each notebook. It also allows for reduce complexity as token management, authentication, and api client instantiations have all been abstracted away.

| Variable Name | Statement         | Description                          |
|---------------|-------------------|--------------------------------------|
| lu          | `import lusid as lu` | Main LUSID package                   |
| lm          | `import lusid.models as lm` | LUSID models module                  |
| apis         | `import lusid_express.apis as apis` | convenience package providing pre-authenticated api access.                 |


##  5. <a name='Formatting'></a>Formatting

```bash
python -m lusid_express -e format
```
When enabled, `format` overrides default rendering of certain types of objects.

###  5.1. <a name='LusidObjects'></a>Lusid Objects
Lusid Objects are rendered as tables, displaying the object type as the table's title, and its properties in the table's rows

<h4>Equity</h4> <table id='DATA_TABLE-f8224859-f897-42c9-ae2a-df56f52dda23'><tr><th>Property</th><th>Value</th></tr><tr><td class='indent-0 '><strong>identifiers</strong></td><td></td></tr><tr><td class='indent-1 muted-text'>&nbsp;&nbsp;&nbsp;&nbsp;<strong>isin</strong></td><td class='muted-text'>US0378331005</td></tr><tr><td class='indent-1 muted-text'>&nbsp;&nbsp;&nbsp;&nbsp;<strong>figi</strong></td><td class='muted-text'>BBG000B9XVV8</td></tr><tr><td class='indent-1 muted-text'>&nbsp;&nbsp;&nbsp;&nbsp;<strong>ticker</strong></td><td class='muted-text'>AAPL</td></tr><tr><td class='indent-0 '><strong>dom_ccy</strong></td><td class=''>USD</td></tr><tr><td class='indent-0 '><strong>instrument_type</strong></td><td class=''>Equity</td></tr></table> 

###  5.2. <a name='CopytoClipboard'></a>Copy to Clipboard
With every table or Pandas DataFrame a `Copy to Clipboard` button is available for excel friendly copy/pasting.

##  6. <a name='Widgets'></a>Widgets
The widgets module allows you to quickly create forms that represent the input of several entity types. They also include a submit button to execute api calls. Only `Transactions` have a widget representation for now, more will be added.



            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/orlando.calvo1/lusid-express",
    "name": "lusid-express",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Orlando Calvo",
    "author_email": "orlando.calvo@finbourne.com",
    "download_url": "https://files.pythonhosted.org/packages/05/3f/dcec5c07e222416ba4c55263d38a9f40d133633691ff52262d9a779b901d/lusid_express-1.2.2.tar.gz",
    "platform": null,
    "description": "\n[![pypi](https://img.shields.io/pypi/v/lusid-express)](https://pypi.org/project/lusid-express/)\n[![python](https://img.shields.io/pypi/pyversions/lusid-express.svg)](https://pypi.org/project/lusid-express/)\n\n# 1. lusid-express\n##### 1.0.0.0.1. *`lusid-express` is a python package that makes it quick and easy to get started using Lusid and Luminesce. It is particularly geared toward creating a good notebook user experience when working locally.*\n\n\n\n<!-- vscode-markdown-toc -->\n* 1. [Getting Started](#GettingStarted)\n\t* 1.1. [Requirements](#Requirements)\n\t\t* 1.1.1. [Environmental Variable setup](#EnvironmentalVariablesetup)\n\t* 1.2. [Installation](#Installation)\n* 2. [Convenience package installations](#Conveniencepackageinstallations)\n* 3. [Luminesce Magic Command](#LuminesceMagicCommand)\n\t* 3.1. [Why use this?](#Whyusethis)\n* 4. [Pre-loaded Variables](#Pre-loadedVariables)\n* 5. [Formatting](#Formatting)\n\t* 5.1. [Lusid Objects](#LusidObjects)\n\t* 5.2. [Copy to Clipboard](#CopytoClipboard)\n* 6. [Widgets](#Widgets)\n\n<!-- vscode-markdown-toc-config\n\tnumbering=true\n\tautoSave=true\n\t/vscode-markdown-toc-config -->\n<!-- /vscode-markdown-toc -->\n\n\n\n\nThis repository holds the source code for lusid-express, a python package that makes it quick and easy to get started using Lusid and Luminesce. The package provides convenience in 4 distinct ways.\n\n1. Ease of installation of finbourne packages.\n2.  `%%luminesce` cell magic in your local jupyter installation.\n3.  Preset variables that make it possible to ommit boiler plate code.\n4.  Widgets and other visual representations of Lusid objects.\n\n```mermaid\nflowchart LR\n\nLE-->UTILS[utils]\nLE-->WIDGETS[widgets]\nLE-->MAIN[CLI]\nLE[lusid_express]-->API[apis]\nLE-->DISPLAY[display]\n\n\n\n\nWIDGETS-->Transaction(Transaction Forms):::F\nMAIN-->O(Optional Styling Overrides):::F\nMAIN-->Vars(Optional startup variables):::F\nMAIN-->Mag(Optional magics):::F\nDISPLAY-->M(markdown render tools):::F\nDISPLAY-->H(HTML render tools):::F\nDISPLAY-->S(Styling):::F\nDISPLAY-->Scr(javaScript):::F\nAPI-->Ap(authed lusid apis):::F\nUTILS-->L(datetime tools):::F\nUTILS-->V(case adjustment tools):::F\nUTILS-->X(idempotentcy tools):::F\n\nclassDef F fill:#e1dddd\n```\n\n##  1. <a name='GettingStarted'></a>Getting Started\n###  1.1. <a name='Requirements'></a>Requirements\nIn order to authenticate the lusid api clients you will need to have generated a secrets file. furthermore, you will need to have an environmental variable named `FBN_SECRETS_PATH` set to the full path to your secrets file. \n\n####  1.1.1. <a name='EnvironmentalVariablesetup'></a>Environmental Variable setup\n##### 1.1.1.1.1. Mac OS\nAssuming `~/.secret/secrets.json` exists\n```bash\necho 'export FBN_SECRETS_PATH=\"~/.secret/secrets.json\"' >> ~/.zshrc\n```\n\n\nNOTE: Your secrets file needs to include the lumi api url under the key: `lumiApiUrl`. This url usually takes the form `https://{your-domain}.lusid.com/honeycomb`.\n\n###  1.2. <a name='Installation'></a>Installation \n\n```sh\npip install -U lusid-express\npython -m lusid_express --enable all\n```\n The above commands install the `lusid-express` package and enable enhancements to your IPython environment. If running from a virtual environment these enhancements are limited to that virtual environment.\n enabling `magic` adds the `luminesce` magic command. `vars` adds preloaded variables to IPython sessions. `format` adds tables with finbourne branding, as well as branded automatic rendering of lusid objects when displayed. The `--disable` command is available should you wish to disable these. \n\n\n\n\n##  2. <a name='Conveniencepackageinstallations'></a>Convenience package installations\n\n```mermaid\ngraph LR;\n    lu[lusid_express]-->lusid_express[Lusid_blundle]\n    lusid_express --> luminesce_sdk_preview\n    lusid_express --> lusid_jam\n    lusid_express --> lusid_sdk_preview\n    lusid_express --> fbnlab_preview\n    lusid_express --> finbourne_access_sdk\n    lusid_express --> finbourne_identity_sdk\n    lusid_express --> finbourne_insights_sdk_preview\n    lusid_express --> finbourne_sdk_utilities\n    lusid_express --> lusid_configuration_sdk_preview\n    lusid_express --> lusid_drive_sdk_preview\n    lusid_express --> lusid_notifications_sdk_preview\n    lusid_express --> lusid_scheduler_sdk_preview\n    lusid_express --> lusid_workflow_sdk_preview\n    lusid_express --> lusidtools\n    lusid_express --> dve_lumipy_preview\n\n    luminesce_sdk_preview[\"luminesce-sdk-preview==1.14.758\"]\n    lusid_jam[\"lusid-jam==0.1.2\"]\n    lusid_sdk_preview[\"lusid-sdk-preview==1.1.120\"]\n    fbnlab_preview[\"fbnlab-preview==0.1.108\"]\n    finbourne_access_sdk[\"finbourne-access-sdk==0.0.3751\"]\n    finbourne_identity_sdk[\"finbourne-identity-sdk==0.0.2834\"]\n    finbourne_insights_sdk_preview[\"finbourne-insights-sdk-preview==0.0.763\"]\n    finbourne_sdk_utilities[\"finbourne-sdk-utilities==0.0.10\"]\n    lusid_configuration_sdk_preview[\"lusid-configuration-sdk-preview==0.1.514\"]\n    lusid_drive_sdk_preview[\"lusid-drive-sdk-preview==0.1.617\"]\n    lusid_notifications_sdk_preview[\"lusid-notifications-sdk-preview==0.1.923\"]\n    lusid_scheduler_sdk_preview[\"lusid-scheduler-sdk-preview==0.0.829\"]\n    lusid_workflow_sdk_preview[\"lusid-workflow-sdk-preview==0.1.810\"]\n    lusidtools[\"lusidtools==1.0.14\"]\n    dve_lumipy_preview[\"dve-lumipy-preview==0.1.1075\"]\n\n```\n\n\n##  3. <a name='LuminesceMagicCommand'></a>Luminesce Magic Command\n\n```bash\npython -m lusid_express -e magic\n```\n\n###  3.1. <a name='Whyusethis'></a>Why use this?\nThe main motivation to use this cell magic is to enable SQL syntax highlighting through the use of SQL jupyter cells. That is, rather than display a cell on a notebook that holds an SQL string such as:\n```python\nsql_string = \"\"\"\n@raw_equities =\nSELECT *,\n    'training' as Scope,\n    Currency as domCcy,\n    Ticker as DisplayName\nFROM @equitiesCSV\nWHERE Ticker IS NOT null;\nwhere Ticker is null\n    and \"type\" is not \"FundsIn\";\nSELECT *\nFROM Lusid.Instrument.Equity.Writer\nWHERE toWrite = @raw_equities;\n\"\"\"\n\n```\n\nYou would instead have a cell with pure SQL that looks like this:\n```SQL\n%%luminesce\n\n@raw_equities =\nSELECT *,\n    'training' as Scope,\n    Currency as domCcy,\n    Ticker as DisplayName\nFROM @equitiesCSV\nWHERE Ticker IS NOT null;\nwhere Ticker is null\n    and \"type\" is not \"FundsIn\";\nSELECT *\nFROM Lusid.Instrument.Equity.Writer\nWHERE toWrite = @raw_equities;\n```\nVSCode allows the SQL auto-formatting of Jupyter cells. This query runs when the cell is excecuted.\n\n\n\n##  4. <a name='Pre-loadedVariables'></a>Pre-loaded Variables\n```bash\npython -m lusid_express -e vars\n```\nEnabling this feature provides the convenience of automatically loading important variables into python notebooks. This allows us to omit boler-plate code from each notebook. It also allows for reduce complexity as token management, authentication, and api client instantiations have all been abstracted away.\n\n| Variable Name | Statement         | Description                          |\n|---------------|-------------------|--------------------------------------|\n| lu          | `import lusid as lu` | Main LUSID package                   |\n| lm          | `import lusid.models as lm` | LUSID models module                  |\n| apis         | `import lusid_express.apis as apis` | convenience package providing pre-authenticated api access.                 |\n\n\n##  5. <a name='Formatting'></a>Formatting\n\n```bash\npython -m lusid_express -e format\n```\nWhen enabled, `format` overrides default rendering of certain types of objects.\n\n###  5.1. <a name='LusidObjects'></a>Lusid Objects\nLusid Objects are rendered as tables, displaying the object type as the table's title, and its properties in the table's rows\n\n<h4>Equity</h4> <table id='DATA_TABLE-f8224859-f897-42c9-ae2a-df56f52dda23'><tr><th>Property</th><th>Value</th></tr><tr><td class='indent-0 '><strong>identifiers</strong></td><td></td></tr><tr><td class='indent-1 muted-text'>&nbsp;&nbsp;&nbsp;&nbsp;<strong>isin</strong></td><td class='muted-text'>US0378331005</td></tr><tr><td class='indent-1 muted-text'>&nbsp;&nbsp;&nbsp;&nbsp;<strong>figi</strong></td><td class='muted-text'>BBG000B9XVV8</td></tr><tr><td class='indent-1 muted-text'>&nbsp;&nbsp;&nbsp;&nbsp;<strong>ticker</strong></td><td class='muted-text'>AAPL</td></tr><tr><td class='indent-0 '><strong>dom_ccy</strong></td><td class=''>USD</td></tr><tr><td class='indent-0 '><strong>instrument_type</strong></td><td class=''>Equity</td></tr></table> \n\n###  5.2. <a name='CopytoClipboard'></a>Copy to Clipboard\nWith every table or Pandas DataFrame a `Copy to Clipboard` button is available for excel friendly copy/pasting.\n\n##  6. <a name='Widgets'></a>Widgets\nThe widgets module allows you to quickly create forms that represent the input of several entity types. They also include a submit button to execute api calls. Only `Transactions` have a widget representation for now, more will be added.\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "lusid-express is a python package that makes it quick and easy to get started using Lusid and Luminesce.",
    "version": "1.2.2",
    "project_urls": {
        "Homepage": "https://gitlab.com/orlando.calvo1/lusid-express"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6293ffc743bb93fcc696a40c256c69bd47921e9d46cb33aca9d2b5c157921d85",
                "md5": "7c0d1cf1be8fff3cb77ccc62a5b84311",
                "sha256": "1a5315d7a20eef178ad96acf3c474c6e9b2d3aef37b606732a1c9bb5f3d4595d"
            },
            "downloads": -1,
            "filename": "lusid_express-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7c0d1cf1be8fff3cb77ccc62a5b84311",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 135669,
            "upload_time": "2024-06-25T00:17:26",
            "upload_time_iso_8601": "2024-06-25T00:17:26.601271Z",
            "url": "https://files.pythonhosted.org/packages/62/93/ffc743bb93fcc696a40c256c69bd47921e9d46cb33aca9d2b5c157921d85/lusid_express-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "053fdcec5c07e222416ba4c55263d38a9f40d133633691ff52262d9a779b901d",
                "md5": "b7c3c1374701b06add389335485807b6",
                "sha256": "7e250204bcaf4dd5e240a869cffcd0df5a5103de97a2a01afd14521df1ab1f72"
            },
            "downloads": -1,
            "filename": "lusid_express-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b7c3c1374701b06add389335485807b6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 134799,
            "upload_time": "2024-06-25T00:17:28",
            "upload_time_iso_8601": "2024-06-25T00:17:28.963529Z",
            "url": "https://files.pythonhosted.org/packages/05/3f/dcec5c07e222416ba4c55263d38a9f40d133633691ff52262d9a779b901d/lusid_express-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-25 00:17:28",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "orlando.calvo1",
    "gitlab_project": "lusid-express",
    "lcname": "lusid-express"
}
        
Elapsed time: 0.24169s