Skip to content

Release v2.3.0 (Integrated version of all extension environments) #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9fea57b
CHROME: removed .css extension type
Aug 10, 2022
abb7029
CHROME: add lib files(codemirror, jquery, require)
Aug 10, 2022
0897314
CHROME: change Jupyter api to colab api
Aug 10, 2022
feba20d
CHROME: fixed image paths of html and js file
Aug 10, 2022
c154b51
CHROME: added parentSelector for popup and file navigation
Aug 10, 2022
a598153
CHROME: added codemirror ipython mode and some missing codes
Aug 10, 2022
9dd0291
CHROME: fixed image path
Aug 10, 2022
2a92ede
CHROME: Fixed style
Aug 10, 2022
e9181b4
CHROME: Fixed image path on FileNavigation
Aug 10, 2022
2b6c4ec
CHROME: Fixed sample data path on File app by using github raw url
Aug 10, 2022
0c91b7c
CHROME: Fixed api to insert cells
Aug 10, 2022
36348e8
CHROME: Added marked and mathjaxutils for Markdown
Aug 10, 2022
fab72b0
Update for colab 2.2.12.4
Sep 27, 2022
9811c3b
Merge pull request #188 from minjk-bl/devops-chrome
minjk-bl Sep 27, 2022
124541a
Jupyter Lab support
Feb 8, 2023
0dcbf0f
Change file structure to integrate as 2.13 version for all extensions
Feb 8, 2023
8b8186d
Add symbolic link to visualpython source folder and add some build fi…
visualpython Feb 8, 2023
550bf18
Add build files & gitignore
visualpython Feb 10, 2023
a924e6e
Add css-loader and text-loader
Feb 10, 2023
f4931c3
Edit style and Fix some code for jupyter notebook
Feb 10, 2023
a2764cf
Edit build&dev control of jupyterlab extension
Feb 13, 2023
2d158dd
Fix webpack require error using window.require
Feb 13, 2023
214a2d1
Edit colab manifest resources list
visualpython Feb 13, 2023
ef9650b
Edit build files
visualpython Feb 14, 2023
ef0a6f6
Edit README
visualpython Feb 14, 2023
72eb867
Edit __VP_*_LOADER function naming
visualpython Feb 14, 2023
1114be3
Edit build file
visualpython Feb 14, 2023
41e9eb2
Edit README.md
visualpython Feb 14, 2023
d7d7f21
Edit version
visualpython Feb 14, 2023
19e3410
Edit configuration file of jupyterlab extension
visualpython Feb 14, 2023
1d26b76
deploy visualpython v2.3.0
visualpython Feb 14, 2023
6f1c61d
Merge branch 'release' of https://github.com/visualpython/visualpytho…
visualpython Feb 14, 2023
5c773cf
Merge branch 'main' into release
minjk-bl Feb 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
jupyterlab/lib/visualpython
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Visual Python is an extension to Jupyter Lab, so you must have Jupyter Lab insta

### 2. How to Install

**1) Install package from**
**1) Install package from PyPI**
```
pip install jupyterlab-visualpython
```
Expand All @@ -50,7 +50,7 @@ Visual Python is an extension to Jupyter Notebook, so you must have Jupyter Note

### 2. How to Install

**1) Install package from**
**1) Install package from PyPI**
```
pip install visualpython
```
Expand Down Expand Up @@ -113,4 +113,4 @@ To create an environment where everyone can learn and use big data analytical sk
Love Visual Python? <br>
Your support will help us continue to actively develop and improve Visual Python.☕

<a href="https://www.buymeacoffee.com/visualpython" target="_blank"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=visualpython&button_colour=ffa238&font_colour=000000&font_family=Comic&outline_colour=000000&coffee_colour=FFDD00"></a>
<a href="https://www.buymeacoffee.com/visualpython" target="_blank"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=visualpython&button_colour=ffa238&font_colour=000000&font_family=Comic&outline_colour=000000&coffee_colour=FFDD00"></a>
55 changes: 55 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# Project Name : Visual Python
# Description : GUI-based Python code generator
# File Name : build.sh
# Author : Black Logic - Minju
# Note : Build Visual Python for All
# License : GPLv3 (GNU General Public License v3.0)
# Date : 2023. 02. 08
# Change Date :
#
#=============================================================================
# Set version and replace it
#=============================================================================
VP_ORG_VER=2.2.12
VP_NEW_VER=2.3.0

# 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"
grep -REil "VP_NEW_VER=.+$" colab/build.colab.sh jupyterlab/build.jupyterlab.sh jupyternotebook/build.jupyternotebook.sh | xargs sed -i "s/VP_NEW_VER=.\+$/VP_NEW_VER=${VP_NEW_VER}/g"

TEMP_PWD=$PWD

#=============================================================================
# Build Visual Python for Colab
#=============================================================================
cd $TEMP_PWD/colab
./build.colab.sh

#=============================================================================
# Build Visual Python for Jupyter Notebook
#=============================================================================
cd $TEMP_PWD/jupyternotebook
./build.jupyternotebook.sh

#=============================================================================
# Build Visual Python for Jupyter Lab
#=============================================================================
cd $TEMP_PWD/jupyterlab
./build.jupyterlab.sh

#=============================================================================
# Upload (for maintainer only)
#=============================================================================
## jupyternotebook
# python -m twine upload dist/jupyternotebook/dist/*

## jupyterlab
# python -m twine upload dist/jupyterlab/*

