Skip to main content


Pygfx

CI Documentation Status PyPI version Zenodo badge

The purpose of Pygfx is to bring powerful and reliable visualization to the Python world. 🚀

Pygfx (py-graphics) is built on wgpu, enabling superior performance and reliability compared to OpenGL-based solutions. It is designed for simplicity and versatility: with its modular architecture, you can effortlessly assemble graphical scenes for diverse applications, from scientific visualization to video game rendering.

drawing drawing drawing

[User Guide] [Example Gallery] [API Reference]

Need help? We offer professional support.

Installation

pip install -U pygfx glfw

To work correctly, Pygfx needs some window to render to. Glfw is one lightweight option, but there are others, too. If you use a different wgpu-compatible window manager or only render offscreen you may choose to omit glfw. Examples of alternatives include: jupyter_rfb (rendering in Jupyter), PyQt, PySide, or wx.

In addition there are some platform requirements, see the wgpu docs. In essence, you need modern (enough) graphics drivers, and pip>=20.3.

Status

We're currently working towards version 1.0, which means that the API can change with each version. We expect to reach 1.0 near July 2026, at which point we start caring about backwards compatibility.

This means that until then, you should probably pin the Pygfx version that you're using, and check the release notes when you update.

Usage Example

Note The example below is designed against the main branch, and may not work on the latest release from pypi, while we're in beta.

Note A walkthrough of this example can be found in the guide.

import pygfx as gfx
import pylinalg as la

cube = gfx.Mesh(
    gfx.box_geometry(200, 200, 200),
    gfx.MeshPhongMaterial(color="#336699"),
)

rot = la.quat_from_euler((0, 0.01), order="XY")

def animate():
    cube.local.rotation = la.quat_mul(rot, cube.local.rotation)

if __name__ == "__main__":
    gfx.show(cube, before_render=animate)
drawing

Feature Highlights

Some of Pygfx's key features are:

  • SDF based text rendering (example)
  • order-independent transparency (OIT) (example)
  • lights, shadows, and physically based rendering (PBR) (example)
  • event system with built-in picking (example)
  • texture and color mapping supporting 1D, 2D and 3D data (example)

And many more! Check out our feature demos in the docs.

License

Pygfx is licensed under the BSD 2-Clause "Simplified" License. This means:

  • :white_check_mark: It is free (and open source) forever. :cupid:
  • :white_check_mark: You can use it commercially.
  • :white_check_mark: You can distribute it and freely make changes.
  • :x: You can not hold us accountable for the results of using Pygfx.

Contributing

See CONTRIBUTING.md.

Development Install

To get a working dev install of Pygfx you can use the following steps:

# Click the Fork button on GitHub and navigate to your fork
git clone <address_of_your_fork>
cd pygfx
# if you use a venv, create and activate it
pip install -e ".[dev,docs,examples]"
pytest tests

Testing

The test suite is divided into three parts; unit tests for the core, unit tests for the examples, and screenshot tests for the validation examples.

  • pytest -v tests runs the core unit tests.
  • pytest -v examples tests the examples.

The screenshot tests are difficult to guarantee across all development platforms and are best run on our CI where more predictable outcomes can be achieved. They can run on a local linux machine by selecting the software rendering adapter and the tests with the command

  • PYGFX_WGPU_ADAPTER_NAME=llvmpipe pytest examples -k test_examples_compare

Note that our pytest.ini file contains the environment variable PYGFX_DISABLE_SYSTEM_FONTS=1 to help ensure consistency across system installations.

Code of Conduct

Our code of conduct can be found here: Code of Conduct

Spelling and pronunciation

Lowercase "pygfx" is used in code. You can refer to the project in written text using "Pygfx". Pygfx is pronounced as pie-graphics.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygfx-0.17.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygfx-0.17.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file pygfx-0.17.0.tar.gz.

File metadata

  • Download URL: pygfx-0.17.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pygfx-0.17.0.tar.gz
Algorithm Hash digest
SHA256 97759f7e4e8a35b278dab04426fd1b89a32499b117035d3e6074f69990b31553
MD5 a4db929761271d7f2afde2c51790df9e
BLAKE2b-256 1353cd5d8a4852c2209db6978d6d8d064e098958d74459ded659ff5c8d26c536

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygfx-0.17.0.tar.gz:

Publisher: ci.yml on pygfx/pygfx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygfx-0.17.0-py3-none-any.whl.

File metadata

  • Download URL: pygfx-0.17.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pygfx-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cea9776c75e9925ed5ce9dd8890ee365644ad911919d79a7e8f8de843dc69f59
MD5 6e88b8ae7d3529f13d3c709b77ede19a
BLAKE2b-256 20c2c3e1261089bc2368a33a617a37f9f31022961e6097fda6e6eea595d44da5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygfx-0.17.0-py3-none-any.whl:

Publisher: ci.yml on pygfx/pygfx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.17.0 This release

2 files

0.16.0

2 files

0.15.3

2 files

0.15.2

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page