diff --git a/.gitignore b/.gitignore index e05d4c22..396b0deb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ jupyternotebook/visualpython colab/visualpython test/ .gitignore +visualpython/js/com/com_Config.js diff --git a/build.sh b/build.sh index 6aa7c9e7..d71b2bc5 100755 --- a/build.sh +++ b/build.sh @@ -11,8 +11,8 @@ #============================================================================= # Set version and replace it #============================================================================= -VP_ORG_VER=2.4.0 -VP_NEW_VER=2.4.1 +VP_ORG_VER=2.4.2 +VP_NEW_VER=2.4.3 # update version info grep -REil "VP_ORG_VER=.+$" colab/build.colab.sh jupyterlab/build.jupyterlab.sh jupyternotebook/build.jupyternotebook.sh | xargs sed -i "s/VP_ORG_VER=.\+$/VP_ORG_VER=${VP_ORG_VER}/g" diff --git a/colab/build.colab.sh b/colab/build.colab.sh index 0d2949c7..57471d46 100755 --- a/colab/build.colab.sh +++ b/colab/build.colab.sh @@ -11,8 +11,8 @@ #============================================================================= # Replace Version #============================================================================= -VP_ORG_VER=2.4.0 -VP_NEW_VER=2.4.1 +VP_ORG_VER=2.4.2 +VP_NEW_VER=2.4.3 # update version info # update manifest version with new numbering for new version diff --git a/colab/manifest.json b/colab/manifest.json index 37b5a86b..dcbc487d 100644 --- a/colab/manifest.json +++ b/colab/manifest.json @@ -1,7 +1,7 @@ { "name": "Visual Python for Colab", "description": "GUI-based Python code generator for Google Colab as an extension", - "version": "2.4.1", + "version": "2.4.3", "manifest_version": 3, "icons": { "48": "icon.png", diff --git a/jupyterlab/.jupyterlite.doit.db b/jupyterlab/.jupyterlite.doit.db index 54f9b6a8..e60d75e0 100644 Binary files a/jupyterlab/.jupyterlite.doit.db and b/jupyterlab/.jupyterlite.doit.db differ diff --git a/jupyterlab/build.jupyterlab.sh b/jupyterlab/build.jupyterlab.sh index 3b56420d..a477fb99 100755 --- a/jupyterlab/build.jupyterlab.sh +++ b/jupyterlab/build.jupyterlab.sh @@ -11,8 +11,8 @@ #============================================================================= # Replace Version and Basic Files #============================================================================= -VP_ORG_VER=2.4.0 -VP_NEW_VER=2.4.1 +VP_ORG_VER=2.4.2 +VP_NEW_VER=2.4.3 # update version info grep -REil "\"version\": \"${VP_ORG_VER}\"" package.json | xargs sed -i "s/\"version\": \"${VP_ORG_VER//\./\\.}\"/\"version\": \"${VP_NEW_VER}\"/g" diff --git a/jupyterlab/package-lock.json b/jupyterlab/package-lock.json index 99412829..899cf924 100644 --- a/jupyterlab/package-lock.json +++ b/jupyterlab/package-lock.json @@ -1,12 +1,12 @@ { "name": "jupyterlab-visualpython", - "version": "2.4.0", + "version": "2.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jupyterlab-visualpython", - "version": "2.4.0", + "version": "2.4.2", "license": "GPLv3 with Visual Python special exception", "dependencies": { "@jupyterlab/cells": "^3.5.2", diff --git a/jupyterlab/package.json b/jupyterlab/package.json index 8c9823ac..be5d17d1 100644 --- a/jupyterlab/package.json +++ b/jupyterlab/package.json @@ -1,6 +1,6 @@ { "name": "jupyterlab-visualpython", - "version": "2.4.1", + "version": "2.4.3", "description": "GUI-based Python code generator for Jupyter Lab as an extension", "keywords": [ "jupyter", diff --git a/jupyterlab/pyproject.toml b/jupyterlab/pyproject.toml index df58b53e..865e3110 100644 --- a/jupyterlab/pyproject.toml +++ b/jupyterlab/pyproject.toml @@ -32,7 +32,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", ] -version = "2.4.1" +version = "2.4.3" [project.license] file = "LICENSE" @@ -92,7 +92,7 @@ file = [ ] [tool.tbump.version] -current = "2.4.1" +current = "2.4.3" regex = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)((?Pa|b|rc|.dev)(?P\\d+))?" [tool.tbump.git] diff --git a/jupyternotebook/build.jupyternotebook.sh b/jupyternotebook/build.jupyternotebook.sh index abd06aac..5c52d21d 100755 --- a/jupyternotebook/build.jupyternotebook.sh +++ b/jupyternotebook/build.jupyternotebook.sh @@ -11,8 +11,8 @@ #============================================================================= # Replace Version and Basic Files #============================================================================= -VP_ORG_VER=2.4.0 -VP_NEW_VER=2.4.1 +VP_ORG_VER=2.4.2 +VP_NEW_VER=2.4.3 # update version info grep -REil ${VP_ORG_VER//\./\\.} setup.py visualpython/js/com/com_Config.js visualpython/js/com/com_Const.js | xargs sed -i --follow-symlinks "s/${VP_ORG_VER//\./\\.}/${VP_NEW_VER}/g" diff --git a/jupyternotebook/setup.py b/jupyternotebook/setup.py index bacaaf07..cd492f04 100644 --- a/jupyternotebook/setup.py +++ b/jupyternotebook/setup.py @@ -10,7 +10,7 @@ setup( name = name, - version = '2.4.1', + version = '2.4.3', packages = find_packages(), package_data = {"": ["*"], 'visualpython' : ['visualpython.yaml', 'README.md']}, scripts = ['visualpython/bin/visualpy', 'visualpython/bin/visualpy.bat'], diff --git a/visualpython/js/com/com_Config.js b/visualpython/js/com/com_Config.js index f23a1864..09825978 100644 --- a/visualpython/js/com/com_Config.js +++ b/visualpython/js/com/com_Config.js @@ -296,6 +296,7 @@ define([ * - automatically restart on jupyter kernel restart (loadVisualpython.js) */ readKernelFunction() { + let that = this; // CHROME: change method to load py files ($.get -> require) return new Promise(function(resolve, reject) { var libraryList = [ @@ -314,7 +315,26 @@ define([ libraryList.forEach(libCode => { promiseList.push(vpKernel.execute(libCode, true)); }); - + + if (that.extensionType === 'lite') { + let preInstallCode = ''; + let preInstallPackList = [ + 'seaborn', + 'plotly', + 'scikit-learn', + 'scipy', + 'statsmodels' + ]; + preInstallPackList.forEach((packName, idx) => { + preInstallCode += '%pip install ' + packName + if (idx < preInstallPackList.length - 1) { + preInstallCode += '\n'; + } + }); + // pre-install packages + promiseList.push(vpKernel.execute(preInstallCode, true)); + } + // run all promises let failed = false; Promise.all(promiseList).then(function(resultObj) { @@ -918,7 +938,7 @@ define([ '- Save VP Note before refreshing the page.' ]; com_interface.insertCell('markdown', info.join('\n')); - com_interface.insertCell('code', "import piplite\npiplite.install('jupyterlab-visualpython==" + latestVersion + "')"); + com_interface.insertCell('code', "%pip install jupyterlab-visualpython==" + latestVersion); } // update version_timestamp @@ -991,7 +1011,7 @@ define([ /** * Version */ - Config.version = "2.4.1"; + Config.version = "2.4.3"; /** * Type of mode diff --git a/visualpython/js/com/com_Const.js b/visualpython/js/com/com_Const.js index 639a58ce..7a936711 100644 --- a/visualpython/js/com/com_Const.js +++ b/visualpython/js/com/com_Const.js @@ -19,7 +19,7 @@ define ([ class Constants { } Constants.TOOLBAR_BTN_INFO = { - HELP: "Visual Python 2.4.1" + HELP: "Visual Python 2.4.3" , ICON: "vp-main-icon" , ID: "vpBtnToggle" , NAME: "toggle-vp" diff --git a/visualpython/js/com/com_interface.js b/visualpython/js/com/com_interface.js index 7742a29c..5a80ca98 100644 --- a/visualpython/js/com/com_interface.js +++ b/visualpython/js/com/com_interface.js @@ -240,7 +240,7 @@ define([ }, 300); } } - } else if (vpConfig.extensionType === 'lab') { + } else if (vpConfig.extensionType === 'lab' || vpConfig.extensionType === 'lite') { if (notebookPanel && notebookPanel.sessionContext){ var sessionContext = notebookPanel.sessionContext; let sessionType = sessionContext.type; diff --git a/visualpython/js/com/component/PackageManager.js b/visualpython/js/com/component/PackageManager.js index f98af4f3..95b7cb5f 100644 --- a/visualpython/js/com/component/PackageManager.js +++ b/visualpython/js/com/component/PackageManager.js @@ -64,6 +64,28 @@ define([ 'PyMuPDF': { pipName: 'PyMuPDF' }, 'sweetviz': { pipName: 'sweetviz' }, } + + if (vpConfig.extensionType === 'lite') { + this.packageLibTemplate = { + 'numpy': { pipName: 'numpy' }, + 'pandas': { pipName: 'pandas' }, + 'matplotlib': { pipName: 'matplotlib' }, + 'seaborn': { pipName: 'seaborn' }, + 'plotly': { pipName: 'plotly' }, + 'sklearn': { pipName: 'scikit-learn' }, + 'scikit-posthocs': { pipName: 'scikit-posthocs' }, + 'scipy': { pipName: 'scipy' }, + 'statsmodels': { pipName: 'statsmodels' }, + 'factor-analyzer': { pipName: 'factor-analyzer' }, + 'category_encoders': { pipName: 'category_encoders' }, + 'imblearn': { pipName: 'imblearn' }, + 'xgboost': { pipName: 'xgboost' }, + 'lightgbm': { pipName: 'lightgbm' }, + 'catboost': { pipName: 'catboost' }, + 'auto-sklearn': { pipName: 'auto-sklearn' }, + 'sweetviz': { pipName: 'sweetviz' }, + } + } } _bindEvent() { @@ -148,7 +170,7 @@ define([ var pipName = that.packageLib[key].pipName; var code = com_util.formatString("!pip uninstall -y {0}", pipName); if (vpConfig.extensionType === 'lite') { - code = com_util.formatString("import piplite\npiplite.uninstall('{0}')", pipName); + code = com_util.formatString("%pip uninstall {0}", pipName); } // create block and run it $('#vp_wrapper').trigger({ @@ -162,7 +184,7 @@ define([ var pipName = that.packageLib[key].pipName; var code = com_util.formatString("!pip install --upgrade {0}", pipName); if (vpConfig.extensionType === 'lite') { - code = com_util.formatString("%pip install --upgrade {0}", pipName); + code = com_util.formatString("%pip install {0}", pipName); } // create block and run it $('#vp_wrapper').trigger({ @@ -269,7 +291,7 @@ define([ var pipName = this.packageLib[this.state.selected].pipName; var code = com_util.formatString("!pip install {0}", pipName); if (vpConfig.extensionType === 'lite') { - code = com_util.formatString("import piplite\npiplite.install('{0}')", pipName); + code = com_util.formatString("%pip install {0}", pipName); } if (versionType === 'specified') { // specified version @@ -277,7 +299,7 @@ define([ if (version && version !== '') { code = com_util.formatString("!pip install {0}=={1}", pipName, version); if (vpConfig.extensionType === 'lite') { - code = com_util.formatString("import piplite\npiplite.install('{0}=={1}')", pipName, version); + code = com_util.formatString("%pip install {0}=={1}", pipName, version); } } else { $(this.wrapSelector('.vp-inner-popup-version')).focus(); diff --git a/visualpython/js/m_apps/Frame.js b/visualpython/js/m_apps/Frame.js index 0bff2c10..a07f7299 100644 --- a/visualpython/js/m_apps/Frame.js +++ b/visualpython/js/m_apps/Frame.js @@ -240,7 +240,7 @@ define([ that.setPreview(that.getCurrentCode()); }); - // menu on column (Deprecated on v2.3.6 - Temporarily Show on v.2.4.1) + // menu on column (Deprecated on v2.3.6 - Temporarily Show on v.2.4.3) $(document).on('contextmenu', this.wrapSelector('.' + VP_FE_TABLE + ' .' + VP_FE_TABLE_COLUMN), function(event) { event.preventDefault(); @@ -270,7 +270,7 @@ define([ that.showMenu(thisPos.left, thisPos.top + thisRect.height); }); - // menu on row (Deprecated on v2.3.6 - Temporarily Show on v.2.4.1) + // menu on row (Deprecated on v2.3.6 - Temporarily Show on v.2.4.3) $(document).on('contextmenu', this.wrapSelector('.' + VP_FE_TABLE + ' .' + VP_FE_TABLE_ROW), function(event) { event.preventDefault(); var idx = $(that.wrapSelector('.' + VP_FE_TABLE_ROW)).index(this); // 0 ~ n @@ -595,7 +595,7 @@ define([ that.loadCode(that.getTypeCode(FRAME_EDIT_TYPE.SHOW), true); }); - // click toolbar item (Deprecated on v2.3.6 - Temporarily Show on v.2.4.1) + // click toolbar item (Deprecated on v2.3.6 - Temporarily Show on v.2.4.3) $(document).on('click', this.wrapSelector('.vp-fe-toolbar-item'), function(evt) { evt.stopPropagation(); var itemType = $(this).data('type'); diff --git a/visualpython/js/m_apps/PDF.js b/visualpython/js/m_apps/PDF.js index c4ea125b..e5fdf2ce 100644 --- a/visualpython/js/m_apps/PDF.js +++ b/visualpython/js/m_apps/PDF.js @@ -21,9 +21,9 @@ define([ 'vp_base/js/com/component/FileNavigation' ], function(pdfHtml, pdfCss, com_String, com_interface, PopupComponent, FileNavigation) { - const PDF_SHOW = '!pip show PyMuPDF nltk' - const PDF_INSTALL1 = '!pip install PyMuPDF' - const PDF_INSTALL2 = '!pip install nltk' + var PDF_SHOW = '!pip show PyMuPDF nltk' + var PDF_INSTALL1 = '!pip install PyMuPDF' + var PDF_INSTALL2 = '!pip install nltk' const PDF_IMPORT = `import pandas as pd import fitz @@ -80,6 +80,12 @@ nltk.download('punkt')`; vp_pdfReturn: '', ...this.state } + + if (vpConfig.extensionType === 'lite') { + PDF_SHOW = PDF_SHOW.replace('!', '%'); + PDF_INSTALL1 = PDF_INSTALL1.replace('!', '%'); + PDF_INSTALL2 = PDF_INSTALL2.replace('!', '%'); + } } _bindEvent() { diff --git a/visualpython/js/m_stats/Anova.js b/visualpython/js/m_stats/Anova.js index 9edc8752..191ed0f7 100644 --- a/visualpython/js/m_stats/Anova.js +++ b/visualpython/js/m_stats/Anova.js @@ -252,7 +252,11 @@ define([ } if (tukey === true || scheffe === true || duncan === true) { - codeList.push("!pip install scikit-posthocs"); + if (vpConfig.extensionType === 'lite') { + codeList.push("%pip install scikit-posthocs"); + } else { + codeList.push("!pip install scikit-posthocs"); + } // Post hoc analysis - Tukey if (tukey === true) { @@ -379,7 +383,11 @@ define([ } if (tukey === true || scheffe === true || duncan === true) { // Add installation code - codeList.push("!pip install scikit-posthocs"); + if (vpConfig.extensionType === 'lite') { + codeList.push("%pip install scikit-posthocs"); + } else { + codeList.push("!pip install scikit-posthocs"); + } // Post hoc analysis - Tukey if (tukey === true) { @@ -445,7 +453,11 @@ define([ } // Add installation code : # pip install pingouin - codeList.push("!pip install pingouin"); + if (vpConfig.extensionType === 'lite') { + codeList.push("%pip install pingouin"); + } else { + codeList.push("!pip install pingouin"); + } code.appendLine(); code.appendLine(); diff --git a/visualpython/js/m_stats/FactorAnalysis.js b/visualpython/js/m_stats/FactorAnalysis.js index c9bcb1e0..45b26abf 100644 --- a/visualpython/js/m_stats/FactorAnalysis.js +++ b/visualpython/js/m_stats/FactorAnalysis.js @@ -167,6 +167,13 @@ define([ let codeList = []; let code = new com_String(); + // Add installation code FIXME: + if (vpConfig.extensionType === 'lite') { + codeList.push('%pip install factor-analyzer'); + } else { + codeList.push('!pip install factor-analyzer'); + } + // data declaration code.appendFormat("vp_df = {0}", data); if (this.columnSelector) {