NeurodataWithoutBorders / nwbwidgets

Explore the hierarchical structure of NWB 2.0 files and visualize data with Jupyter widgets.
https://nwb-widgets.readthedocs.io/en/latest/
Other
48 stars 21 forks source link

Relax upper bound on ipywidgets #260

Closed CodyCBakerPhD closed 1 year ago

CodyCBakerPhD commented 1 year ago

@bendichter Satra needs looser bounds on ipywidgets to get the Hub rebuild of default kernels to work smoothly

The versions above ipywidgets>=8.0.0 fix the javascript issue

CodyCBakerPhD commented 1 year ago

Trying to debug the traitlets issue in the tests now, didn't prohibit me from using the panel or nwb2widget in practice

bendichter commented 1 year ago

Hmm what's going on with traitlets? It looks like maybe an int was set when it should have been a string and casting no longer works:

=================================== FAILURES ===================================
______________________________ test_df2accordion _______________________________

    def test_df2accordion():
        df = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), columns=["a", "b", "c"])

        def func_fig(data):
            fig = plt.figure(figsize=(10, 5))
            plt.plot(data)
            return fig

>       df2accordion(df=df, by="a", func=func_fig)

test/test_base.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
nwbwidgets/base.py:276: in df2accordion
    return lazy_show_over_data(idfs, func, labels=labels, style=style)
nwbwidgets/base.py:185: in lazy_show_over_data
    [out.set_title(i, label) for i, label in enumerate(labels)]
nwbwidgets/base.py:185: in <listcomp>
    [out.set_title(i, label) for i, label in enumerate(labels)]
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/ipywidgets/widgets/widget_selectioncontainer.py:[70](https://github.com/NeurodataWithoutBorders/nwbwidgets/actions/runs/4058593450/jobs/6985697662#step:6:71): in set_title
    self.titles = tuple(titles)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:732: in __set__
    self.set(obj, value)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:706: in set
    new_value = self._validate(obj, value)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:738: in _validate
    value = self.validate(obj, value)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:28[71](https://github.com/NeurodataWithoutBorders/nwbwidgets/actions/runs/4058593450/jobs/6985697662#step:6:72): in validate
    value = self.validate_elements(obj, value)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2883: in validate_elements
    self.error(obj, v, error)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:823: in error
    raise error
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2881: in validate_elements
    v = self._trait._validate(obj, v)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:[73](https://github.com/NeurodataWithoutBorders/nwbwidgets/actions/runs/4058593450/jobs/6985697662#step:6:74)8: in _validate
    value = self.validate(obj, value)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:2536: in validate
    self.error(obj, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <traitlets.traitlets.Unicode object at 0x7fe35e55ffd0>
obj = Accordion(children=(Output(_dom_classes=('custom_theme',)), HTML(value='Rendering...'), HTML(value='Rendering...')), titles=('', '', ''))
value = 1, error = None, info = None

    def error(self, obj, value, error=None, info=None):
        """Raise a TraitError

        Parameters
        ----------
        obj : HasTraits or None
            The instance which owns the trait. If not
            object is given, then an object agnostic
            error will be raised.
        value : any
            The value that caused the error.
        error : Exception (default: None)
            An error that was raised by a child trait.
            The arguments of this exception should be
            of the form ``(value, info, *traits)``.
            Where the ``value`` and ``info`` are the
            problem value, and string describing the
            expected value. The ``traits`` are a series
            of :class:`TraitType` instances that are
            "children" of this one (the first being
            the deepest).
        info : str (default: None)
            A description of the expected value. By
            default this is infered from this trait's
            ``info`` method.
        """
        if error is not None:
            # handle nested error
            error.args += (self,)
            if self.name is not None:
                # this is the root trait that must format the final message
                chain = " of ".join(describe("a", t) for t in error.args[2:])
                if obj is not None:
                    error.args = (
                        "The '%s' trait of %s instance contains %s which "
                        "expected %s, not %s."
                        % (
                            self.name,
                            describe("an", obj),
                            chain,
                            error.args[1],
                            describe("the", error.args[0]),
                        ),
                    )
                else:
                    error.args = (
                        "The '%s' trait contains %s which "
                        "expected %s, not %s."
                        % (
                            self.name,
                            chain,
                            error.args[1],
                            describe("the", error.args[0]),
                        ),
                    )
            raise error
        else:
            # this trait caused an error
            if self.name is None:
                # this is not the root trait
>               raise TraitError(value, info or self.info(), self)
E               traitlets.traitlets.TraitError: The 'titles' trait of an Accordion instance contains an Unicode of a TypedTuple which expected a unicode string, not the int 1.

/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/traitlets/traitlets.py:[82](https://github.com/NeurodataWithoutBorders/nwbwidgets/actions/runs/4058593450/jobs/6985697662#step:6:83)8: TraitError
bendichter commented 1 year ago

Huh, good to know

codecov[bot] commented 1 year ago

Codecov Report

Merging #260 (b2a8c3f) into master (1eb2f29) will decrease coverage by 0.44%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #260      +/-   ##
==========================================
- Coverage   66.60%   66.17%   -0.44%     
==========================================
  Files          35       35              
  Lines        3441     3441              
==========================================
- Hits         2292     2277      -15     
- Misses       1149     1164      +15     
Flag Coverage Δ
unittests 66.17% <100.00%> (-0.44%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nwbwidgets/base.py 74.87% <100.00%> (ø)
nwbwidgets/file.py 71.11% <0.00%> (-17.78%) :arrow_down:
nwbwidgets/panel.py 77.48% <0.00%> (-4.64%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

CodyCBakerPhD commented 1 year ago

@bendichter This should be good to go and do a fresh release with - the drop in coverage seems to be because the reports on the main base aren't up to date (likely because this CI doesn't run on a CRON schedule) - that's something I can add in a follow-up