-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1328 from mito-ds/dev
Release Mito-AI 0.1
- Loading branch information
Showing
73 changed files
with
25,981 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Deploy - Mito AI | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
- main | ||
|
||
jobs: | ||
deploy-mito-ai: | ||
name: Deploy mito-ai | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: [3.11] | ||
steps: | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ steps.extract_branch.outputs.branch }} | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Setup Auth for PyPi | ||
run: | | ||
echo -e "[distutils]" >> ~/.pypirc | ||
echo -e "index-servers =" >> ~/.pypirc | ||
echo -e " pypi" >> ~/.pypirc | ||
echo -e " testpypi" >> ~/.pypirc | ||
echo -e "[pypi]" >> ~/.pypirc | ||
echo -e "repository = https://upload.pypi.org/legacy/" >> ~/.pypirc | ||
echo -e "username = __token__" >> ~/.pypirc | ||
echo -e "password = ${{ secrets.PYPI_API_TOKEN }}" >> ~/.pypirc | ||
echo -e "" >> ~/.pypirc | ||
echo -e "[testpypi]" >> ~/.pypirc | ||
echo -e "repository = https://test.pypi.org/legacy/" >> ~/.pypirc | ||
echo -e "username = __token__" >> ~/.pypirc | ||
echo -e "password = ${{ secrets.TEST_PYPI_API_TOKEN }}" >> ~/.pypirc | ||
- name: Setup mito-ai | ||
run: | | ||
cd mito-ai | ||
rm -rf venv | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
python -m pip install --upgrade pip setuptools wheel | ||
python ../deployment/bump_version.py mito-ai ${{ steps.extract_branch.outputs.branch }} | ||
python -m pip install -e ".[deploy]" --verbose | ||
python -m pip check | ||
jlpm install | ||
jlpm run build | ||
- name: Deploy mito-ai | ||
run: | | ||
cd mito-ai | ||
source venv/bin/activate | ||
python ../deployment/deploy.py ${{ steps.extract_branch.outputs.branch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY | ||
_commit: v4.3.5 | ||
_src_path: https://github.com/jupyterlab/extension-template | ||
author_email: aaron@sagacollab.com | ||
author_name: AI-Chat | ||
has_binder: false | ||
has_settings: false | ||
kind: frontend | ||
labextension_name: ai-chat | ||
project_short_description: AI chat for JupyterLab | ||
python_name: ai_chat | ||
repository: '' | ||
test: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
*.bundle.* | ||
lib/ | ||
node_modules/ | ||
*.log | ||
.eslintcache | ||
.stylelintcache | ||
*.egg-info/ | ||
.ipynb_checkpoints | ||
*.tsbuildinfo | ||
mito-ai/labextension | ||
|
||
# Integration tests | ||
ui-tests/test-results/ | ||
ui-tests/playwright-report/ | ||
|
||
# Created by https://www.gitignore.io/api/python | ||
# Edit at https://www.gitignore.io/?templates=python | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage/ | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# End of https://www.gitignore.io/api/python | ||
|
||
# OSX files | ||
.DS_Store | ||
|
||
# Yarn cache | ||
.yarn/ | ||
|
||
# Secrets | ||
.env | ||
secrets.tsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
**/node_modules | ||
**/lib | ||
**/package.json | ||
!/package.json | ||
mito-ai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Copyright (c) 2020-2024 Saga Inc. | ||
|
||
See the LICENSE.txt file at the root of this monorepo for licensing information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# mito_ai | ||
|
||
[![Github Actions Status](/workflows/Build/badge.svg)](/actions/workflows/build.yml) | ||
|
||
AI chat for JupyterLab. This codebase contains two main components: | ||
1. A Jupyter server extension that handles the backend logic for the chat. | ||
2. Several JupyterLab extensions that handle the frontend logic for interacting with the AI, including the chat sidebar and the error message rendermime. | ||
|
||
## Requirements | ||
|
||
- JupyterLab >= 4.0.0 | ||
|
||
## Install | ||
|
||
To install the extension, execute: | ||
|
||
```bash | ||
pip install mito-ai | ||
``` | ||
|
||
## Uninstall | ||
|
||
To remove the extension, execute: | ||
|
||
```bash | ||
pip uninstall mito-ai | ||
``` | ||
|
||
## Contributing | ||
|
||
### Development install | ||
|
||
To ensure consistent package management, please use `jlpm` instead of `npm` for this project. | ||
|
||
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. | ||
|
||
```bash | ||
# Clone the repo to your local environment | ||
# Change directory to the mito-ai directory | ||
|
||
# Required to deal with Yarn 3 workspace rules | ||
touch yarn.lock | ||
|
||
# Install package in development mode | ||
pip install -e ".[test, deploy]" | ||
|
||
# Install the node modules | ||
jlpm install | ||
|
||
# Link your development version of the extension with JupyterLab | ||
jupyter labextension develop . --overwrite | ||
|
||
# Start the jupyter server extension for development | ||
jupyter server extension enable --py mito-ai | ||
|
||
# Rebuild extension Typescript source after making changes | ||
# In case of Error: If this command fails because the lib directory was not created (the error will say something like | ||
# unable to find main entry point) then run `jlpm run clean:lib` first to get rid of the old buildcache | ||
# that might be preventing a new lib directory from getting created. | ||
jlpm build | ||
``` | ||
|
||
You can watch the source directory and 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 mito-ai | ||
``` | ||
|
||
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 `mito-ai` 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) |
Oops, something went wrong.