cubevis 0.5.18__py3-none-any.whl → 0.5.20__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.

Potentially problematic release.


This version of cubevis might be problematic. Click here for more details.

cubevis/utils/__init__.py CHANGED
@@ -43,6 +43,7 @@ from ._regions import polygon_indexes
43
43
  from ._docenum import DocEnum
44
44
  from ._copydoc import copydoc
45
45
  from ._pkgs import find_pkg, load_pkg
46
+ from ._jupyter import is_interactive_jupyter
46
47
 
47
48
  from astropy import units
48
49
  from regions import PixCoord
@@ -604,17 +605,3 @@ def set_attributes(obj, **kw):
604
605
  return obj
605
606
 
606
607
 
607
- def is_notebook() -> bool:
608
- try:
609
- shell = get_ipython().__class__.__name__
610
- if shell == 'ZMQInteractiveShell':
611
- return True # Jupyter notebook or qtconsole
612
- elif shell == 'TerminalInteractiveShell':
613
- return False # Terminal running IPython
614
- else:
615
- if get_ipython().__class__.__module__ == 'google.colab._shell':
616
- return True # Google Colab
617
- else:
618
- return False # Other type (?)
619
- except NameError:
620
- return False
@@ -0,0 +1,92 @@
1
+
2
+ #def is_notebook() -> bool:
3
+ # try:
4
+ # shell = get_ipython().__class__.__name__
5
+ # if shell == 'ZMQInteractiveShell':
6
+ # return True # Jupyter notebook or qtconsole
7
+ # elif shell == 'TerminalInteractiveShell':
8
+ # return False # Terminal running IPython
9
+ # else:
10
+ # if get_ipython().__class__.__module__ == 'google.colab._shell':
11
+ # return True # Google Colab
12
+ # else:
13
+ # return False # Other type (?)
14
+ # except NameError:
15
+ # return False
16
+
17
+ def is_interactive_jupyter( ) -> bool:
18
+ """
19
+ Detect if running in an interactive Jupyter notebook with frontend connection.
20
+
21
+ This function distinguishes between:
22
+ - Interactive Jupyter notebook/lab with frontend (returns True)
23
+ - Standalone Jupyter kernel without frontend (returns False)
24
+ - Regular Python interpreter (returns False)
25
+
26
+ Returns:
27
+ bool: True if running in interactive Jupyter with frontend, False otherwise
28
+ """
29
+ try:
30
+ from IPython import get_ipython
31
+ ipython = get_ipython()
32
+
33
+ if ipython is None:
34
+ return False
35
+
36
+ # Check if we're in a ZMQ-based shell (kernel)
37
+ if ipython.__class__.__name__ != 'ZMQInteractiveShell':
38
+ return False
39
+
40
+ # Check for active frontend connection
41
+ if hasattr(ipython, 'kernel') and ipython.kernel is not None:
42
+ kernel = ipython.kernel
43
+
44
+ # Method 1: Check if there are active connections
45
+ if hasattr(kernel, 'shell_socket') and kernel.shell_socket is not None:
46
+ # For newer Jupyter versions, check connection count
47
+ if hasattr(kernel, 'connection_count'):
48
+ return kernel.connection_count > 0
49
+
50
+ # For older versions, check if socket is connected
51
+ try:
52
+ # Try to get socket state - if it fails, likely no frontend
53
+ socket_state = kernel.shell_socket.closed
54
+ return not socket_state
55
+ except AttributeError:
56
+ pass
57
+
58
+ # Method 2: Check parent message (indicates interactive execution)
59
+ if hasattr(kernel, 'get_parent') and callable(kernel.get_parent):
60
+ try:
61
+ parent = kernel.get_parent()
62
+ # If there's a parent message, we're likely in interactive mode
63
+ return parent is not None and len(parent) > 0
64
+ except Exception:
65
+ pass
66
+
67
+ # Method 3: Check for execution context
68
+ if hasattr(kernel, '_parent_ident') and kernel._parent_ident:
69
+ return True
70
+
71
+ # Fallback: Check for common Jupyter notebook environment indicators
72
+ # This catches cases where kernel introspection doesn't work
73
+ import os
74
+ jupyter_indicators = [
75
+ 'JPY_PARENT_PID', # JupyterLab/Notebook sets this
76
+ 'JUPYTER_RUNTIME_DIR',
77
+ ]
78
+
79
+ for indicator in jupyter_indicators:
80
+ if indicator in os.environ:
81
+ # Additional check: see if we can import notebook-specific modules
82
+ try:
83
+ import IPython.display
84
+ # If we can import display and have env indicators, likely interactive
85
+ return True
86
+ except ImportError:
87
+ pass
88
+
89
+ return False
90
+
91
+ except ImportError:
92
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cubevis
3
- Version: 0.5.18
3
+ Version: 0.5.20
4
4
  Summary: visualization toolkit and apps for casa
