trelis


Nametrelis JSON
Version 1.3.0 PyPI version JSON
download
home_pageNone
SummaryA JupyterLab Code Assistant
upload_time2024-10-31 11:05:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseTrelis Assistant for Jupyter Lab - Proprietary License Copyright (c) 2024 Trelis LTD All rights reserved. This software and associated documentation files (the "Software") are proprietary and confidential to Trelis LTD (Company Registration: 705524, VAT: 3808855SH). Access to and use of this Software is governed by the Trelis Terms of Service (available at trelis.com/terms-of-service/) and the following conditions: 1. The Software may only be used in conjunction with valid API credentials obtained through jupyter.trelis.com. 2. You may not modify, merge, publish, distribute, sublicense, reverse engineer, or sell copies of the Software. 3. Use of the Software is subject to the warranty and liability terms outlined in the Trelis Terms of Service (trelis.com/terms-of-service/). 4. This license does not grant you any rights to use Trelis LTD's name, logo, or trademarks. 5. Trelis LTD reserves the right to modify these license terms at any time. For complete terms of use, including API usage limits and service tiers, please refer to trelis.com/terms-of-service/
keywords jupyter jupyterlab jupyterlab-extension
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # trelis

[![Github Actions Status](https://github.com/TrelisResearch/trelis-jupyter-assistant/workflows/Build/badge.svg)](https://github.com/TrelisResearch/trelis-jupyter-assistant/actions/workflows/build.yml)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/TrelisResearch/trelis-jupyter-assistant/main?urlpath=lab)


A JupyterLab Code Assistant

## Requirements

- JupyterLab >= 4.0.0
- Node >= 22.6
- Yarn

## Install

To install the extension, execute:

```bash
pip install trelis
```
to install with node and yarn (for example, in a remote GPU server like RunPod), first run:
```
import os
import subprocess

def check_node_yarn():
    # Check if Node.js is installed
    try:
        node_version = subprocess.check_output(["node", "--version"]).decode().strip()
        print(f"Node.js is installed: {node_version}")
    except FileNotFoundError:
        print("Node.js is not installed.")
        install_node()

    # Check if Yarn is installed
    try:
        yarn_version = subprocess.check_output(["yarn", "--version"]).decode().strip()
        print(f"Yarn is installed: {yarn_version}")
    except FileNotFoundError:
        print("Yarn is not installed.")
        install_yarn()

def install_node():
    print("Installing Node.js...")
    # Download Node.js binary (you can change the version if needed)
    os.system("curl -O https://nodejs.org/dist/v22.6.0/node-v22.6.0-linux-x64.tar.xz --silent")
    
    # Extract Node.js
    os.system("tar -xf node-v22.6.0-linux-x64.tar.xz --no-same-owner")
    
    # Add Node.js to the PATH for the current notebook session
    node_bin_path = os.path.abspath("node-v22.6.0-linux-x64/bin")
    os.environ['PATH'] = node_bin_path + ":" + os.environ['PATH']
    print(f"Node.js installed to {node_bin_path}")

    # Verify installation
    node_version = subprocess.check_output(["node", "--version"]).decode().strip()
    print(f"Node.js version: {node_version}")

def install_yarn():
    print("Installing Yarn...")
    # Install Yarn via script
    os.system("curl -o- -L https://yarnpkg.com/install.sh | bash")
    
    # Add Yarn to the PATH for the current notebook session
    yarn_bin_path = os.path.expanduser("~/.yarn/bin")
    os.environ['PATH'] = yarn_bin_path + ":" + os.environ['PATH']
    print(f"Yarn installed to {yarn_bin_path}")

    # Verify installation
    yarn_version = subprocess.check_output(["yarn", "--version"]).decode().strip()
    print(f"Yarn version: {yarn_version}")

# Run the check and installation process
check_node_yarn()
```

## Uninstall

To remove the extension, execute:

```bash
pip uninstall trelis
```

## Contributing (Private)

### Development install

Note: You will need NodeJS to build the extension package.

The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.

First:
```
conda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=4 nodejs=20 git copier=9 jinja2-time
```
then:
```
conda activate jupyterlab-ext
```

Or just:
```
cd trelis-jupyter-assistant
python -m venv jupyterlab-ext
source jupyterlab-ext/bin/activate
```
Then:
```
Then, run:
```
npm install -g yarn
yarn install
pip install -ve .
jupyter labextension develop --overwrite .
pip install jupyterlab
jlpm
jlpm build
jlpm watch
```
This will watch the source directory and allow you to run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

```bash
jupyter lab build --minimize=False
```

### Development uninstall

```bash
pip uninstall trelis
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `trelis-jupyter-assistant` within that folder.

### Testing the extension

#### Frontend tests

This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.

To execute them, execute:

```sh
jlpm
jlpm test
```

#### Integration tests

This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.

More information are provided within the [ui-tests](./ui-tests/README.md) README.

### Packaging the extension

See [RELEASE](RELEASE.md)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "trelis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "jupyter, jupyterlab, jupyterlab-extension",
    "author": null,
    "author_email": "Trelis Research / Ronan McGovern <hello@trelis.com>",
    "download_url": "https://files.pythonhosted.org/packages/91/74/91c5341a21dcfb2b09992f3fa8d185b90e0389ef5d4b4e7ac79f6f260a56/trelis-1.3.0.tar.gz",
    "platform": null,
    "description": "# trelis\n\n[![Github Actions Status](https://github.com/TrelisResearch/trelis-jupyter-assistant/workflows/Build/badge.svg)](https://github.com/TrelisResearch/trelis-jupyter-assistant/actions/workflows/build.yml)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/TrelisResearch/trelis-jupyter-assistant/main?urlpath=lab)\n\n\nA JupyterLab Code Assistant\n\n## Requirements\n\n- JupyterLab >= 4.0.0\n- Node >= 22.6\n- Yarn\n\n## Install\n\nTo install the extension, execute:\n\n```bash\npip install trelis\n```\nto install with node and yarn (for example, in a remote GPU server like RunPod), first run:\n```\nimport os\nimport subprocess\n\ndef check_node_yarn():\n    # Check if Node.js is installed\n    try:\n        node_version = subprocess.check_output([\"node\", \"--version\"]).decode().strip()\n        print(f\"Node.js is installed: {node_version}\")\n    except FileNotFoundError:\n        print(\"Node.js is not installed.\")\n        install_node()\n\n    # Check if Yarn is installed\n    try:\n        yarn_version = subprocess.check_output([\"yarn\", \"--version\"]).decode().strip()\n        print(f\"Yarn is installed: {yarn_version}\")\n    except FileNotFoundError:\n        print(\"Yarn is not installed.\")\n        install_yarn()\n\ndef install_node():\n    print(\"Installing Node.js...\")\n    # Download Node.js binary (you can change the version if needed)\n    os.system(\"curl -O https://nodejs.org/dist/v22.6.0/node-v22.6.0-linux-x64.tar.xz --silent\")\n    \n    # Extract Node.js\n    os.system(\"tar -xf node-v22.6.0-linux-x64.tar.xz --no-same-owner\")\n    \n    # Add Node.js to the PATH for the current notebook session\n    node_bin_path = os.path.abspath(\"node-v22.6.0-linux-x64/bin\")\n    os.environ['PATH'] = node_bin_path + \":\" + os.environ['PATH']\n    print(f\"Node.js installed to {node_bin_path}\")\n\n    # Verify installation\n    node_version = subprocess.check_output([\"node\", \"--version\"]).decode().strip()\n    print(f\"Node.js version: {node_version}\")\n\ndef install_yarn():\n    print(\"Installing Yarn...\")\n    # Install Yarn via script\n    os.system(\"curl -o- -L https://yarnpkg.com/install.sh | bash\")\n    \n    # Add Yarn to the PATH for the current notebook session\n    yarn_bin_path = os.path.expanduser(\"~/.yarn/bin\")\n    os.environ['PATH'] = yarn_bin_path + \":\" + os.environ['PATH']\n    print(f\"Yarn installed to {yarn_bin_path}\")\n\n    # Verify installation\n    yarn_version = subprocess.check_output([\"yarn\", \"--version\"]).decode().strip()\n    print(f\"Yarn version: {yarn_version}\")\n\n# Run the check and installation process\ncheck_node_yarn()\n```\n\n## Uninstall\n\nTo remove the extension, execute:\n\n```bash\npip uninstall trelis\n```\n\n## Contributing (Private)\n\n### Development install\n\nNote: You will need NodeJS to build the extension package.\n\nThe `jlpm` command is JupyterLab's pinned version of\n[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use\n`yarn` or `npm` in lieu of `jlpm` below.\n\nFirst:\n```\nconda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=4 nodejs=20 git copier=9 jinja2-time\n```\nthen:\n```\nconda activate jupyterlab-ext\n```\n\nOr just:\n```\ncd trelis-jupyter-assistant\npython -m venv jupyterlab-ext\nsource jupyterlab-ext/bin/activate\n```\nThen:\n```\nThen, run:\n```\nnpm install -g yarn\nyarn install\npip install -ve .\njupyter labextension develop --overwrite .\npip install jupyterlab\njlpm\njlpm build\njlpm watch\n```\nThis will watch the source directory and allow you to run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.\n\n```bash\n# Watch the source directory in one terminal, automatically rebuilding when needed\njlpm watch\n# Run JupyterLab in another terminal\njupyter lab\n```\n\nWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).\n\nBy default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:\n\n```bash\njupyter lab build --minimize=False\n```\n\n### Development uninstall\n\n```bash\npip uninstall trelis\n```\n\nIn development mode, you will also need to remove the symlink created by `jupyter labextension develop`\ncommand. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`\nfolder is located. Then you can remove the symlink named `trelis-jupyter-assistant` within that folder.\n\n### Testing the extension\n\n#### Frontend tests\n\nThis extension is using [Jest](https://jestjs.io/) for JavaScript code testing.\n\nTo execute them, execute:\n\n```sh\njlpm\njlpm test\n```\n\n#### Integration tests\n\nThis extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).\nMore precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.\n\nMore information are provided within the [ui-tests](./ui-tests/README.md) README.\n\n### Packaging the extension\n\nSee [RELEASE](RELEASE.md)\n",
    "bugtrack_url": null,
    "license": "Trelis Assistant for Jupyter Lab - Proprietary License  Copyright (c) 2024 Trelis LTD All rights reserved.  This software and associated documentation files (the \"Software\") are proprietary and confidential to Trelis LTD (Company Registration: 705524, VAT: 3808855SH). Access to and use of this Software is governed by the Trelis Terms of Service (available at trelis.com/terms-of-service/) and the following conditions:  1. The Software may only be used in conjunction with valid API credentials obtained through jupyter.trelis.com.  2. You may not modify, merge, publish, distribute, sublicense, reverse engineer, or sell copies of the Software.  3. Use of the Software is subject to the warranty and liability terms outlined in the Trelis Terms of Service (trelis.com/terms-of-service/).  4. This license does not grant you any rights to use Trelis LTD's name, logo, or trademarks.  5. Trelis LTD reserves the right to modify these license terms at any time.  For complete terms of use, including API usage limits and service tiers, please refer to trelis.com/terms-of-service/",
    "summary": "A JupyterLab Code Assistant",
    "version": "1.3.0",
    "project_urls": {
        "Bug Tracker": "https://trelis.com/jupyter-assistant",
        "Homepage": "https://trelis.com/jupyter-assistant",
        "Repository": "https://github.com/TrelisResearch/trelis-jupyter-assistant.git"
    },
    "split_keywords": [
        "jupyter",
        " jupyterlab",
        " jupyterlab-extension"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b0a33f8cde4f7aa685924e597c40b15a332722370a686a3e4e3497d5e8525a84",
                "md5": "dfb02652df86a5359037e2a3fd01a2ff",
                "sha256": "e90d379c1204900998c3747e728fb2c94258662dc0c116e20f03e16b63c7273a"
            },
            "downloads": -1,
            "filename": "trelis-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dfb02652df86a5359037e2a3fd01a2ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 26676,
            "upload_time": "2024-10-31T11:05:15",
            "upload_time_iso_8601": "2024-10-31T11:05:15.500989Z",
            "url": "https://files.pythonhosted.org/packages/b0/a3/3f8cde4f7aa685924e597c40b15a332722370a686a3e4e3497d5e8525a84/trelis-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "917491c5341a21dcfb2b09992f3fa8d185b90e0389ef5d4b4e7ac79f6f260a56",
                "md5": "43100c4fa27392b0fa7ebe0dc30d0f76",
                "sha256": "dacfadce08ed42928e9fdec172b170cc02249344e84b8fefb726f90a3c92b643"
            },
            "downloads": -1,
            "filename": "trelis-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "43100c4fa27392b0fa7ebe0dc30d0f76",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 170872,
            "upload_time": "2024-10-31T11:05:18",
            "upload_time_iso_8601": "2024-10-31T11:05:18.780530Z",
            "url": "https://files.pythonhosted.org/packages/91/74/91c5341a21dcfb2b09992f3fa8d185b90e0389ef5d4b4e7ac79f6f260a56/trelis-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-31 11:05:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TrelisResearch",
    "github_project": "trelis-jupyter-assistant",
    "github_not_found": true,
    "lcname": "trelis"
}
        
Elapsed time: 4.34183s