Skip to content
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

Relax upper bound on ipywidgets #260

Merged
merged 3 commits into from Feb 1, 2023
Merged

Conversation

CodyCBakerPhD
Copy link
Collaborator

@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

bendichter
bendichter previously approved these changes Jan 31, 2023
@bendichter bendichter self-requested a review January 31, 2023 22:27
@CodyCBakerPhD
Copy link
Collaborator Author

CodyCBakerPhD commented Jan 31, 2023

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

@bendichter
Copy link
Collaborator

bendichter commented Jan 31, 2023

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
Copy link
Collaborator

Huh, good to know

[out.set_title(i, label) for i, label in enumerate(labels)]
[out.set_title(i, str(label)) for i, label in enumerate(labels)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bendichter This fixed it

I guess one of the labels in the test cases was actually an integer, and at some point they stopped magically casting it as a string during set_title

We should probably do it elsewhere we set titles as well just to be sure, but that can be separate PR

@codecov
Copy link

codecov bot commented Jan 31, 2023

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%) ⬇️

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%) ⬇️
nwbwidgets/panel.py 77.48% <0.00%> (-4.64%) ⬇️

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

@CodyCBakerPhD
Copy link
Collaborator Author

@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

@CodyCBakerPhD CodyCBakerPhD merged commit e4e5479 into master Feb 1, 2023
@CodyCBakerPhD CodyCBakerPhD deleted the relax_ipywidgets_dep branch February 1, 2023 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants