napari-plugin-manager 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -147,7 +147,8 @@ def test_pip_installer_tasks(
147
147
  )
148
148
  process_finished_data = blocker.args[0]
149
149
  assert process_finished_data['action'] == InstallerActions.INSTALL
150
- assert process_finished_data['pkgs'] == ('pydantic',)
150
+ assert tuple(process_finished_data['pkgs']) == ('pydantic',)
151
+ # It look like Pydantic6 converts tuples to lists
151
152
 
152
153
  # Test upgrade
153
154
  with qtbot.waitSignal(installer.allFinished, timeout=30_000):
@@ -7,7 +7,6 @@ from unittest.mock import MagicMock, call, patch
7
7
  import napari.plugins
8
8
  import npe2
9
9
  import pytest
10
- import qtpy
11
10
  from napari.plugins._tests.test_npe2 import mock_pm # noqa
12
11
  from napari.utils.translations import trans
13
12
  from qtpy.QtCore import QMimeData, QPointF, Qt, QTimer, QUrl
@@ -17,13 +16,6 @@ from qtpy.QtWidgets import (
17
16
  QMessageBox,
18
17
  )
19
18
 
20
- if qtpy.API_NAME == 'PySide2' and sys.version_info[:2] > (3, 10):
21
- pytest.skip(
22
- 'Known PySide2 x Python incompatibility: '
23
- '... object cannot be interpreted as an integer',
24
- allow_module_level=True,
25
- )
26
-
27
19
  from napari_plugin_manager import base_qt_plugin_dialog, qt_plugin_dialog
28
20
  from napari_plugin_manager.base_qt_package_installer import (
29
21
  InstallerActions,
@@ -105,10 +97,6 @@ def plugin_dialog(
105
97
  old_plugins,
106
98
  ):
107
99
  """Fixture that provides a plugin dialog for a normal napari install."""
108
- from napari.settings import get_settings
109
-
110
- original_setting = get_settings().plugins.use_npe2_adaptor
111
- get_settings().plugins.use_npe2_adaptor = False
112
100
 
113
101
  class PluginManagerMock:
114
102
  def instance(self):
@@ -127,7 +115,7 @@ def plugin_dialog(
127
115
  def is_disabled(self, name):
128
116
  return False
129
117
 
130
- def discover(self, include_npe1=False):
118
+ def discover(self, include_npe1=True):
131
119
  return ['plugin']
132
120
 
133
121
  def enable(self, plugin):
@@ -207,7 +195,6 @@ def plugin_dialog(
207
195
  if widget.worker is not None:
208
196
  widget.worker.quit()
209
197
  assert not widget._add_items_timer.isActive()
210
- get_settings().plugins.use_npe2_adaptor = original_setting
211
198
 
212
199
 
213
200
  def test_filter_not_available_plugins(request, plugin_dialog, qtbot):
@@ -221,16 +208,15 @@ def test_filter_not_available_plugins(request, plugin_dialog, qtbot):
221
208
  )
222
209
  plugin_dialog.search('e')
223
210
  qtbot.wait(500)
224
- item = plugin_dialog.available_list.item(0)
225
- widget = plugin_dialog.available_list.itemWidget(item)
226
- if widget:
227
- assert not widget.action_button.isEnabled()
228
- assert widget.warning_tooltip.isVisible()
229
-
230
- item = plugin_dialog.available_list.item(1)
231
- widget = plugin_dialog.available_list.itemWidget(item)
232
- assert widget.action_button.isEnabled()
233
- assert not widget.warning_tooltip.isVisible()
211
+ for i in range(plugin_dialog.available_list.count()):
212
+ item = plugin_dialog.available_list.item(i)
213
+ widget = plugin_dialog.available_list.itemWidget(item)
214
+ if widget and widget.name == 'packaging':
215
+ assert not widget.action_button.isEnabled()
216
+ assert widget.warning_tooltip.isVisible()
217
+ else:
218
+ assert widget.action_button.isEnabled()
219
+ assert not widget.warning_tooltip.isVisible()
234
220
 
235
221
 
236
222
  def test_filter_available_plugins(plugin_dialog, qtbot):
@@ -260,7 +246,7 @@ def test_filter_installed_plugins(plugin_dialog, qtbot):
260
246
  """
261
247
  plugin_dialog.search('')
262
248
  qtbot.wait(500)
263
- assert plugin_dialog.installed_list.count_visible() == 2
249
+ assert plugin_dialog.installed_list.count_visible() == 1
264
250
 
265
251
  plugin_dialog.search('no-match@123')
266
252
  qtbot.wait(500)
@@ -295,7 +281,7 @@ def test_version_dropdown(plugin_dialog, qtbot):
295
281
 
296
282
 
297
283
  def test_plugin_list_count_items(plugin_dialog):
298
- assert plugin_dialog.installed_list.count_visible() == 2
284
+ assert plugin_dialog.installed_list.count_visible() == 1
299
285
 
300
286
 
301
287
  def test_plugin_list_handle_action(plugin_dialog, qtbot):
@@ -361,15 +347,6 @@ def test_on_enabled_checkbox(plugin_dialog, qtbot, plugins, old_plugins):
361
347
  widget.enabled_checkbox.setChecked(False)
362
348
  assert plugins.plugins['my-plugin'] is False
363
349
 
364
- # checks npe1 lines
365
- item = plugin_dialog.installed_list.item(1)
366
- widget = plugin_dialog.installed_list.itemWidget(item)
367
-
368
- assert old_plugins.enabled[0] is True
369
- with qtbot.waitSignal(widget.enabled_checkbox.stateChanged, timeout=500):
370
- widget.enabled_checkbox.setChecked(False)
371
- assert old_plugins.enabled[0] is False
372
-
373
350
 
374
351
  def test_add_items_outdated_and_update(plugin_dialog, qtbot):
375
352
  """
@@ -465,11 +442,6 @@ def test_drop_event(plugin_dialog, tmp_path):
465
442
  assert plugin_dialog.direct_entry_edit.text() == str(path_1)
466
443
 
467
444
 
468
- @pytest.mark.skipif(
469
- 'napari_latest' in os.getenv('TOX_ENV_NAME', '')
470
- and 'PySide2' in os.getenv('TOX_ENV_NAME', ''),
471
- reason='PySide2 flaky with latest released napari',
472
- )
473
445
  def test_installs(qtbot, tmp_virtualenv, plugin_dialog, request):
474
446
  if '[constructor]' in request.node.name:
475
447
  pytest.skip(
@@ -554,7 +526,7 @@ def test_cancel(qtbot, tmp_virtualenv, plugin_dialog, request):
554
526
  assert process_finished_data['action'] == InstallerActions.CANCEL
555
527
  assert process_finished_data['pkgs'][0].startswith('requests')
556
528
  assert plugin_dialog.available_list.count() == 1
557
- assert plugin_dialog.installed_list.count() == 2
529
+ assert plugin_dialog.installed_list.count() == 1
558
530
 
559
531
 
560
532
  def test_cancel_all(qtbot, tmp_virtualenv, plugin_dialog, request):
@@ -581,7 +553,7 @@ def test_cancel_all(qtbot, tmp_virtualenv, plugin_dialog, request):
581
553
  qtbot.wait(500)
582
554
 
583
555
  assert plugin_dialog.available_list.count() == 2
584
- assert plugin_dialog.installed_list.count() == 2
556
+ assert plugin_dialog.installed_list.count() == 1
585
557
 
586
558
 
587
559
  def test_direct_entry_installs(qtbot, tmp_virtualenv, plugin_dialog, request):
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.1.8'
32
- __version_tuple__ = version_tuple = (0, 1, 8)
31
+ __version__ = version = '0.1.9'
32
+ __version_tuple__ = version_tuple = (0, 1, 9)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -10,6 +10,8 @@ Available actions for each tool are `install`, `uninstall`
10
10
  and `cancel`.
11
11
  """
12
12
 
13
+ from __future__ import annotations
14
+
13
15
  import contextlib
14
16
  import os
15
17
  import sys
@@ -407,7 +409,7 @@ class InstallerQueue(QObject):
407
409
  item = self._build_queue_item(
408
410
  tool=tool,
409
411
  action=InstallerActions.INSTALL,
410
- pkgs=pkgs,
412
+ pkgs=tuple(pkgs),
411
413
  prefix=prefix,
412
414
  origins=origins,
413
415
  process=self._create_process(),
@@ -448,7 +450,7 @@ class InstallerQueue(QObject):
448
450
  item = self._build_queue_item(
449
451
  tool=tool,
450
452
  action=InstallerActions.UPGRADE,
451
- pkgs=pkgs,
453
+ pkgs=tuple(pkgs),
452
454
  prefix=prefix,
453
455
  origins=origins,
454
456
  process=self._create_process(),
@@ -485,7 +487,7 @@ class InstallerQueue(QObject):
485
487
  item = self._build_queue_item(
486
488
  tool=tool,
487
489
  action=InstallerActions.UNINSTALL,
488
- pkgs=pkgs,
490
+ pkgs=tuple(pkgs),
489
491
  prefix=prefix,
490
492
  process=self._create_process(),
491
493
  **kwargs,
@@ -563,7 +565,7 @@ class InstallerQueue(QObject):
563
565
  'exit_code': 1,
564
566
  'exit_status': 0,
565
567
  'action': InstallerActions.CANCEL_ALL,
566
- 'pkgs': all_pkgs,
568
+ 'pkgs': tuple(all_pkgs),
567
569
  }
568
570
  )
569
571
  self._process_queue()
@@ -190,7 +190,9 @@ class QtPluginDialog(BaseQtPluginDialog):
190
190
  self.setStyleSheet(stylesheet)
191
191
 
192
192
  def _add_installed(self, pkg_name: str | None = None) -> None:
193
- use_npe2_adaptor = get_settings().plugins.use_npe2_adaptor
193
+ use_npe2_adaptor = getattr(
194
+ get_settings().plugins, 'use_npe2_adaptor', True
195
+ )
194
196
  pm2 = npe2.PluginManager.instance()
195
197
  pm2.discover(include_npe1=use_npe2_adaptor)
196
198
  for manifest in pm2.iter_manifests():
@@ -205,6 +207,7 @@ class QtPluginDialog(BaseQtPluginDialog):
205
207
  distname, enabled, distname, plugin_api_version=npev
206
208
  )
207
209
 
210
+ # for old napari versions that still have the setting
208
211
  if not use_npe2_adaptor:
209
212
  napari.plugins.plugin_manager.discover() # since they might not be loaded yet
210
213
  for (
@@ -242,9 +245,6 @@ class QtPluginDialog(BaseQtPluginDialog):
242
245
  break
243
246
 
244
247
  def _fetch_available_plugins(self, clear_cache: bool = False) -> None:
245
- settings = get_settings()
246
- use_npe2_adaptor = settings.plugins.use_npe2_adaptor
247
-
248
248
  if clear_cache:
249
249
  cache_clear()
250
250
 
@@ -256,6 +256,9 @@ class QtPluginDialog(BaseQtPluginDialog):
256
256
  self.worker.finished.connect(self.search)
257
257
  self.worker.start()
258
258
 
259
+ use_npe2_adaptor = getattr(
260
+ get_settings().plugins, 'use_npe2_adaptor', True
261
+ )
259
262
  pm2 = npe2.PluginManager.instance()
260
263
  pm2.discover(include_npe1=use_npe2_adaptor)
261
264
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: napari-plugin-manager
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Install plugins for napari, in napari.
5
5
  Author-email: napari team <napari-steering-council@googlegroups.com>
6
6
  License-Expression: BSD-3-Clause
@@ -44,7 +44,7 @@ Requires-Dist: napari-plugin-manager[uv]; extra == "testing"
44
44
  Requires-Dist: coverage; extra == "testing"
45
45
  Requires-Dist: flaky; extra == "testing"
46
46
  Requires-Dist: pytest; extra == "testing"
47
- Requires-Dist: pytest-qt<4.5; extra == "testing"
47
+ Requires-Dist: pytest-qt; extra == "testing"
48
48
  Requires-Dist: virtualenv; extra == "testing"
49
49
  Provides-Extra: docs
50
50
  Requires-Dist: sphinx>6; extra == "docs"
@@ -1,10 +1,10 @@
1
1
  napari_plugin_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- napari_plugin_manager/_version.py,sha256=Zaz3s9gl_rzsS46-ymJOALojMxviW77EJq_agE8knLk,704
3
- napari_plugin_manager/base_qt_package_installer.py,sha256=rWsD1BvJL3RG9pBEJEaUH5ugGzg4sVgQVg0RHKnP6us,24487
2
+ napari_plugin_manager/_version.py,sha256=ib8ckvf-NNDfacXd8unW0p5cf-gl57XyQvjoEMc_pvc,704
3
+ napari_plugin_manager/base_qt_package_installer.py,sha256=O5WgL23H9Y2ozVsdZ1eBf0nnmb8QtP7DVVXav2KSEtY,24551
4
4
  napari_plugin_manager/base_qt_plugin_dialog.py,sha256=0NDzTN7Bxek5mr4DZDPJVddh1eDjIwZtUxeKFSCQToA,67432
5
5
  napari_plugin_manager/npe2api.py,sha256=gAPOC-g0GWAwN71m0GimM0SW6YHI39XxSJm_qhq3-OY,4352
6
6
  napari_plugin_manager/qt_package_installer.py,sha256=QFQDED3MKbQupKF7OjBPz70cK2zrgIP2gu4vdUVV8Tk,3511
7
- napari_plugin_manager/qt_plugin_dialog.py,sha256=8GcaQuSWF5jZHcdn6j2Ye6liJ5yRDjtnuqenpVSyfkM,10208
7
+ napari_plugin_manager/qt_plugin_dialog.py,sha256=seaKKoeFsPK7L2z4fj6-UGuNYBqZ1I-U54AcZ0uu9Ok,10321
8
8
  napari_plugin_manager/qt_warning_dialog.py,sha256=DtPoFBn7zDfSmkdMokm1BcuoYasngkC0jwJok-oIuGk,727
9
9
  napari_plugin_manager/qt_widgets.py,sha256=OatVQPuJFP5sgYRq_KiaynwXI3UfLGiTwBRlFy-b5mk,399
10
10
  napari_plugin_manager/styles.qss,sha256=2oJBNiLT3YtqQP3avQGAOWcSSOZiFHGDsHtI5TjjxuA,7928
@@ -12,12 +12,12 @@ napari_plugin_manager/utils.py,sha256=vGvOndyiwc_JaSHVtXIc9z-dGsewo_vRb31U-26vy2
12
12
  napari_plugin_manager/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  napari_plugin_manager/_tests/conftest.py,sha256=Bm8u6hT5-mQXaxamke79tJGrU8BZA3V444YBLPivVr8,1885
14
14
  napari_plugin_manager/_tests/test_base_installer_process.py,sha256=Cv-nBnUeNAX6pYUE1zs38I9vGtCE-ahBN4q-xcBH-pw,561
15
- napari_plugin_manager/_tests/test_installer_process.py,sha256=CshbV0OGzmL0kus9_0AvrEOU_vleMdSmPPo0RbCizMw,12760
15
+ napari_plugin_manager/_tests/test_installer_process.py,sha256=0kyPzUcx1-yVc21B0HQkf4TCLnkDWBDtaJU-UXSVk1s,12821
16
16
  napari_plugin_manager/_tests/test_npe2api.py,sha256=ncBGWHrA5uZjmt6w4lVlx8D-n_3At1bfAZgkMRxK7Lg,1275
17
- napari_plugin_manager/_tests/test_qt_plugin_dialog.py,sha256=4zGIfLomCCC-rTebkf6ggXd8Tedx6mi7GtmRv6IKTj4,21670
17
+ napari_plugin_manager/_tests/test_qt_plugin_dialog.py,sha256=Rcfaho94vM7iwumU4n6ygyP5O3E7lsXIpoAwpXmI2YA,20702
18
18
  napari_plugin_manager/_tests/test_utils.py,sha256=rAlqp8y1MR3U4nWCN1jekbvP_avket3fVgEQwJDqpKk,1674
19
- napari_plugin_manager-0.1.8.dist-info/licenses/LICENSE,sha256=8dAlKbOqTMYe9L-gL_kEx5Xr1Sd0AbaWQDUkpiOp3vI,1506
20
- napari_plugin_manager-0.1.8.dist-info/METADATA,sha256=tlRDPoC294ZIMKgzCzHVtW2sy4CtgbVs_waCIOlz2dk,12159
21
- napari_plugin_manager-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- napari_plugin_manager-0.1.8.dist-info/top_level.txt,sha256=pmCqLetuumhY1CKSuTZ5eQsitzazrSvc7V_mkugEPTY,22
23
- napari_plugin_manager-0.1.8.dist-info/RECORD,,
19
+ napari_plugin_manager-0.1.9.dist-info/licenses/LICENSE,sha256=8dAlKbOqTMYe9L-gL_kEx5Xr1Sd0AbaWQDUkpiOp3vI,1506
20
+ napari_plugin_manager-0.1.9.dist-info/METADATA,sha256=tsF-_gWnA_owBaG2wpfBptVqbZCtoSUyV9_nXiL9xMs,12155
21
+ napari_plugin_manager-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ napari_plugin_manager-0.1.9.dist-info/top_level.txt,sha256=pmCqLetuumhY1CKSuTZ5eQsitzazrSvc7V_mkugEPTY,22
23
+ napari_plugin_manager-0.1.9.dist-info/RECORD,,