pygfx


Namepygfx JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/pygfx/pygfx
SummaryA threejs-like render engine based on wgpu
upload_time2024-09-20 07:50:58
maintainerNone
docs_urlNone
authorAlmar Klein
requires_python>=3.8.0
licenseBSD 2-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center"><img src="docs/_static/pygfx.svg" height="80"><br>Pygfx</h1>

[![CI ](https://github.com/pygfx/pygfx/workflows/CI/badge.svg)
](https://github.com/pygfx/pygfx/actions)
[![Documentation Status
](https://readthedocs.org/projects/pygfx/badge/?version=stable)
](https://docs.pygfx.org)
[![PyPI version ](https://badge.fury.io/py/pygfx.svg)
](https://badge.fury.io/py/pygfx)

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

Pygfx (pronounced "py-graphics") is built on [wgpu](https://github.com/pygfx/wgpu-py/), 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.

<p align="center">
<img src="./docs/_static/readme_sponza.png" alt="drawing" width="200"/>
<img src="./docs/_static/readme_pbr_example.webp" alt="drawing" width="200"/>
<img src="./docs/_static/readme_torus_knot_wire.png" alt="drawing" width="200"/>
</p>
<p align="center">
[<a href="https://docs.pygfx.org/stable/guide.html">User Guide</a>]
[<a href="https://docs.pygfx.org/stable/_gallery/index.html">Example Gallery</a>]
[<a href="https://docs.pygfx.org/stable/reference.html">API Reference</a>]
</p>

## Professional support

Need help? We offer the following professional services:

* **Priority Support:** Rest assured with our dedicated support, prioritizing your needs for quick issue resolution and feature implementation.
* **Integration Support:** Get assistance with integrating Pygfx into your application, ensuring a smooth transition and optimal performance.
* **Customized Solutions:** Whether it's crafting specific visualizations or developing shaders, we work closely with you to create tailored solutions that address your unique requirements.
* **Training and Workshops:** We provide informative training sessions and workshops aimed at boosting skills and knowledge.

Also checkout the [sponsors page](https://github.com/sponsors/pygfx).
For further inquiries reach out to us at [support@pygfx.org](mailto:support@pygfx.org).

## Installation

```bash
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](https://wgpu-py.readthedocs.io/en/stable/start.html). 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 the end of
2024, 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](https://github.com/pygfx/pygfx/releases)
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](https://docs.pygfx.org/stable/guide.html#how-to-use-pygfx).

```python
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)

```
<img src="./docs/_static/guide_rotating_cube.gif" alt="drawing" width="400"/>


## Feature Highlights
Some of Pygfx's key features are:

- SDF based text rendering ([example](
  https://docs.pygfx.org/stable/_gallery/feature_demo/text_contrast.html))
- order-independent transparency (OIT) ([example](
  https://docs.pygfx.org/stable/_gallery/feature_demo/transparency2.html))
- lights, shadows, and physically based rendering (PBR) ([example](
  https://docs.pygfx.org/stable/_gallery/feature_demo/pbr.html))
- event system with built-in picking ([example](
  https://docs.pygfx.org/stable/_gallery/feature_demo/picking_points.html))
- texture and color mapping supporting 1D, 2D and 3D data ([example](
  https://docs.pygfx.org/stable/_gallery/feature_demo/colormap_channels.html))


And many more! Check out our [feature demos](
https://docs.pygfx.org/stable/_gallery/index.html) in the docs.

## License

Pygfx is licensed under the [BSD 2-Clause "Simplified" License](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](CONTRIBUTING.md).

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

```bash
# 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](./CODE_OF_CONDUCT.md)


## 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*.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pygfx/pygfx",
    "name": "pygfx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "Almar Klein",
    "author_email": "almar.klein@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ca/bd/c38d7d5a58c7955be01bbad95ada28ab0a349c1f638ab4519dae09841fe6/pygfx-0.5.0.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\"><img src=\"docs/_static/pygfx.svg\" height=\"80\"><br>Pygfx</h1>\n\n[![CI ](https://github.com/pygfx/pygfx/workflows/CI/badge.svg)\n](https://github.com/pygfx/pygfx/actions)\n[![Documentation Status\n](https://readthedocs.org/projects/pygfx/badge/?version=stable)\n](https://docs.pygfx.org)\n[![PyPI version ](https://badge.fury.io/py/pygfx.svg)\n](https://badge.fury.io/py/pygfx)\n\nPygfx' purpose is to bring powerful and reliable visualization to the Python world. \ud83d\ude80\n\nPygfx (pronounced \"py-graphics\") is built on [wgpu](https://github.com/pygfx/wgpu-py/), 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.\n\n<p align=\"center\">\n<img src=\"./docs/_static/readme_sponza.png\" alt=\"drawing\" width=\"200\"/>\n<img src=\"./docs/_static/readme_pbr_example.webp\" alt=\"drawing\" width=\"200\"/>\n<img src=\"./docs/_static/readme_torus_knot_wire.png\" alt=\"drawing\" width=\"200\"/>\n</p>\n<p align=\"center\">\n[<a href=\"https://docs.pygfx.org/stable/guide.html\">User Guide</a>]\n[<a href=\"https://docs.pygfx.org/stable/_gallery/index.html\">Example Gallery</a>]\n[<a href=\"https://docs.pygfx.org/stable/reference.html\">API Reference</a>]\n</p>\n\n## Professional support\n\nNeed help? We offer the following professional services:\n\n* **Priority Support:** Rest assured with our dedicated support, prioritizing your needs for quick issue resolution and feature implementation.\n* **Integration Support:** Get assistance with integrating Pygfx into your application, ensuring a smooth transition and optimal performance.\n* **Customized Solutions:** Whether it's crafting specific visualizations or developing shaders, we work closely with you to create tailored solutions that address your unique requirements.\n* **Training and Workshops:** We provide informative training sessions and workshops aimed at boosting skills and knowledge.\n\nAlso checkout the [sponsors page](https://github.com/sponsors/pygfx).\nFor further inquiries reach out to us at [support@pygfx.org](mailto:support@pygfx.org).\n\n## Installation\n\n```bash\npip install -U pygfx glfw\n```\n\nTo work correctly, Pygfx needs _some_ window to render to. Glfw is one\nlightweight option, but there are others, too. If you use a different\nwgpu-compatible window manager or only render offscreen you may choose to omit\nglfw. Examples of alternatives include: `jupyter_rfb` (rendering in Jupyter),\n`PyQt`, `PySide`, or `wx`.\n\nIn addition there are some platform\nrequirements, see the [wgpu docs](https://wgpu-py.readthedocs.io/en/stable/start.html). In\nessence, you need modern (enough) graphics drivers, and `pip>=20.3`.\n\n## Status\n\nWe're currently working towards version `1.0`, which means that the API\ncan change with each version. We expect to reach `1.0` near the end of\n2024, at which point we start caring about backwards compatibility.\n\nThis means that until then, you should probably pin the Pygfx version\nthat you're using, and check the [release notes](https://github.com/pygfx/pygfx/releases)\nwhen you update.\n\n## Usage Example\n\n> **Note**\n> The example below is designed against the `main` branch,\n> and may not work on the latest release from pypi, while we're in beta.\n\n> **Note**\n> A walkthrough of this example can be found in [the\n> guide](https://docs.pygfx.org/stable/guide.html#how-to-use-pygfx).\n\n```python\nimport pygfx as gfx\nimport pylinalg as la\n\ncube = gfx.Mesh(\n    gfx.box_geometry(200, 200, 200),\n    gfx.MeshPhongMaterial(color=\"#336699\"),\n)\n\nrot = la.quat_from_euler((0, 0.01), order=\"XY\")\n\ndef animate():\n    cube.local.rotation = la.quat_mul(rot, cube.local.rotation)\n\nif __name__ == \"__main__\":\n    gfx.show(cube, before_render=animate)\n\n```\n<img src=\"./docs/_static/guide_rotating_cube.gif\" alt=\"drawing\" width=\"400\"/>\n\n\n## Feature Highlights\nSome of Pygfx's key features are:\n\n- SDF based text rendering ([example](\n  https://docs.pygfx.org/stable/_gallery/feature_demo/text_contrast.html))\n- order-independent transparency (OIT) ([example](\n  https://docs.pygfx.org/stable/_gallery/feature_demo/transparency2.html))\n- lights, shadows, and physically based rendering (PBR) ([example](\n  https://docs.pygfx.org/stable/_gallery/feature_demo/pbr.html))\n- event system with built-in picking ([example](\n  https://docs.pygfx.org/stable/_gallery/feature_demo/picking_points.html))\n- texture and color mapping supporting 1D, 2D and 3D data ([example](\n  https://docs.pygfx.org/stable/_gallery/feature_demo/colormap_channels.html))\n\n\nAnd many more! Check out our [feature demos](\nhttps://docs.pygfx.org/stable/_gallery/index.html) in the docs.\n\n## License\n\nPygfx is licensed under the [BSD 2-Clause \"Simplified\" License](LICENSE). This means:\n\n- :white_check_mark: It is free (and open source) forever. :cupid:\n- :white_check_mark: You _can_ use it commercially.\n- :white_check_mark: You _can_ distribute it and freely make changes.\n- :x: You _can not_ hold us accountable for the results of using Pygfx.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n### Development Install\nTo get a working dev install of Pygfx you can use the following steps:\n\n```bash\n# Click the Fork button on GitHub and navigate to your fork\ngit clone <address_of_your_fork>\ncd pygfx\n# if you use a venv, create and activate it\npip install -e \".[dev,docs,examples]\"\npytest tests\n```\n\n### Testing\n\nThe test suite is divided into three parts; unit tests for the core, unit\ntests for the examples, and screenshot tests for the validation examples.\n\n* `pytest -v tests` runs the core unit tests.\n* `pytest -v examples` tests the examples.\n\nThe screenshot tests are difficult to guarantee across all development\nplatforms and are best run on our CI where more predictable outcomes can be\nachieved. They can run on a local linux machine by selecting the software\nrendering adapter and the tests with the command\n\n* `PYGFX_WGPU_ADAPTER_NAME=llvmpipe pytest examples -k test_examples_compare`\n\nNote that our `pytest.ini` file contains the environment variable\n`PYGFX_DISABLE_SYSTEM_FONTS=1` to help ensure consistency across system\ninstallations.\n\n\n### Code of Conduct\n\nOur code of conduct can be found here: [Code of Conduct](./CODE_OF_CONDUCT.md)\n\n\n## Spelling and pronunciation\n\nLowercase \"pygfx\" is used in code. You can refer to the project in written text using \"Pygfx\".\nPygfx is pronounced as *pie-graphics*.\n",
    "bugtrack_url": null,
    "license": "BSD 2-Clause",
    "summary": "A threejs-like render engine based on wgpu",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/pygfx/pygfx"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ea561ed33d89524d78db9f64189a7fea204cdde2556597696f50987b55ef44d",
                "md5": "33e99d5e0135a94f7dbb745d6da7de4d",
                "sha256": "f1ea6f1b1603264070337268a099c89ef69785e056d36fa6022d5e31ed8cdc6d"
            },
            "downloads": -1,
            "filename": "pygfx-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "33e99d5e0135a94f7dbb745d6da7de4d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 1120537,
            "upload_time": "2024-09-20T07:50:56",
            "upload_time_iso_8601": "2024-09-20T07:50:56.250408Z",
            "url": "https://files.pythonhosted.org/packages/4e/a5/61ed33d89524d78db9f64189a7fea204cdde2556597696f50987b55ef44d/pygfx-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cabdc38d7d5a58c7955be01bbad95ada28ab0a349c1f638ab4519dae09841fe6",
                "md5": "9c12b3aa09b8f6b151eb368bed63e752",
                "sha256": "693a0d80515bfc94b0578859bba542c786569086bd62fd4de26d256fad54c12c"
            },
            "downloads": -1,
            "filename": "pygfx-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9c12b3aa09b8f6b151eb368bed63e752",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 1050427,
            "upload_time": "2024-09-20T07:50:58",
            "upload_time_iso_8601": "2024-09-20T07:50:58.050182Z",
            "url": "https://files.pythonhosted.org/packages/ca/bd/c38d7d5a58c7955be01bbad95ada28ab0a349c1f638ab4519dae09841fe6/pygfx-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-20 07:50:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pygfx",
    "github_project": "pygfx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pygfx"
}
        
Elapsed time: 0.41361s