5
5
  License: LGPL
6
6
  Author-email: Darrell Schiebel <darrell@schiebel.us>,Pam Harris <pharris@nrao.edu>
@@ -24,7 +24,7 @@ cubevis/__icons__/sub-cube.png,sha256=mtv21frhc_GuXsfDlUa-0xQzym3Ii4TZiQGm4MFYjr
24
24
  cubevis/__icons__/sub-cube.svg,sha256=tDCFZ2Es6b8HTiBpgLPG0cOOnlS8dI7LbE2KQxEWFw4,6391
25
25
  cubevis/__icons__/zoom-to-fit.png,sha256=aozGbrkoBX1q9kV0p272bg0YKGje1gIfVBkFZRlLAXs,9592
26
26
  cubevis/__icons__/zoom-to-fit.svg,sha256=NtYorWvH4s68iAMriqCPGuTBX5SsgVN310UXGKDM7i8,1802
27
- cubevis/__init__.py,sha256=uLahNBl4y3LitACJmbSWsn_aI9bpXk085MIcbIFZ2pk,2632
27
+ cubevis/__init__.py,sha256=63Y0ROAWuHV1ZHJ8JX7NZl9GQJOaNZI3P1RAhIQkdd0,3296
28
28
  cubevis/__js__/bokeh-3.6.1.min.js,sha256=SPRs94Q-H-aj8MCsXNu4ok1ouQQLTgXxZnk0-BBAOl4,1092280
29
29
  cubevis/__js__/bokeh-tables-3.6.1.min.js,sha256=wINufoBiINmP_PERwhN_1GkidJOsJQ_3vFKUDui7rl8,301216
30
30
  cubevis/__js__/bokeh-widgets-3.6.1.min.js,sha256=NE3tFbbxoaMjnJ0XednWJxbAGl-vSR0fxE_kX8keuDQ,311821
@@ -69,13 +69,17 @@ cubevis/bokeh/utils/_axes_labels.py,sha256=VBeFeYIJfjxGGHPM0r82P01y1pRrXg5j0Cbk6
69
69
  cubevis/bokeh/utils/_svg_icon.py,sha256=Q46oIZCh1TzhkKVMHHRIgU1HwX624z3C_M4Ko7vY__c,23331
70
70
  cubevis/data/__init__.py,sha256=_j5cRA9l9Nl0ycL_SsbeLP1Uil_q1ldiVKJk5IeRFx8,77
71
71
  cubevis/data/casaimage/__init__.py,sha256=55ebo9hReK8DdnVDiFK25wYDGizQoRvjcKCIQCdgEck,3606
72
+ cubevis/exe/__init__.py,sha256=kH6dvUS_gjzlPxT1V-PU8ZCKvUTwIqJ-Es5UMfH9D9A,108
73
+ cubevis/exe/_context.py,sha256=hcfn1YYXeIo8Jl_2HV0m2D2Qpo9z4qOunMJovThNctE,5676
74
+ cubevis/exe/_mode.py,sha256=s7i19DY_BWESgqKdRQRnQaR5EK52rym4yu2eSylOHgA,139
75
+ cubevis/exe/_setting.py,sha256=c1ioJ89KY6GszBXsrSPvhGwJNpQsXT1R65Xf21VPog0,67
76
+ cubevis/exe/_task.py,sha256=eslV_iUsDLaDqSkNLNEtzQg73FC9NJJLsPBss5TqFvA,10912
72
77
  cubevis/private/_gclean.py,sha256=ExdR6cRxSa6Xne2veGNKhbTtx-tXUIWr2htzEmEZ9Z4,41107
