holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.76k stars 518 forks source link

pixi run test-example picks up old Panel code version #7116

Closed cdeil closed 2 months ago

cdeil commented 2 months ago

I'm on 9404b4348a80a190b3dcda7f270ba3e5b3c10210 and followed instructions here: https://holoviz-dev.github.io/panel/developer_guide/index.html#example-tests

I get this error:

(panel) (panel) panel $ pixi run test-example
✨ Pixi task (test-example in test-312): pytest -n logical --dist loadscope --nbval-lax examples
=============================================================================================== test session starts ================================================================================================
platform darwin -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/cdeil/code/oss/panel
configfile: pyproject.toml
plugins: asyncio-0.23.8, cov-5.0.0, github-actions-annotate-failures-0.2.0, rerunfailures-14.0, anyio-4.4.0, nbval-0.11.0, xdist-3.6.1
asyncio: mode=Mode.AUTO
10 workers [987 items]    
............................................................................................................................................................................................................ [ 20%]
............................................................................................................................................................................................................ [ 41%]
............................................................................................................................................................................................................ [ 62%]
.....................................................................................................................FFFF.............FFFF.................................................................. [ 82%]
...........................................................................................................................................................................                                  [100%]
===================================================================================================== FAILURES =====================================================================================================
_____________________________________________________________________________ examples/reference/widgets/DiscretePlayer.ipynb::Cell 1 ______________________________________________________________________________
[gw4] darwin -- Python 3.12.5 /Users/cdeil/code/oss/panel/.pixi/envs/test-312/bin/python3.12
Notebook cell execution failed
Cell 1: Cell execution caused an exception

Input:
discrete_player = pn.widgets.DiscretePlayer(name='Discrete Player', options=[2, 4, 8, 16, 32, 64, 128],
                                            value=8, loop_policy='loop', show_value=True, value_align='start')

discrete_player

Traceback:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 discrete_player = pn.widgets.DiscretePlayer(name='Discrete Player', options=[2, 4, 8, 16, 32, 64, 128],
      2                                             value=8, loop_policy='loop', show_value=True, value_align='start')
      4 discrete_player

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/widgets/player.py:55, in PlayerBase.__init__(self, **params)
     53 if 'value' in params and 'value_throttled' in self.param:
     54     params['value_throttled'] = params['value']
---> 55 super().__init__(**params)

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/widgets/base.py:115, in Widget.__init__(self, **params)
    113 else:
    114     self._param_pane = None
--> 115 super().__init__(**params)

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/reactive.py:597, in Reactive.__init__(self, refs, **params)
    595     if refs:
    596         param.bind(self._sync_refs, *refs, watch=True)
--> 597 super().__init__(**params)

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/reactive.py:125, in Syncable.__init__(self, **params)
    123 def __init__(self, **params):
    124     self._themer = None
--> 125     super().__init__(**params)
    127     # Useful when updating model properties which trigger potentially
    128     # recursive events
    129     self._updating = False

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/viewable.py:704, in Viewable.__init__(self, **params)
    702 def __init__(self, **params):
    703     hooks = params.pop('hooks', [])
--> 704     super().__init__(**params)
    705     self._hooks = hooks
    707     if self.loading:

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/viewable.py:543, in Renderable.__init__(self, **params)
    541 self._comms = {}
    542 self._kernels = {}
--> 543 super().__init__(**params)
    544 self._found_links = set()
    545 self._logger = logging.getLogger(f'{__name__}.{type(self).__name__}')

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/panel/viewable.py:302, in Layoutable.__init__(self, **params)
    300 if 'design' not in params and self.param.design.default is None:
    301     params['design'] = config.design
--> 302 super().__init__(**params)

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/param/parameterized.py:4188, in Parameterized.__init__(self, **params)
   4186 if self.param.name.default == self.__class__.__name__:
   4187     self.param._generate_name()
-> 4188 refs, deps = self.param._setup_params(**params)
   4189 object_count += 1
   4191 self._param__private.initialized = True

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/param/parameterized.py:1686, in as_uninitialized.<locals>.override_initialization(self_, *args, **kw)
   1684 original_initialized = parameterized_instance._param__private.initialized
   1685 parameterized_instance._param__private.initialized = False
-> 1686 ret = fn(self_, *args, **kw)
   1687 parameterized_instance._param__private.initialized = original_initialized
   1688 return ret

File ~/code/oss/panel/.pixi/envs/test-312/lib/python3.12/site-packages/param/parameterized.py:1939, in Parameters._setup_params(self_, **params)
   1937 desc = self_.cls.get_param_descriptor(name)[0] # pylint: disable-msg=E1101
   1938 if not desc:
-> 1939     raise TypeError(
   1940         f"{self.__class__.__name__}.__init__() got an unexpected "
   1941         f"keyword argument {name!r}"
   1942     )
   1944 pobj = objects.get(name)
   1945 if pobj is None or not pobj.allow_refs:
   1946     # Until Parameter.allow_refs=True by default we have to
   1947     # speculatively evaluate a values to check whether they
   1948     # contain a reference and warn the user that the
   1949     # behavior may change in future.

TypeError: DiscretePlayer.__init__() got an unexpected keyword argument 'show_value'

and some similar errors:

============================================================================================= short test summary info ==============================================================================================
FAILED examples/reference/widgets/DiscretePlayer.ipynb::Cell 1
FAILED examples/reference/widgets/DiscretePlayer.ipynb::Cell 2
FAILED examples/reference/widgets/DiscretePlayer.ipynb::Cell 3
FAILED examples/reference/widgets/DiscretePlayer.ipynb::Cell 4
FAILED examples/reference/widgets/Player.ipynb::Cell 1
FAILED examples/reference/widgets/Player.ipynb::Cell 2
FAILED examples/reference/widgets/Player.ipynb::Cell 3
FAILED examples/reference/widgets/Player.ipynb::Cell 4
==================================================================================== 8 failed, 979 passed in 137.45s (0:02:17) =====================================================================================

This is related to the recent change in #7060 .

Why does this happen? Does pixi run test-example somehow not install the latest source code into the pixi env and pytest picks up some older panel Python code version?

hoxbro commented 2 months ago

Short answer yes. Try running pixi run -e test-312 install before the command.

See the note here https://holoviz-dev.github.io/panel/developer_guide/index.html#editable-install

cdeil commented 2 months ago

@hoxbro - thank you!

That does fix the issue.

One more thing that I find weird is that running the test for (only this one) example notebook creates a tab in my default browser Chrome every time I run the tests:

$ pixi run -e test-312 test-example -v examples/reference/chat/ChatStep.ipynb

Is this expected? Possible to avoid this somehow?

Screenshot 2024-08-10 at 18 06 53
hoxbro commented 2 months ago

Likely a .show somewhere in the notebook.

cdeil commented 2 months ago

As a new pixi user I find it confusing that there's a pixi run lint-install but then for other envs there's no equivalent env install task. Is is possible to make all envs work the same?

cdeil commented 2 months ago

There is a chat_feed.show() here: https://holoviz-dev.github.io/panel/reference/chat/ChatFeed.html

Is that normal or should it be deleted or changed somehow?

Screenshot 2024-08-10 at 18 27 21
hoxbro commented 2 months ago

As a new pixi user I find it confusing that there's a pixi run lint-install but then for other envs there's no equivalent env install task. Is is possible to make all envs work the same?

For the other environment, the command is pixi run install. pixi run lint-install is the exception, not the rule.

Is that normal or should it be deleted or changed somehow?

I think it is a debug leftover and should be removed.

cdeil commented 2 months ago

This was usage error. show call removed in #7147