Skip to content

Small cleanup #498

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

Merged
merged 10 commits into from
May 1, 2024
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,32 @@ Questions, issues, ideas? Post an [issue](https://github.com/fastplotlib/fastplo

# Installation

Install using `pip`.

### Minimal, use with your own `Qt` or `glfw` applications
```bash
pip install fastplotlib
```

**This does not give you `Qt` or `glfw`, you will have to install one of them yourself depending on your preference**.
**This does not give you `PyQt`/`PySide` or `glfw`, you will have to install your preferred GUI framework separately**.

### Notebook
```bash
pip install "fastplotlib[notebook]"
```

**Recommended: install `simplejpeg` for much faster notebook visualization, this requires you to first install [libjpeg-turbo](https://libjpeg-turbo.org/)**
**Strongly recommended: install `simplejpeg` for much faster notebook visualization, this requires you to first install [libjpeg-turbo](https://libjpeg-turbo.org/)**

```bash
pip install simplejpeg
```

> **Note**
>
> `fastplotlib` and `pygfx` are fast evolving projects, the version available through pip might be outdated, you will need to follow the "For developers" instructions below if you want the latest features. You can find the release history on pypi here: https://pypi.org/project/fastplotlib/#history
> `fastplotlib` and `pygfx` are fast evolving projects, the version available through pip might be outdated, you will need to follow the "For developers" instructions below if you want the latest features. You can find the release history here: https://github.com/fastplotlib/fastplotlib/releases

### For developers

Make sure you have [git-lfs](https://github.com/git-lfs/git-lfs#installing) installed.

```bash
git clone https://github.com/fastplotlib/fastplotlib.git
cd fastplotlib
Expand All @@ -88,16 +89,20 @@ cd fastplotlib
pip install -e ".[notebook,docs,tests]"
```

Se [Contributing](https://github.com/fastplotlib/fastplotlib?tab=readme-ov-file#heart-contributing) for more details on development

# Examples

> **Note**
>
> `fastplotlib` and `pygfx` are fast evolving, you may require the latest `pygfx` and `fastplotlib` from github to use the examples in the main branch.
> **Note:** `fastplotlib` and `pygfx` are fast evolving, you will probably require the latest `pygfx` and `fastplotlib` from github to use the examples in the main branch.

`fastplotlib` code is identical across notebook (`jupyter`), and desktop use with `Qt`/`PySide` or `glfw`.

Note that `fastplotlib` code is basically identical between desktop and notebook usage. The differences are:
Even if you do not intend to use notebooks with `fastplotlib`, the `quickstart.ipynb` notebook is currently the best way to get familiar with the API: https://github.com/fastplotlib/fastplotlib/tree/main/examples/notebooks/quickstart.ipynb

The specifics for running `fastplotlib` in different GUI frameworks are:
- Running in `glfw` requires a `fastplotlib.run()` call (which is really just a `wgpu` `run()` call)
- To use it in `Qt` you must encapsulate it within a `QApplication`, see `examples/qt`
- Notebooks plots have ipywidget-based toolbars and widgets 😄
- With `Qt` you can encapsulate it within a `QApplication`, see `examples/qt`
- Notebooks plots have ipywidget-based toolbars and widgets. There are plans to move toward an identical in-canvas toolbar with UI elements across all supported frameworks 😄

### Desktop examples using `glfw` or `Qt`

Expand All @@ -120,7 +125,7 @@ Notebook examples are here:

https://github.com/fastplotlib/fastplotlib/tree/main/examples/notebooks

**Start with `simple.ipynb`.**
**Start with `quickstart.ipynb`.**

Some of the examples require imageio:
```
Expand All @@ -135,7 +140,9 @@ Our SciPy 2023 talk walks through numerous demos: https://github.com/fastplotlib

You will need a relatively modern GPU (newer integrated GPUs in CPUs are usually fine). Generally if your GPU is from 2017 or later it should be fine.

For more information see: https://wgpu-py.readthedocs.io/en/stable/start.html#platform-requirements
For more detailed information, such as use on cloud computing infrastructure, see: https://wgpu-py.readthedocs.io/en/stable/start.html#platform-requirements

Some more information on GPUs is here: https://fastplotlib.readthedocs.io/en/latest/user_guide/gpu.html

### Windows:
Vulkan drivers should be installed by default on Windows 11, but you will need to install your GPU manufacturer's driver package (Nvidia or AMD). If you have an integrated GPU within your CPU, you might still need to install a driver package too, check your CPU manufacturer's info.
Expand All @@ -162,7 +169,7 @@ sudo apt install llvm-dev libturbojpeg* libgl1-mesa-dev libgl1-mesa-glx libglapi
```

### Mac OSX:
WGPU uses Metal instead of Vulkan on Mac. You will need at least Mac OSX 10.13. The OS should come with Metal pre-installed so you should be good to go!
WGPU uses Metal instead of Vulkan on Mac. You will need at least Mac OSX 10.13. The OS should come with Metal pre-installed, so you should be good to go!

# :heart: Contributing

Expand Down
21 changes: 9 additions & 12 deletions examples/notebooks/nb_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
# store all the failures to allow the nb to proceed to test other examples
FAILURES = list()

if "FASTPLOTLIB_NB_TESTS" not in os.environ.keys():
TESTING = False

else:
if os.environ["FASTPLOTLIB_NB_TESTS"] == "1":
TESTING = True


# TODO: consolidate testing functions into one module so we don't have this separate one for notebooks

Expand Down Expand Up @@ -83,18 +90,8 @@ def normalize_image(img):
return img


def _run_tests():
if "FASTPLOTLIB_NB_TESTS" not in os.environ.keys():
return False

if os.environ["FASTPLOTLIB_NB_TESTS"] == "1":
return True

return False


def plot_test(name, fig: fpl.Figure):
if not _run_tests():
if not TESTING:
return

snapshot = fig.canvas.snapshot()
Expand Down Expand Up @@ -157,7 +154,7 @@ def get_diffs_rgba(slicer):


def notebook_finished():
if not _run_tests():
if not TESTING:
return

if len(FAILURES) > 0:
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy