From 3beae6f77f7e017a1e47bd428892c29818562f50 Mon Sep 17 00:00:00 2001 From: "blacklogic.dev" Date: Fri, 7 May 2021 01:31:36 +0900 Subject: [PATCH] fixed : visuapy controller issue & deploy Visual Python 1.1.1 --- README.md | 166 +++++------ bin/visualpy.bat | 498 ++++++++++++++++---------------- src/api_block/blockContainer.js | 2 +- src/api_block/index.html | 2 +- src/common/constant.js | 4 +- 5 files changed, 319 insertions(+), 353 deletions(-) diff --git a/README.md b/README.md index bab3d714..934764c3 100644 --- a/README.md +++ b/README.md @@ -1,112 +1,78 @@ -# Visual Python +# 1. Install Package ( windows / Linux / Mac ) +### 1.1. requirements +> - Python 3.x +> - jupyter notebook or anaconda env
+> _pip install jupyter_
+> or
+> _python -m pip install --user jupyter_
+> +> _pip3 install jupyter_
+> or
+> _python3 -m pip install --user jupyter_
+ +### 1.2. Install VisualPython package +> **[pip / conda]**
+> _pip install visualpython_ + +### 1.3. Optional package +* jupyter_contrib_nbextensions
+* Install to manage nbtextensions visually. +>> **[pip]**
+>> _pip install jupyter_contrib_nbextensions
_ + _jupyter contrib nbextension install --user_
+>> **[conda - anaconda env]**
+> _conda install -c conda-forge jupyter_contrib_nbextensions_
+ _jupyter contrib nbextension install --user_ + +# 2. Package controller for Linux/Mac/Windows +### 2.1. VisualPython contoller info + +> **usage: _visualpy [option]_**
-[![PyPI version shields.io](https://img.shields.io/pypi/v/visualpython)](https://pypi.python.org/pypi/visualpython/) -[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-green)](https://www.gnu.org/licenses/gpl-3.0.html) -[![Website: VP Hub](https://img.shields.io/badge/Website-VP%20Hub-orange)](https://www.visualpython.ai) - - -
- -## Introduction -Visual Python is a GUI-based Python code generator, developed on the Jupyter Notebook environment as an extension. -
- -1. Key Features -* Automatically generates Python code based on a graphic user interface
-* Creates code blocks by tasks (such as data processing, visualization)
-* You can save the analysis process and share it (as .vp file) with others
- -2. Who and What is it for?
-Visual Python is a data analytics solution for both Programmers & Non-programmers.
- -Programmers can use the tool :
-* to save & reuse user-defined (or repeatedly used) code
-* to find Python packages and functions from the list
- -Non-programmers will be able to :
-* learn the Python language more easily
-* manage big data with minimal coding skills
- -
- -## Getting Started - -### 1. Requirements - -Visual Python is developed as an extension on Jupyter Notebook.
-We recommend installing Anaconda (virtual environment). - -- Python version 3.x -- Jupyter notebook or Anaconda env
- -### 2. How to Install - -**1) Open Anaconda prompt** - -* Windows : Click Start > Search or Select 'Anaconda Prompt'
-* Mac : Open Launchpad > Select 'Terminal' - -**2) Install package from** -``` -pip install visualpython -``` -
- -Depending on your virtual environment settings, you may need to install Jupyter Extensions.
-To install Jupyter Extension, use commands either: ``` -pip install jupyter_contrib_nbextensions + optional arguments: + -h, help - show this help message and exit + -e, enable - enable VisualPython + -d, disable - disable VisualPython + -i, install - install VisualPython extensions + -un, uninstall - uninstall VisualPython packages + -up, upgrade - upgrade VisualPython Package + -v, version - show VisualPython current version ``` -or
-``` -conda install -c conda-forge jupyter_contrib_nbextensions -``` - -**3) Enable the package** -``` -visualpy install -``` - -**4) Activate Visual Python on Jupyter Notebook** - -Click orange square button on the right side of the Jupyter Notebook menu.
- -### 3. Package Control Info -* Usage: visualpy **[option]**
-* Optional arguments: - -``` -help - show help menu -uninstall - uninstall packages -upgrade - version upgrade -version - version check -``` -
- -## Mission & Vision - - -**Mission**
-To support technology and education so that anyone can leverage big data analytics to create a variety of social values. - -**Vision**
-To create an environment where you can learn and use big data analytics skills easily. - - -
- -## License -GNU GPLv3 (See LICENSE file). +### 2.2. Activate VisualPython +> _visualpy install_
+> or
+> _visualpy -i_ + +### 2.3. Disable VisualPython +> _visualpy disable_
+> or
+> _visualpy -d_ + +### 2.4. Enable VisualPython extension +> _visualpy enable_
+> or
+> _visualpy -e_ + +### 2.5. Upgrade VisualPython package version +> _visualpy upgrade_
+> or
+> _visualpy -up_ + +### 2.6. Uninstall VisualPython package +> _visualpy uninstall_
+> or
+> _visualpy -un_ diff --git a/bin/visualpy.bat b/bin/visualpy.bat index 651ecb95..79bfa0d8 100644 --- a/bin/visualpy.bat +++ b/bin/visualpy.bat @@ -1,250 +1,250 @@ -@echo off -SetLocal -rem #========================================================================== -rem # Filename : visualpy.bat -rem # function : control Visual Python for windows -rem # Creator : BlackLogic - LJ -rem # version : 2.1 -rem # License : GPLv3 -rem # Date : 2020 07.30 -rem # MDate : 2020 12.29 -rem #========================================================================== - -rem ## setting variables - -set v_prod=visualpython -(echo "%v_prod%" & echo.) | findstr /O . | more +1 | (set /P RESULT= & call exit /B %%RESULT%%) -set /A v_prd_length=%ERRORLEVEL%-5 -set v_option=%1 -for /f "delims=, tokens=1*" %%i in ('pip show %v_prod% 2^>^&1 ^| find "Location"') do ( -set v_1=%%i) -set v_path1=%v_1:~10% -set v_str1=jupyter nbextension -set v_str2=%v_prod%/src/main -set v_srch=pip search %v_prod% -set v_upgr=pip install %v_prod% --upgrade -set v_unst=pip uninstall %v_prod% -set v_ckup=pip list -o -set v_show=pip show %v_prod% - -rem check env & setting path2 -where /q conda-env -IF ERRORLEVEL 1 ( - call :l_prt_be_line - ECHO Not a conda env. - set v_path2=%APPDATA%\jupyter\nbextensions\ -) ELSE ( - call :l_prt_be_line - ECHO conda env. - set v_path2=%v_path1:~,-18%\share\jupyter\nbextensions\ -) - -rem ## Main Block -:l_main - IF /i "%v_option%"=="" goto :l_help - - for %%i in (-h help) do if /i %v_option% == %%i call :l_help - for %%i in (-e enable) do if /i %v_option% == %%i call :l_enable - for %%i in (-d disable) do if /i %v_option% == %%i call :l_disable - for %%i in (-i install) do if /i %v_option% == %%i call :l_install - for %%i in (-up upgrade) do if /i %v_option% == %%i call :l_upgrade - for %%i in (-v version) do if /i %v_option% == %%i call :l_version - for %%i in (-ce checkext) do if /i %v_option% == %%i call :l_check_extension - for %%i in (-cb checkbpl) do if /i %v_option% == %%i call :l_check_visualpython - for %%i in (-un uninstall) do if /i %v_option% == %%i goto :l_uninstall - goto :eof - -rem ## Function Block -:l_help - echo. - echo usage: visualpy option - echo optional arguments: - echo -h, help show this help message and exit - echo -e, enable enable Visual Python - echo -d, disable disable Visual Python - echo -i, install install Visual Python extensions - echo -un, uninstall uninstall Visual Python packages - echo -up, upgrade upgrade Visual Python Package - echo -v, version show Visual Python current version - echo. - goto :eof - -:l_check_extension - IF NOT EXIST "%v_path2%" call :l_prt_extensiondir - goto :eof - -:l_check_visualpython - IF EXIST "%v_path2%%v_prod%" ( - set v_flag=1 - ) ELSE ( - set v_flag=2 - ) - goto :eof - -:l_install - rem "" is for envname with space. - IF EXIST "%v_path2%%v_prod%" ( call :l_prt_be_line - echo Check installed %v_prod% Path : - echo %v_path2%%v_prod% - call :l_prt_visualpythondir - call :l_overwrite - ) ELSE ( call :l_copy_files - call :l_enable - ) - goto :eof - -:l_enable - call :l_prt_be_line - %v_str1% enable %v_str2% - call :l_prt_af_line - goto :eof - -:l_disable - call :l_prt_af_line - %v_str1% disable %v_str2% - call :l_prt_af_line - goto :eof - -:l_overwrite - rem if visaulpython 없는경우 install로 수행 - rem else remove & install - call :l_disable - call :l_remove_files - call :l_copy_files - call :l_enable - goto :eof - -:l_copy_files - call :l_prt_be_line - echo source : %v_path1%\%v_prod%\ - rem "" is for envname with space. - xcopy /q /y /e "%v_path1%\%v_prod%" "%v_path2%%v_prod%\" - echo target : %v_path2%%v_prod%\ - call :l_prt_af_line - goto :eof - -:l_remove_files - call :l_prt_be_line - echo Remove Visual Python Directories. - rem "" is for envname with space. - rmdir /s /q "%v_path2%%v_prod%" - call :l_prt_af_line - goto :eof - -:l_upgrade - call :l_prt_af_line - echo Running upgrade visualpython. - call :l_prt_af_line - rem setting current version - for /f "tokens=*" %%i in ( '%v_show% 2^>^&1 ^| findstr /i Version') do ( - set v_currentver=%%i - ) - - rem running version upgrade - %v_upgr% - - rem setting last installed version - for /f "tokens=*" %%i in ( '%v_show% 2^>^&1 ^| findstr /i Version') do ( - set v_lastver=%%i - ) - set v_install= Installed %v_currentver% - set v_last=Last Release %v_lastver% - - call :l_prt_af_line - - if not %v_lastver:~9% == %v_currentver:~9% ( - echo change visualpython extension files ... - call :l_disable - call :l_copy_files - call :l_enable - ) else ( - echo Already installed last Visual Python version. - call :l_print_version - ) - goto :eof - -:l_version - rem call :l_prt_be_line - - for /f "tokens=*" %%i in ('%v_ckup% 2^>^&1 ^| find /i "%v_prod%"') do ( set v_info=%%i ) - - if "%v_info%."=="." ( - rem pass upgrade - for /f "tokens=*" %%i in ( '%v_show% 2^>^&1 ^| findstr /i Version') do ( set v_last=%%i - - set v_last=Last Release %%i - set v_install= Installed %%i - set v_ver_flag=0 - ) - ) else ( - rem run upgrade - for /f "tokens=2-3" %%i in ( 'echo %v_info%' ) do ( - rem echo Last release Version : %%j - rem echo Installed Version : %%i - set v_install= Installed Version: %%i - set v_last=Last Release Version: %%j - set v_ver_flag=1 - ) - ) - call :l_print_version - goto :eof - -:l_print_version - call :l_prt_af_line - echo %v_install% - echo %v_last% - call :l_prt_af_line - rem echo %v_flag% - goto :eof - -:l_prt_extensiondir - call :l_prt_be_line - echo Nbextension not activated - echo Plz install nbextension - call :l_prt_af_line - goto :eof - -:l_prt_visualpythondir - call :l_prt_af_line - echo Already exists Visual Python. - goto :eof - -:l_prt_notexists_visualpythondir - call :l_prt_be_line - echo Visual Python extension not installed. - call :l_prt_af_line - goto :eof - -:l_prt_be_line - echo. - echo ========================================================================================== - goto :eof - -:l_prt_af_line - echo ========================================================================================== - goto :eof - -:l_prt_line - echo ------------------------------------------------------------------------------------------ - goto :eof - - -:l_uninstall - IF EXIST "%v_path2%%v_prod%" ( - call :l_disable - call :l_remove_files - echo "%v_path2%%v_prod%" - call :l_prt_af_line - %v_unst% - ) else ( - call :l_prt_be_line - echo %v_path1:~,-18%\share\jupyter\nbextensions\ - echo %v_path2%%v_prod% - call :l_prt_af_line - %v_unst% - ) - -rem #========================================================================== -rem #End of File -rem #========================================================================== +@echo off +SetLocal +rem #========================================================================== +rem # Filename : visualpy.bat +rem # function : control Visual Python for windows +rem # Creator : BlackLogic - LJ +rem # version : 2.1 +rem # License : GPLv3 +rem # Date : 2020 07.30 +rem # MDate : 2020 12.29 +rem #========================================================================== + +rem ## setting variables + +set v_prod=visualpython +(echo "%v_prod%" & echo.) | findstr /O . | more +1 | (set /P RESULT= & call exit /B %%RESULT%%) +set /A v_prd_length=%ERRORLEVEL%-5 +set v_option=%1 +for /f "delims=, tokens=1*" %%i in ('pip show %v_prod% 2^>^&1 ^| find "Location"') do ( +set v_1=%%i) +set v_path1=%v_1:~10% +set v_str1=jupyter nbextension +set v_str2=%v_prod%/src/main +set v_srch=pip search %v_prod% +set v_upgr=pip install %v_prod% --upgrade +set v_unst=pip uninstall %v_prod% +set v_ckup=pip list -o +set v_show=pip show %v_prod% + +rem check env & setting path2 +where /q conda-env +IF ERRORLEVEL 1 ( + call :l_prt_be_line + ECHO Not a conda env. + set v_path2=%APPDATA%\jupyter\nbextensions\ +) ELSE ( + call :l_prt_be_line + ECHO conda env. + set v_path2=%v_path1:~,-18%\share\jupyter\nbextensions\ +) + +rem ## Main Block +:l_main + IF /i "%v_option%"=="" goto :l_help + + for %%i in (-h help) do if /i %v_option% == %%i call :l_help + for %%i in (-e enable) do if /i %v_option% == %%i call :l_enable + for %%i in (-d disable) do if /i %v_option% == %%i call :l_disable + for %%i in (-i install) do if /i %v_option% == %%i call :l_install + for %%i in (-up upgrade) do if /i %v_option% == %%i call :l_upgrade + for %%i in (-v version) do if /i %v_option% == %%i call :l_version + for %%i in (-ce checkext) do if /i %v_option% == %%i call :l_check_extension + for %%i in (-cb checkbpl) do if /i %v_option% == %%i call :l_check_visualpython + for %%i in (-un uninstall) do if /i %v_option% == %%i goto :l_uninstall + goto :eof + +rem ## Function Block +:l_help + echo. + echo usage: visualpy option + echo optional arguments: + echo -h, help show this help message and exit + echo -e, enable enable Visual Python + echo -d, disable disable Visual Python + echo -i, install install Visual Python extensions + echo -un, uninstall uninstall Visual Python packages + echo -up, upgrade upgrade Visual Python Package + echo -v, version show Visual Python current version + echo. + goto :eof + +:l_check_extension + IF NOT EXIST "%v_path2%" call :l_prt_extensiondir + goto :eof + +:l_check_visualpython + IF EXIST "%v_path2%%v_prod%" ( + set v_flag=1 + ) ELSE ( + set v_flag=2 + ) + goto :eof + +:l_install + rem "" is for envname with space. + IF EXIST "%v_path2%%v_prod%" ( call :l_prt_be_line + echo Check installed %v_prod% Path : + echo %v_path2%%v_prod% + call :l_prt_visualpythondir + call :l_overwrite + ) ELSE ( call :l_copy_files + call :l_enable + ) + goto :eof + +:l_enable + call :l_prt_be_line + %v_str1% enable %v_str2% + call :l_prt_af_line + goto :eof + +:l_disable + call :l_prt_af_line + %v_str1% disable %v_str2% + call :l_prt_af_line + goto :eof + +:l_overwrite + rem if visaulpython 없는경우 install로 수행 + rem else remove & install + call :l_disable + call :l_remove_files + call :l_copy_files + call :l_enable + goto :eof + +:l_copy_files + call :l_prt_be_line + echo source : %v_path1%\%v_prod%\ + rem "" is for envname with space. + xcopy /q /y /e "%v_path1%\%v_prod%" "%v_path2%%v_prod%\" + echo target : %v_path2%%v_prod%\ + call :l_prt_af_line + goto :eof + +:l_remove_files + call :l_prt_be_line + echo Remove Visual Python Directories. + rem "" is for envname with space. + rmdir /s /q "%v_path2%%v_prod%" + call :l_prt_af_line + goto :eof + +:l_upgrade + call :l_prt_af_line + echo Running upgrade visualpython. + call :l_prt_af_line + rem setting current version + for /f "tokens=*" %%i in ( '%v_show% 2^>^&1 ^| findstr /i Version') do ( + set v_currentver=%%i + ) + + rem running version upgrade + %v_upgr% + + rem setting last installed version + for /f "tokens=*" %%i in ( '%v_show% 2^>^&1 ^| findstr /i Version') do ( + set v_lastver=%%i + ) + set v_install= Installed %v_currentver% + set v_last=Last Release %v_lastver% + + call :l_prt_af_line + + if not %v_lastver:~9% == %v_currentver:~9% ( + echo change visualpython extension files ... + call :l_disable + call :l_copy_files + call :l_enable + ) else ( + echo Already installed last Visual Python version. + call :l_print_version + ) + goto :eof + +:l_version + rem call :l_prt_be_line + + for /f "tokens=*" %%i in ('%v_ckup% 2^>^&1 ^| find /i "%v_prod%"') do ( set v_info=%%i ) + + if "%v_info%."=="." ( + rem pass upgrade + for /f "tokens=*" %%i in ( '%v_show% 2^>^&1 ^| findstr /i Version') do ( set v_last=%%i + + set v_last=Last Release %%i + set v_install= Installed %%i + set v_ver_flag=0 + ) + ) else ( + rem run upgrade + for /f "tokens=2-3" %%i in ( 'echo %v_info%' ) do ( + rem echo Last release Version : %%j + rem echo Installed Version : %%i + set v_install= Installed Version: %%i + set v_last=Last Release Version: %%j + set v_ver_flag=1 + ) + ) + call :l_print_version + goto :eof + +:l_print_version + call :l_prt_af_line + echo %v_install% + echo %v_last% + call :l_prt_af_line + rem echo %v_flag% + goto :eof + +:l_prt_extensiondir + call :l_prt_be_line + echo Nbextension not activated + echo Plz install nbextension + call :l_prt_af_line + goto :eof + +:l_prt_visualpythondir + call :l_prt_af_line + echo Already exists Visual Python. + goto :eof + +:l_prt_notexists_visualpythondir + call :l_prt_be_line + echo Visual Python extension not installed. + call :l_prt_af_line + goto :eof + +:l_prt_be_line + echo. + echo ========================================================================================== + goto :eof + +:l_prt_af_line + echo ========================================================================================== + goto :eof + +:l_prt_line + echo ------------------------------------------------------------------------------------------ + goto :eof + + +:l_uninstall + IF EXIST "%v_path2%%v_prod%" ( + call :l_disable + call :l_remove_files + echo "%v_path2%%v_prod%" + call :l_prt_af_line + %v_unst% + ) else ( + call :l_prt_be_line + echo %v_path1:~,-18%\share\jupyter\nbextensions\ + echo %v_path2%%v_prod% + call :l_prt_af_line + %v_unst% + ) + +rem #========================================================================== +rem #End of File +rem #========================================================================== EndLocal \ No newline at end of file diff --git a/src/api_block/blockContainer.js b/src/api_block/blockContainer.js index 05eaedcf..4dffb13d 100644 --- a/src/api_block/blockContainer.js +++ b/src/api_block/blockContainer.js @@ -2581,7 +2581,7 @@ define([ this.hideOptionPreviewBox(); $(VP_ID_PREFIX + VP_APIBLOCK_BOARD_OPTION_PREVIEW_BUTTON).removeClass('enabled'); - this.setNavigator(BLOCK_CODELINE_TYPE.NONE, 'Visual Python 1.1.0'); + this.setNavigator(BLOCK_CODELINE_TYPE.NONE, 'Visual Python 1.1.1'); this.setFocusedPageType(FOCUSED_PAGE_TYPE.BOARD); $('.vp-apiblock-option-tab-none').css(STR_DISPLAY, STR_BLOCK); } diff --git a/src/api_block/index.html b/src/api_block/index.html index 3b1069df..26d360bd 100644 --- a/src/api_block/index.html +++ b/src/api_block/index.html @@ -107,7 +107,7 @@ id='vp_apiblock_option_page'>
- Visual Python 1.1.0 + Visual Python 1.1.1
diff --git a/src/common/constant.js b/src/common/constant.js index 04a49207..881f8259 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -48,7 +48,7 @@ define ([ * toolbar btn properties */ const TOOLBAR_BTN_INFO = { - HELP: "Visual Python 1.1.0" + HELP: "Visual Python 1.1.1" // , ICON: "fa-angellist" , ICON: "vp-main-icon" , ID: "vpBtnToggle" @@ -1328,4 +1328,4 @@ define ([ , VP_MARKDOWN_TOOBAR_BTN_HORIZONTAL_LINE: VP_MARKDOWN_TOOBAR_BTN_HORIZONTAL_LINE , VP_MARKDOWN_TOOBAR_BTN_HORIZONTAL_LINE_TITLE: VP_MARKDOWN_TOOBAR_BTN_HORIZONTAL_LINE_TITLE }; -}); \ No newline at end of file +});