gpu info upon notebook import by kushalkolar · Pull Request #410 · fastplotlib/fastplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/pypi-publish.yml
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
recursive-include fastplotlib/utils/colormaps/ *
include fastplotlib/VERSION
recursive-include fastplotlib/assets/ *

11 changes: 11 additions & 0 deletions fastplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .layouts import Plot, GridPlot
from .graphics import *
from .graphics.selectors import *
from .utils import _notebook_print_banner, config

from wgpu.gui.auto import run

Expand All @@ -13,6 +14,16 @@
else:
from .widgets import ImageWidget

from wgpu.backends.wgpu_native import enumerate_adapters

adapters = [a.request_adapter_info() for a in enumerate_adapters()]

if len(adapters) < 1:
raise IndexError(
"No WGPU adapters found, fastplotlib will not work."
)

_notebook_print_banner()

with open(Path(__file__).parent.joinpath("VERSION"), "r") as f:
__version__ = f.read().split("\n")[0]
Expand Down
3 changes: 3 additions & 0 deletions fastplotlib/assets/egg.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions fastplotlib/assets/fastplotlib_face_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions fastplotlib/layouts/_frame/_ipywidget_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from itertools import product
from math import copysign
from functools import partial
from pathlib import Path
from typing import *


Expand All @@ -17,10 +18,12 @@
BoundedIntText,
Play,
jslink,
Image,
)

from ...graphics.selectors import PolygonSelector
from ._toolbar import ToolBar
from ...utils import config


class IpywidgetToolBar(HBox, ToolBar):
Expand Down Expand Up @@ -92,6 +95,19 @@ def __init__(self, plot):
self._record_button,
]

if config.party_parrot:
gif_path = Path(__file__).parent.parent.parent.joinpath("assets", "egg.gif")
with open(gif_path, "rb") as f:
gif = f.read()

image = Image(
value=gif,
format="png",
width=35,
height=25,
)
widgets.append(image)

if hasattr(self.plot, "_subplots"):
positions = list(product(range(self.plot.shape[0]), range(self.plot.shape[1])))
values = list()
Expand Down
14 changes: 14 additions & 0 deletions fastplotlib/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
from dataclasses import dataclass


from .functions import *
from ._gpu_info import _notebook_print_banner


@dataclass
class _Config:
party_parrot: bool


config = _Config(
party_parrot=False
)
66 changes: 66 additions & 0 deletions fastplotlib/utils/_gpu_info.py