[med-svn] [Git][med-team/emperor][master] 4 commits: New upstream version 1.0.4+ds

Alexandre Detiste (@detiste-guest) gitlab at salsa.debian.org
Fri Feb 21 20:57:51 GMT 2025



Alexandre Detiste pushed to branch master at Debian Med / emperor


Commits:
8b319ba1 by Alexandre Detiste at 2025-02-21T21:50:16+01:00
New upstream version 1.0.4+ds
- - - - -
0690e26f by Alexandre Detiste at 2025-02-21T21:50:26+01:00
Update upstream source from tag 'upstream/1.0.4+ds'

Update to upstream version '1.0.4+ds'
with Debian dir bfe79360e492491dfeba0705afbbacb46af2e54e
- - - - -
a5e17c1a by Alexandre Detiste at 2025-02-21T21:51:04+01:00
add an explicit runtime dependency on python3-pkg-resources

- - - - -
29609ac2 by Alexandre Detiste at 2025-02-21T21:54:12+01:00
refresh patches

- - - - -


15 changed files:

- .github/workflows/main.yml
- ChangeLog.md
- debian/control
- − debian/patches/8b803cd81586b832550eaa2428fa2d0dd581d35f.patch
- debian/patches/no_future_dependency.patch
- debian/patches/series
- doc/source/conf.py
- emperor/core.py
- emperor/support_files/js/visibility-controller.js
- emperor/support_files/templates/style-template.html
- emperor/util.py
- setup.py
- tests/_test_core_strings.py
- tests/javascript_tests/test_visibility_controller.js
- tests/test_util.py


Changes:

=====================================
.github/workflows/main.yml
=====================================
@@ -30,44 +30,49 @@ jobs:
       - name: Set up Node.js enviroment
         uses: actions/setup-node at v1
         with:
-          node-version: 14
+          node-version: 16
 
-      - name: Set up conda
-        uses: s-weigand/setup-conda at v1
+      - uses: conda-incubator/setup-miniconda at v2
         with:
-          update-conda: true
-          python-version: 3.6
+          activate-environment: tester
+          python-version: ${{ matrix.python-version }}
           conda-channels: anaconda, conda-forge
+          auto-update-conda: true
 
       - name: Install Node.js modules
         run: npm install -g jsdoc
 
       - name: Install JS Linter
+        shell: bash -l {0}
         run: |
           conda create --yes -n gjslint python=2.7 pip six
           wget https://github.com/google/closure-linter/archive/master.zip
           conda run -n gjslint pip install master.zip
 
       - name: Install Emperor
+        shell: bash -l {0}
         run: |
-          conda create --yes -n tester python=${{ matrix.python-version }} pip numpy 'scipy>=0.17.0' matplotlib pandas flake8 pep8 jupyter coverage cython scikit-learn requests
-          conda install -n tester -c conda-forge phantomjs --yes
-          conda run -n tester pip install sphinx numpydoc sphinx-bootstrap-theme
-          conda run -n tester pip install -e ".[all]"
+          conda install pip numpy 'scipy>=0.17.0' matplotlib pandas flake8 pep8 jupyter coverage cython scikit-learn requests
+          conda install -c conda-forge phantomjs --yes
+          pip install -e ".[all]"
 
       - name: Build documentation
+        shell: bash -l {0}
         run: |
-          conda run -n tester make -C doc html
+          make -C doc html
 
       - name: Run tests and measure coverage
+        shell: bash -l {0}
         run: |
-          conda run -n tester coverage run tests/all_tests.py
-          conda run -n tester coverage report
+          coverage run tests/all_tests.py
+          coverage report
 
       - name: Python linter
-        run: conda run -n tester flake8 emperor/*.py tests/*.py setup.py
+        shell: bash -l {0}
+        run: flake8 emperor/*.py tests/*.py setup.py
 
       - name: JS linter
+        shell: bash -l {0}
         run: conda run -n gjslint gjslint --custom_jsdoc_tags 'module,function,constructs,alias,default' 'emperor/support_files/js/*.js' 'tests/javascript_tests/*.js'
 
       - name: Coveralls


=====================================
ChangeLog.md
=====================================
@@ -1,8 +1,27 @@
 Emperor ChangeLog
 =================
 
-# Emperor 1.0.3
----------------
+# Emperor 1.0.4 (10 Jul 2023)
+-----------------------------
+
+### Bug Fixes
+
+* Update remote URL to no longer use rawgit.
+  ([#751](https://github.com/biocore/emperor/issues/751)).
+
+### New Features
+
+* Add `Toggle Visible` button to `Visibility` tab.
+
+### Miscellaneous
+
+* Pin Sphinx version to be less than 4.0.
+* Jupyter templates no longer require jQuery to add the CSS headers.
+* Limit jinja2 version for doc dependencies in setup.py. Allowed versions are: `>=2.9` and `<3.1`.
+* Fix broken test suite with Pandas >=1.5 ([#810](https://github.com/biocore/emperor/issues/810)).
+
+# Emperor 1.0.3 (14 Apr 2021)
+-----------------------------
 
 ### Bug Fixes
 


=====================================
debian/control
=====================================
@@ -34,6 +34,7 @@ Depends: ${python3:Depends},
          python3-scipy (>= 1.9),
          python3-click,
          python3-pandas,
+         python3-pkg-resources,
          python3-jinja2,
          python3-skbio (>= 0.5.8-2exp1~),
          libjs-jquery-ui


=====================================
debian/patches/8b803cd81586b832550eaa2428fa2d0dd581d35f.patch deleted
=====================================
@@ -1,28 +0,0 @@
-From 8b803cd81586b832550eaa2428fa2d0dd581d35f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Yoshiki=20V=C3=A1zquez=20Baeza?= <yoshiki at biomesense.com>
-Date: Fri, 13 Jan 2023 11:46:43 -0800
-Subject: [PATCH] BUG: Fixes issue with Pandas >=1.5
-
-Set objects are no longer allowed as an index argument for a DataFrame
-constructor.
-
-Fixes #810
----
- ChangeLog.md    | 3 ++-
- emperor/core.py | 4 ++--
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
---- a/emperor/core.py
-+++ b/emperor/core.py
-@@ -308,9 +308,9 @@ class Emperor(object):
-                              'are using metadata and coordinates corresponding'
-                              ' to the same dataset.' % kind)
- 
-+        # sort the elements so we have a deterministic output
-+        difference = sorted([str(i) for i in difference])
-         if difference and not ignore_missing_samples:
--            # sort the elements so we have a deterministic output
--            difference = sorted([str(i) for i in difference])
- 
-             # if there's more than 5 missing elements, truncate the list
-             if len(difference) > 5:


=====================================
debian/patches/no_future_dependency.patch
=====================================
@@ -1,27 +1,16 @@
 Description: Remove extraneous dependency on python3-future
 Bug-Debian: https://bugs.debian.org/1058565
 Author: Alexandre Detiste <alexandre.detiste at gmail.com>
-Last-Update: Fri, 15 Dec 2023 22:10:49 +0100
+Last-Update: Fri, 21 Feb 2025 21:53:49 +0100
 
 --- a/setup.py
 +++ b/setup.py
-@@ -35,7 +35,7 @@ with open('README.md') as f:
+@@ -35,7 +35,7 @@
      long_description = f.read()
  
  base = ["numpy >= 1.7", "scipy >= 0.17.0", "click", "pandas",
 -        "scikit-bio >= 0.4.1", "jinja2 >= 2.9", "future"]
 +        "scikit-bio >= 0.4.1", "jinja2 >= 2.9"]
- doc = ["Sphinx", "sphinx-bootstrap-theme", "numpydoc"]
+ doc = ["Sphinx<4", "jinja2 >= 2.9, < 3.1", "sphinx-bootstrap-theme",
+        "numpydoc"]
  test = ["pep8", "flake8", "nose"]
- all_deps = base + doc + test
---- a/tests/test_core.py
-+++ b/tests/test_core.py
-@@ -5,8 +5,6 @@
- #
- # The full license is in the file LICENSE.md, distributed with this software.
- # ----------------------------------------------------------------------------
--from __future__ import division
--
- from unittest import TestCase, main
- from copy import deepcopy
- from os.path import exists


=====================================
debian/patches/series
=====================================
@@ -2,7 +2,6 @@ do_not_use_custom_numpydoc.patch
 correct_jsdoc_arguments.patch
 EditSectionTitle.patch
 # ignore_one_failing_test.patch
-8b803cd81586b832550eaa2428fa2d0dd581d35f.patch
 no_future_dependency.patch
 python3.12,patch
 pandas-2.patch


=====================================
doc/source/conf.py
=====================================
@@ -58,10 +58,10 @@ copyright = u'2014, Emperor Development Team'
 # built documents.
 #
 # The short X.Y version.
-version = '1.0.3'
+version = '1.0.4'
 
 # The full version, including alpha/beta/rc tags.
-release = '1.0.3'
+release = '1.0.4'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


=====================================
emperor/core.py
=====================================
@@ -24,8 +24,8 @@ from emperor.util import (get_emperor_support_files_dir,
                           validate_and_process_custom_axes, EmperorWarning)
 
 # we are going to use this remote location to load external resources
-REMOTE_URL = ('https://cdn.rawgit.com/biocore/emperor/%s/emperor'
-              '/support_files')
+REMOTE_URL = ('https://cdn.jsdelivr.net/gh/biocore/emperor@%s/emperor/'
+              'support_files')
 LOCAL_URL = "/nbextensions/emperor/support_files"
 
 BASE_DEPENDENCIES_PATH = 'base-dependencies.html'
@@ -306,9 +306,9 @@ class Emperor(object):
                              'are using metadata and coordinates corresponding'
                              ' to the same dataset.' % kind)
 
+        # sort the elements so we have a deterministic output
+        difference = sorted([str(i) for i in difference])
         if difference and not ignore_missing_samples:
-            # sort the elements so we have a deterministic output
-            difference = sorted([str(i) for i in difference])
 
             # if there's more than 5 missing elements, truncate the list
             if len(difference) > 5:


=====================================
emperor/support_files/js/visibility-controller.js
=====================================
@@ -68,6 +68,22 @@ define([
 
     EmperorAttributeABC.call(this, uiState, container, title, helpmenu,
         decompViewDict, options);
+
+    this.$applyAll = $("<input type='button' value='Toggle Visible'>"
+    ).css({
+      'margin': '0 auto',
+      'display': 'block'
+    });
+    this.$header.append(this.$applyAll);
+
+    $(function() {
+      scope.$applyAll.hide();
+      scope.$applyAll.on('click', function() {
+        scope.toggleVisibility();
+      });
+    });
+
+
     return this;
   }
   VisibilityController.prototype = Object.create(EmperorAttributeABC.prototype);
@@ -102,5 +118,43 @@ define([
     scope.setVisibility(visible, group);
   };
 
+  /**
+   * Sets whether or not elements in the tab can be modified.
+   *
+   * @param {Boolean} trulse option to enable elements.
+   */
+  VisibilityController.prototype.setEnabled = function(trulse) {
+    EmperorAttributeABC.prototype.setEnabled.call(this, trulse);
+
+    // prevent errors when this method is called before the element exists
+    if (this.$applyAll) {
+      if (trulse) {
+        this.$applyAll.show();
+      }
+      else {
+        this.$applyAll.hide();
+      }
+    }
+  };
+
+  /**
+   * Toggle visible objects
+   */
+  VisibilityController.prototype.toggleVisibility = function() {
+    var view = this.getView();
+
+    var groups = this.getSlickGridDataset();
+    _.each(groups, function(group) {
+
+      // toggle the value in the data container and update the view
+      group.value = Boolean(true ^ group.value);
+      view.setVisibility(group.value, group.plottables);
+    });
+
+    // lastly, update the grid table
+    this.setSlickGridDataset(groups);
+  };
+
+
   return VisibilityController;
 });


