Skip to content

Commit e93adcf

Browse files
author
minjk-bl
committed
Fix PackageManager to load package after install or uninstall it
1 parent 31b28a1 commit e93adcf

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

visualpython/js/com/component/PackageManager.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ define([
5252
'plotly': { pipName: 'plotly' },
5353
'wordcloud': { pipName: 'wordcloud' },
5454
'sklearn': { pipName: 'scikit-learn' },
55-
'scikit-posthocs': { pipName: 'scikit-posthocs' },
55+
'scikit_posthocs': { pipName: 'scikit-posthocs' },
5656
'scipy': { pipName: 'scipy' },
5757
'statsmodels': { pipName: 'statsmodels' },
58-
'factor-analyzer': { pipName: 'factor-analyzer' },
58+
'factor_analyzer': { pipName: 'factor-analyzer' },
5959
'pingouin': { pipName: 'pingouin' },
6060
'category_encoders': { pipName: 'category_encoders' },
6161
'imblearn': { pipName: 'imblearn' },
6262
'xgboost': { pipName: 'xgboost' },
6363
'lightgbm': { pipName: 'lightgbm' },
6464
'catboost': { pipName: 'catboost' },
65-
'auto-sklearn': { pipName: 'auto-sklearn' },
65+
'autosklearn': { pipName: 'auto-sklearn' },
6666
'tpot': { pipName: 'tpot' },
67-
'PyMuPDF': { pipName: 'PyMuPDF' },
67+
'pymupdf': { pipName: 'pymupdf' },
6868
'sweetviz': { pipName: 'sweetviz' },
6969
}
7070

@@ -76,16 +76,16 @@ define([
7676
'seaborn': { pipName: 'seaborn' },
7777
'plotly': { pipName: 'plotly' },
7878
'sklearn': { pipName: 'scikit-learn' },
79-
'scikit-posthocs': { pipName: 'scikit-posthocs' },
79+
'scikit_posthocs': { pipName: 'scikit-posthocs' },
8080
'scipy': { pipName: 'scipy' },
8181
'statsmodels': { pipName: 'statsmodels' },
82-
'factor-analyzer': { pipName: 'factor-analyzer' },
82+
'factor_analyzer': { pipName: 'factor-analyzer' },
8383
'category_encoders': { pipName: 'category_encoders' },
8484
'imblearn': { pipName: 'imblearn' },
8585
'xgboost': { pipName: 'xgboost' },
8686
'lightgbm': { pipName: 'lightgbm' },
8787
'catboost': { pipName: 'catboost' },
88-
'auto-sklearn': { pipName: 'auto-sklearn' },
88+
'autosklearn': { pipName: 'auto-sklearn' },
8989
'sweetviz': { pipName: 'sweetviz' },
9090
}
9191
}
@@ -208,6 +208,7 @@ define([
208208
// afterAction: 'run'
209209
// });
210210
com_interface.insertCell('code', code, true, 'Package Manager');
211+
that.loadPackageList();
211212
} else if (menu === 'upgrade') {
212213
var pipName = that.packageLib[key].pipName;
213214
var code = com_util.formatString("!pip install --upgrade {0}", pipName);
@@ -224,11 +225,13 @@ define([
224225
// afterAction: 'run'
225226
// });
226227
com_interface.insertCell('code', code, true, 'Package Manager');
228+
that.loadPackageList();
227229
} else if (menu === 'delete') {
228230
$(item).remove();
229231
delete that.packageLib[key];
230232
vpConfig.removeData('packageList', 'vppackman').then(function() {
231233
vpConfig.setData({ 'packageList': that.packageLib }, 'vppackman');
234+
that.loadPackageList();
232235
});
233236
}
234237
evt.stopPropagation();
@@ -347,6 +350,8 @@ define([
347350
// });
348351
com_interface.insertCell('code', code, true, 'Package Manager');
349352

353+
// load package list
354+
this.loadPackageList();
350355
break;
351356
}
352357

visualpython/python/variableCommand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def _vp_check_package_list(pack_list):
136136
for pack in pack_list:
137137
try:
138138
_vp_pack = _vp_ilib.import_module(pack)
139+
_vp_ilib.reload(_vp_pack)
139140
_pack_info[pack] = { 'name': _vp_pack.__name__, 'installed': True, 'version': _vp_pack.__version__, 'path': _vp_pack.__path__ }
140141
except:
141142
_pack_info[pack] = { 'name': pack, 'installed': False }

0 commit comments

Comments
 (0)