73
78
  cubevis/private/apps/__init__.py,sha256=NIC0XCfjInbAmteORFWtohMvq3Nf8EZ5bsvvUpDYSig,2679
74
- cubevis/private/apps/_createmask.py,sha256=ErtBrOUq20_xZGXY4gw92lvs2D71SVxx5Osi-dNgW_I,23570
75
- cubevis/private/apps/_createregion.py,sha256=z8vYIHfFWjIqg5_CECVFtF7wLhN7qFY8L09QB8UMfmU,26702
76
- cubevis/private/apps/_interactiveclean.mustache,sha256=nDxeRB6DyyZ2L5-_5woh9fYVQXHs9n7KDMdgzZAu5b0,103878
77
- cubevis/private/apps/_interactiveclean.py,sha256=T6IPjq4FpcLDmpQxmEQrzUqUZ-fsTZwPmylcUL468n0,241529
78
- cubevis/private/apps/_interactiveclean_wrappers.py,sha256=XqyCGz33CMDhszTxnwZ_3-64GszUK1XYnGKUOxl9sas,5071
79
+ cubevis/private/apps/_createmask.py,sha256=kLwb138M3CyZWG2MIv0-1jdpxjpelmroY_85KlSJptA,23592
80
+ cubevis/private/apps/_createregion.py,sha256=OHZzTUaQ8Ofl5xt2mCrhXEDkfED-B3TxL-TCi7EXVeo,26724
81
+ cubevis/private/apps/_interactiveclean.mustache,sha256=dkw7_4yH6kbArGYv8UorvJMuQEsTuD5Ez3gV-YNNVzI,3698
82
+ cubevis/private/apps/_interactiveclean.py,sha256=qhmHelx85WC9WQNc_nCRvzJ75qi1XwwCB0dwoXtWGTc,139199
79
83
  cubevis/private/apps/_plotants.py,sha256=top6VWVd_sE48IVPH_sIg3_sQeDl5tadi5DL7r5tUEI,10823
80
84
  cubevis/private/apps/_plotbandpass.py,sha256=NwOgKSRnpLw9Pt3KIdBpoV78q1OnjCvj6lWFqeyICt8,185
81
85
  cubevis/private/casashell/createmask.py,sha256=C1eSUUsttSGghjZ5aDUVhRxnjir5MlYXVyxzEYLcI3k,14457
@@ -89,24 +93,28 @@ cubevis/remote/__init__.py,sha256=0LgSfWUw8cYnVrOYGq3o15tWJPkgcvTyYIrvRSAW6N8,12
89
93
  cubevis/remote/_gclean.py,sha256=TpmCmCUtMjqOFnA2wtYdp4EJo-59DyI00aaTWQbMQU4,1930
90
94
  cubevis/remote/_local.py,sha256=PcPCFcwttTFZd3O33-5pqDuGKQKK6CA0gz1MTIkTiNI,10326
91
95
  cubevis/remote/_remote_kernel.py,sha256=wfu7ZzKn-oCxZxzDIkC5puBvGf8WbCLYL3CzM56_FNc,2652
92
- cubevis/toolbox/__init__.py,sha256=VqxO5Izv0nEjhPbqTUH1jo8SQoyj5YrSbs7m42N8Rm0,1433
96
+ cubevis/toolbox/__init__.py,sha256=xzqwAG9863d7UKBVBRw7FrRUQbvCdFcLBq4vTpg63DU,1487
93
97
  cubevis/toolbox/_app_context.py,sha256=0tRY2SSbSCM6RKLFs_T707_ehWkJXPvnLlE1P9cLXJY,3024
94
- cubevis/toolbox/_cube.py,sha256=Qx0ZMfIq6Qw82DPGVeupEF0c4jCzcWIVN8OcSpfN0Ew,294187
98
+ cubevis/toolbox/_cube.py,sha256=Thq7hZkcIjhlBf8nlYajyt-JZU1kkVG51VPTO1bHiqQ,294209
99
+ cubevis/toolbox/_interactive_clean_ui.mustache,sha256=DKmy6dMpGOq4aZImorhF0K2wOV0oi58qkv7o4CdDJEM,103985
100
+ cubevis/toolbox/_interactive_clean_ui.py,sha256=I9ikjAJjN64gxql_CXoiUCg5wTclrV1pENGbDVczFic,103896
101
+ cubevis/toolbox/_interactiveclean_wrappers.py,sha256=XqyCGz33CMDhszTxnwZ_3-64GszUK1XYnGKUOxl9sas,5071
95
102
  cubevis/toolbox/_region_list.py,sha256=_1RvnXwqMoaAq8CPy-6IyhabLi_snXqO566onehI2y0,8957
96
103
  cubevis/utils/_ResourceManager.py,sha256=SaaR29etabRiKxmUK-aWvAm4v_OPFJH8CX7bNFm0Lgo,3410
97
- cubevis/utils/__init__.py,sha256=bVAMnKLIVmQM6ShL_deOuHW0Zi2wcDP8lh5agWRRDDc,23190
104
+ cubevis/utils/__init__.py,sha256=B_2a0yTCurZWiZfg8dUprcNsqNh205thg7KmpcPRNfE,22705
98
105
  cubevis/utils/_contextmgrchain.py,sha256=r5SrCBdgQIVH7zXKOmq5oWhDUSeHaZpgsIfWFHvb3cQ,2859
99
106
  cubevis/utils/_conversion.py,sha256=SziCU8sOGtG7djlY766-MeOvnQgvT9C737FEfJ4aYsE,3262
100
107
  cubevis/utils/_copydoc.py,sha256=SI9DOUoTNg9M-Y4J1oci2Ba1jebGHsx_pFX24RSNg3o,1915
101
108
  cubevis/utils/_docenum.py,sha256=D79BvxwW18DPUlIhBx5DnpZh76pDURC1Hqt1DfS7kG0,877
102
109
  cubevis/utils/_import_protected_module.py,sha256=AIISHPdiSzwgVzLXqHSWSHT-L7lcMWbYrsMlGlTFafE,1482
110
+ cubevis/utils/_jupyter.py,sha256=-vYl7UPdSIhrsRrM4ZOi7pY0IEF7Fkm7nAwNOvugU10,3487
103
111
  cubevis/utils/_logging.py,sha256=HqyoTib7QSuAUbzicPVMdhFtxWKo-Dv4GgD0AYDDXIY,2348
104
112
  cubevis/utils/_pkgs.py,sha256=mu2CCzndmJZYP81UkFhxveW_CisWLUvagJVolHOEVgM,2294
105
113
  cubevis/utils/_regions.py,sha256=TdAg4ZUUyhg3nFmX9_KLboqmc0LkyOdEW8M1WDR5Udk,1669
106
114
  cubevis/utils/_static.py,sha256=rN-sqXNqQ5R2M3wmPHU1GPP5OTyyWQlUPRuimCrht-g,2347
107
115
  cubevis/utils/_tiles.py,sha256=A9W1X61VOhBMTOKXVajzOIoiV2FBdO5N2SFB9SUpDOo,7336
108
- cubevis/__version__.py,sha256=x-LzH_lvwIvxQ01UgnkF9gRdwqZjvbOC5XzZ3R3DEIA,22
109
- cubevis-0.5.18.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
110
- cubevis-0.5.18.dist-info/METADATA,sha256=jxZQ2g8XhAvvTMvkva_3LquivWPaMImR0zp4OQdPfWo,2629
111
- cubevis-0.5.18.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
112
- cubevis-0.5.18.dist-info/RECORD,,
116
+ cubevis/__version__.py,sha256=bbEUnnbmrAx_dnzwIXl25PQFBZ33ireht4OTMK8ZdOY,22
117
+ cubevis-0.5.20.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
118
+ cubevis-0.5.20.dist-info/METADATA,sha256=teWxkX2KoDOXJUe_Prm_W07PUJk6vgWM1CaDWSUYZxI,2629
119
+ cubevis-0.5.20.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
120
+ cubevis-0.5.20.dist-info/RECORD,,