=====================================
emperor/support_files/templates/style-template.html
=====================================
@@ -1,8 +1,6 @@
 <script type="text/javascript">
-{% raw %}
-if ($("#emperor-css").length == 0){{
-    $("head").append([
-{% endraw %}
+if (document.querySelector("#emperor-css") === null){
+    document.querySelector("head").insertAdjacentHTML("beforeend",[
         '<link id="emperor-css" rel="stylesheet" type="text/css" href="{{ base_url }}/css/emperor.css">',
         '<link rel="stylesheet" type="text/css" href="{{ base_url }}/vendor/css/jquery-ui.min.css">',
         '<link rel="stylesheet" type="text/css" href="{{ base_url }}/vendor/css/slick.grid.min.css">',
@@ -10,6 +8,6 @@ if ($("#emperor-css").length == 0){{
         '<link rel="stylesheet" type="text/css" href="{{ base_url }}/vendor/css/chosen.min.css">',
         '<link rel="stylesheet" type="text/css" href="{{ base_url }}/vendor/css/jquery.contextMenu.min.css">'
     ]);
-}}
+}
 </script>
 


=====================================
emperor/util.py
=====================================
@@ -363,16 +363,24 @@ def resolve_stable_url(version, base_url):
     An EmperorWarning is shown when development URLs are used.
     """
     if 'dev' in version:
-        warnings.warn("Plots generated with `remote=True` using a development "
-                      "version of Emperor, may fail to load in the future "
-                      "(only the logo may be displayed instead of the plot). "
-                      "To avoid this, use a release version of Emperor.",
+        warnings.warn("Plots generated with `remote=True` using a development"
+                      " version of Emperor may fail to load (only the logo "
+                      "may be displayed instead of the plot). Using this flag"
+                      " might also load outdated JS or CSS files. If you are "
+                      "doing development, we recommend running nbinstall and "
+                      "sourcing JS and CSS files locally. Otherwise use "
+                      "`remote=True` only with a release version of Emperor.",
                       EmperorWarning)
 
-        # this will need to be fixed when new-api is merged to master
-        return base_url % 'new-api'
-    else:
-        # version names are changed for git tags from betaxx to -beta.xx
-        if 'b' in version:
-            version = version.replace('b', '-beta.')
-        return base_url % version
+        version = version.rstrip('.dev0')
+
+    if 'b' in version:
+        # Version numbers appear in slightly different formats in different
+        # places. Setuptools converts 1.0.0beta19 into 1.0.0b19. This is then
+        # converted to 1.0.0-beta.19 for the git tag.
+        #
+        # The replacement below makes the setuptools version string match what
+        # the git tag will look like.
+        version = version.replace('b', '-beta.')
+
+    return base_url % version


=====================================
setup.py
=====================================
@@ -9,7 +9,7 @@
 
 from setuptools import setup, find_packages
 
-__version__ = "1.0.3"
+__version__ = "1.0.4"
 __maintainer__ = "Emperor development team"
 __email__ = "yoshiki89 at gmail.com"
 
@@ -36,7 +36,8 @@ with open('README.md') as f:
 
 base = ["numpy >= 1.7", "scipy >= 0.17.0", "click", "pandas",
         "scikit-bio >= 0.4.1", "jinja2 >= 2.9", "future"]
-doc = ["Sphinx", "sphinx-bootstrap-theme", "numpydoc"]
+doc = ["Sphinx<4", "jinja2 >= 2.9, < 3.1", "sphinx-bootstrap-theme",
+       "numpydoc"]
 test = ["pep8", "flake8", "nose"]
 all_deps = base + doc + test
 


=====================================
tests/_test_core_strings.py
=====================================
@@ -55,10 +55,8 @@ Site constraints	0	0
 
 HTML_STRING = u"""
 <script type="text/javascript">
-
-if ($("#emperor-css").length == 0){{
-    $("head").append([
-
+if (document.querySelector("#emperor-css") === null){
+    document.querySelector("head").insertAdjacentHTML("beforeend",[
         '<link id="emperor-css" rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/biocore/emperor/new-api/emperor/support_files/css/emperor.css">',
         '<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/biocore/emperor/new-api/emperor/support_files/vendor/css/jquery-ui.min.css">',
         '<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/biocore/emperor/new-api/emperor/support_files/vendor/css/slick.grid.min.css">',
@@ -66,7 +64,7 @@ if ($("#emperor-css").length == 0){{
         '<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/biocore/emperor/new-api/emperor/support_files/vendor/css/chosen.min.css">',
         '<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/biocore/emperor/new-api/emperor/support_files/vendor/css/jquery.contextMenu.min.css">'
     ]);
-}}
+}
 </script>
 
 <div id='emperor-notebook-0x9cb72f54' style="position: relative; width:100%; height:500px;">
@@ -241,10 +239,8 @@ STANDALONE_HTML_STRING = """<!DOCTYPE html>
     <meta charset="utf-8">
 
     <script type="text/javascript">
-
-if ($("#emperor-css").length == 0){{
-    $("head").append([
-
+if (document.querySelector("#emperor-css") === null){
+    document.querySelector("head").insertAdjacentHTML("beforeend",[
         '<link id="emperor-css" rel="stylesheet" type="text/css" href="./some-local-path//css/emperor.css">',
         '<link rel="stylesheet" type="text/css" href="./some-local-path//vendor/css/jquery-ui.min.css">',
         '<link rel="stylesheet" type="text/css" href="./some-local-path//vendor/css/slick.grid.min.css">',
@@ -252,7 +248,7 @@ if ($("#emperor-css").length == 0){{
         '<link rel="stylesheet" type="text/css" href="./some-local-path//vendor/css/chosen.min.css">',
         '<link rel="stylesheet" type="text/css" href="./some-local-path//vendor/css/jquery.contextMenu.min.css">'
     ]);
-}}
+}
 </script>
 
 
@@ -435,10 +431,8 @@ function($, model, EmperorController) {
 </html>"""
 
 STYLE_STRING = """<script type="text/javascript">
-
-if ($("#emperor-css").length == 0){{
-    $("head").append([
-
+if (document.querySelector("#emperor-css") === null){
+    document.querySelector("head").insertAdjacentHTML("beforeend",[
         '<link id="emperor-css" rel="stylesheet" type="text/css" href="/nbextensions/emperor/support_files/css/emperor.css">',
         '<link rel="stylesheet" type="text/css" href="/nbextensions/emperor/support_files/vendor/css/jquery-ui.min.css">',
         '<link rel="stylesheet" type="text/css" href="/nbextensions/emperor/support_files/vendor/css/slick.grid.min.css">',
@@ -446,7 +440,7 @@ if ($("#emperor-css").length == 0){{
         '<link rel="stylesheet" type="text/css" href="/nbextensions/emperor/support_files/vendor/css/chosen.min.css">',
         '<link rel="stylesheet" type="text/css" href="/nbextensions/emperor/support_files/vendor/css/jquery.contextMenu.min.css">'
     ]);
-}}
+}
 </script>
 """
 


=====================================
tests/javascript_tests/test_visibility_controller.js
=====================================
@@ -107,6 +107,39 @@ requirejs([
       equal(controller.getMetadataField(), null);
     });
 
+    test('Testing toggleVisibility', function(assert) {
+      var container = $('<div id="does-not-exist" style="height:11px; ' +
+                        'width:12px"></div>');
+      var controller = new VisibilityController(new UIState(), container,
+          this.sharedDecompositionViewDict);
+      controller.setMetadataField('Treatment');
+
+      // trun everything off
+      controller.toggleVisibility();
+      equal(controller.decompViewDict.scatter.markers[0].visible, false);
+      equal(controller.decompViewDict.scatter.markers[1].visible, false);
+
+      var groupVisibility = controller.getSlickGridDataset();
+      equal(groupVisibility[0].value, false);
+      equal(groupVisibility[1].value, false);
+
+      // set the first group to false the second group to true
+      groupVisibility = controller.getSlickGridDataset();
+      groupVisibility[0].value = false;
+      groupVisibility[1].value = true;
+      controller.getView().setVisibility(false, groupVisibility[0].plottables);
+      controller.getView().setVisibility(true, groupVisibility[1].plottables);
+      controller.setSlickGridDataset(groupVisibility);
+
+      controller.toggleVisibility();
+      equal(controller.decompViewDict.scatter.markers[0].visible, true);
+      equal(controller.decompViewDict.scatter.markers[1].visible, false);
+
+      groupVisibility = controller.getSlickGridDataset();
+      equal(groupVisibility[0].value, true);
+      equal(groupVisibility[1].value, false);
+    });
+
     test('Testing setPlottableAttributes helper function', function(assert) {
       // testing with one plottable
       var idx = 0;


=====================================
tests/test_util.py
=====================================
@@ -318,31 +318,31 @@ class TopLevelTests(TestCase):
 
     def test_resolve_stable_url_release(self):
         # we test that no warnings are raised
-        url = 'https://github.com/biocore/emperor/%s/emperor/support_files'
+        url = 'https://github.com/biocore/emperor@%s/emperor/support_files'
         with warnings.catch_warnings(record=True) as w:
             obs = resolve_stable_url('1.0.0b7', url)
             self.assertTrue(len(w) == 0)
             self.assertEqual(obs, url % '1.0.0-beta.7')
 
     def test_resolve_stable_url_release_check_warning(self):
-        url = 'https://github.com/biocore/emperor/%s/emperor/support_files'
+        url = 'https://github.com/biocore/emperor@%s/emperor/support_files'
         with warnings.catch_warnings(record=True) as w:
             warnings.simplefilter('always')
-            obs = resolve_stable_url('1.0.0b7-dev', url)
+            obs = resolve_stable_url('1.0.0b7.dev', url)
 
             self.assertTrue(len(w) == 1)
             self.assertTrue(issubclass(w[-1].category, EmperorWarning))
-            self.assertEqual(obs, url % 'new-api')
+            self.assertEqual(obs, url % '1.0.0-beta.7')
 
     def test_resolve_stable_url_release_number_check_warning(self):
-        url = 'https://github.com/biocore/emperor/%s/emperor/support_files'
+        url = 'https://github.com/biocore/emperor@%s/emperor/support_files'
         with warnings.catch_warnings(record=True) as w:
             warnings.simplefilter('always')
-            obs = resolve_stable_url('1.0.0b7-dev0', url)
+            obs = resolve_stable_url('1.0.0b7.dev0', url)
 
             self.assertTrue(len(w) == 1)
             self.assertTrue(issubclass(w[-1].category, EmperorWarning))
-            self.assertEqual(obs, url % 'new-api')
+            self.assertEqual(obs, url % '1.0.0-beta.7')
 
 
 MAPPING_FILE_DATA = [



View it on GitLab: https://salsa.debian.org/med-team/emperor/-/compare/cac87b6ecbc8dacd9c3f34c835980be12962ef46...29609ac2f0e1a241296b723013ae8f9323a1d514

-- 
View it on GitLab: https://salsa.debian.org/med-team/emperor/-/compare/cac87b6ecbc8dacd9c3f34c835980be12962ef46...29609ac2f0e1a241296b723013ae8f9323a1d514
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250221/15d66995/attachment-0001.htm>


More information about the debian-med-commit mailing list