## colab
## upload on chrome web store with blacklogic.dev

exit 0

# End of file
74 changes: 74 additions & 0 deletions colab/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================
// Event for extension icon - toggle
//======================================================================
chrome.action.onClicked.addListener((tab) => {
// check origin if its url is matching our rule
let checkOrigin = tab.url.startsWith('https://colab.research.google.com/');
if (checkOrigin) {
console.log('send toggle', checkOrigin, tab.id, tab);
// send toggle action to content
chrome.tabs.sendMessage(tab.id, { type: 'toggle' }).then(function(result) {
// success
console.log('ok', result);
}).catch(function(result) {
// error: if no content script, execute script again
console.log('error', result);
// execute script manually
chrome.scripting.executeScript({
target: { tabId: tab.id },
files: ['content.js']
}).then(function(result) {
// toggle again
chrome.tabs.sendMessage(tab.id, { type: 'toggle' });
});
});
} else {
console.log("it's not colab site...");
}
});

//======================================================================
// Event for check tab to disable or enable extension
//======================================================================
// check status on tab activated and check colab exist
chrome.tabs.onActivated.addListener(function() {
chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
if (tabs && tabs.length > 0) {
let tabUrl = tabs[0].url;
let isColabExist = tabUrl.startsWith('https://colab.research.google.com/');
if (isColabExist == true) {
// reset
// chrome.action.setBadgeText({ text: '' });
chrome.action.setPopup({ popup: '' });
} else {
// set badge and popup
// chrome.action.setBadgeBackgroundColor({ color: 'red' });
// chrome.action.setBadgeText({ text: ':(' });
chrome.action.setPopup({ popup: 'popup.html' });
}
}

});
});
// check status on tab updated
chrome.tabs.onUpdated.addListener(function() {
chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
if (tabs && tabs.length > 0) {
let tabUrl = tabs[0].url;
let isColabExist = tabUrl.startsWith('https://colab.research.google.com/');
if (isColabExist == true) {
// reset
// chrome.action.setBadgeText({ text: '' });
chrome.action.setPopup({ popup: '' });
} else {
// set badge and popup
// chrome.action.setBadgeBackgroundColor({ color: 'red' });
// chrome.action.setBadgeText({ text: ':(' });
chrome.action.setPopup({ popup: 'popup.html' });
}
}

});
});

// End of file
34 changes: 34 additions & 0 deletions colab/build.colab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Project Name : Visual Python
# Description : GUI-based Python code generator
# File Name : build.colab.sh
# Author : Black Logic - Minju
# Note : Build Visual Python for Colab
# License : GPLv3 (GNU General Public License v3.0)
# Date : 2023. 02. 08
# Change Date :
#
#=============================================================================
# Replace Version
#=============================================================================
VP_ORG_VER=2.2.12
VP_NEW_VER=2.3.0

# update version info
# update manifest version with new numbering for new version
grep -REil ${VP_ORG_VER//\./\\.}\.[0-9] manifest.json | xargs sed -i "s/${VP_ORG_VER//\./\\.}\.[0-9]/${VP_NEW_VER}.1/g"
# update version inside visualpython package
grep -REil ${VP_ORG_VER//\./\\.} visualpython/* | xargs sed -i --follow-symlinks "s/${VP_ORG_VER//\./\\.}/${VP_NEW_VER}/g"

#=============================================================================
# Build output for Colab
#=============================================================================
# make directories to save build output
mkdir -p ../dist/colab

# build package
# sudo apt-get install zip
zip -r ../dist/colab/visualpython-v$VP_NEW_VER.zip background.js content.js icon.png inject.js manifest.json visualpython

exit 0
# End of file
64 changes: 64 additions & 0 deletions colab/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//======================================================================
// Inner functions
//======================================================================
/**
* Send event to inject script
* @param {*} type event type defined on inject script
* @param {*} data data to send
*/
function sendEvent(type, data='') {
let detailObj = { type: type, data: data };
let evt = new CustomEvent('vpcomm', { bubbles: true, detail: detailObj });
console.log('[vp content] send from content - ', type, data, evt);
document.dispatchEvent(evt);

}
function checkScriptExists(url) {
return document.querySelectorAll(`script[src="${url}"]`).length > 0;
}
/**
* Inject file
*/
function injectFile() {
let url = chrome.runtime.getURL('inject.js');
console.log('[vp content] check inject file...')
if (checkScriptExists(url)) {
console.log('[vp content] inject file already exist!');
return false;
}
console.log('[vp content] inject file!');
// inject script
var s = document.createElement('script');
s.src = url;
s.onload = function() {
// send event to inject.js to send its url
var url = chrome.runtime.getURL('');
// var evt = new CustomEvent('vpcomm', { bubbles: true, detail: { type: 'sendBase', data: url } });
// document.dispatchEvent(evt);
sendEvent('sendBase', url);
};
(document.head || document.documentElement).appendChild(s);
return true;
}

//======================================================================
// Event listener - background <-> (content -> inject)
//======================================================================
function msgHandler(msg, sender) {
if (msg && msg.type) {
switch(msg.type) {
case "toggle":
injectFile();
sendEvent('toggle');
break;
default:
break;
}
}
}
chrome.runtime.onMessage.removeListener(msgHandler);
chrome.runtime.onMessage.addListener(msgHandler);

console.log('[vp content] content script executed!');

// End of file
Binary file added colab/icon-disable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added colab/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading