Skip to content

Commit

Permalink
BUG: Fix version conflicts with Jupyter deps
Browse files Browse the repository at this point in the history
Fixes a problem where Jupyter's require declarations would shadow
Emperor's. Specifically while using the newest version of the Jupyter
notebook jquery would be updated to version 3.x and that version is not
compatible with several dependencies of Emperor.

For now this fix ensures that there will be no version conflicts by
putting all our dependencies under their own context.
  • Loading branch information
ElDeveloper committed Sep 13, 2018
1 parent 4527bcd commit e5c1d7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions emperor/support_files/templates/logic-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
</div>

<script type="text/javascript">
requirejs.config({
// When running in the Jupyter notebook we've encountered version conflicts
// with some dependencies. So instead of polluting the global require context,
// we define a new context.
var emperorRequire = require.config({
'context': 'emperor',
// the left side is the module name, and the right side is the path
// relative to the baseUrl attribute, do NOT include the .js extension
'paths': {
Expand Down Expand Up @@ -94,7 +98,7 @@
}
});

requirejs(
emperorRequire(
["jquery", "model", "controller"],
function($, model, EmperorController) {
var DecompositionModel = model.DecompositionModel;
Expand Down
14 changes: 10 additions & 4 deletions tests/_test_core_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@
</div>
<script type="text/javascript">
requirejs.config({
// When running in the Jupyter notebook we've encountered version conflicts
// with some dependencies. So instead of polluting the global require context,
// we define a new context.
emperorRequire.config({
// the left side is the module name, and the right side is the path
// relative to the baseUrl attribute, do NOT include the .js extension
'paths': {
Expand Down Expand Up @@ -165,7 +168,7 @@
}
});
requirejs(
emperorRequire(
["jquery", "model", "controller"],
function($, model, EmperorController) {
var DecompositionModel = model.DecompositionModel;
Expand Down Expand Up @@ -261,7 +264,10 @@
</div>
<script type="text/javascript">
requirejs.config({
// When running in the Jupyter notebook we've encountered version conflicts
// with some dependencies. So instead of polluting the global require context,
// we define a new context.
emperorRequire.config({
// the left side is the module name, and the right side is the path
// relative to the baseUrl attribute, do NOT include the .js extension
'paths': {
Expand Down Expand Up @@ -351,7 +357,7 @@
}
});
requirejs(
emperorRequire(
["jquery", "model", "controller"],
function($, model, EmperorController) {
var DecompositionModel = model.DecompositionModel;
Expand Down

0 comments on commit e5c1d7a

Please sign in to comment.