This release is a pre-release and may not be stable for production use.
Pegl: Python 3 binding for EGL
Pegl is a binding to EGL, written in native Python 3 through the ctypes library. It provides comprehensive access to EGL functions, while offering a Pythonic API.
EGL is a specification from the Khronos Group that provides an intermediate layer between other Khronos specifications (OpenGL, OpenGL ES, OpenVG), called “client APIs”, and the native graphics system. EGL can supply an implicit rendering context for each of the client APIs, as well as features like surfaces and buffering.
Pegl wraps EGL version 1.5, and is backwards compatible with previous versions of the specification.
The current Pegl version is 0.2a1. As an alpha version, care should be taken before making use of the library! Please test it out and open a GitHub issue to report the results.
License
Pegl is free software, released under the GNU GPLv3. See the file COPYING and individual source files for the full license terms.
Use
A typical use case might feature these steps:
Create a Display instance
Get a Config instance to match your requirements
Bind the client API you want to use
Get a Context instance and/or a Surface instance, as necessary
Do your work in the client API
Repeat from step 3 to mix different client APIs in the one application
Sample code for steps 1 to 4 might look like this:
>>> import pegl
>>> dpy = pegl.Display()
>>> conf = dpy.choose_config({pegl.ConfigAttrib.RENDERABLE_TYPE:
... pegl.ClientAPIFlag.OPENGL_ES})[0]
>>> pegl.bind_api(pegl.ClientAPI.OPENGL_ES)
>>> ctx = conf.create_context()
>>> surf = conf.create_pbuffer_surface({pegl.SurfaceAttrib.WIDTH: 640,
... pegl.SurfaceAttrib.HEIGHT: 480})
>>> ctx.make_current(draw=surf)
Development and testing
Pegl uses tox to run tests and compile coverage data. Tests are currently set up for Python versions 3.7 through 3.9.
I test Pegl on Linux (Fedora with current Mesa releases) and on Windows (Windows 10 with current ANGLE releases). Please run tests on other platforms and open an issue to report your results!
The PEGLEGLVERSION environment variable
By default, Pegl will attempt to load all EGL functions up to version 1.5. If any of a given version’s functions cannot be loaded from the native library, it infers that the library does not support that version and stops there.
It is possible to force Pegl to stop early by setting the PEGLEGLVERSION environment variable. For instance, setting it to 1.4 will cause Pegl to not attempt loading EGL 1.5 functions, even if the library supports them.
This is used in the tests to check backwards compatibility, albeit imperfectly.
Roadmap
0.x series
Releases in this series will provide a wrapper that is Pythonic, but still fairly low-level, and the API is not guaranteed to be stable.
1.x series
Once the basic Pegl functionality is tested and considered usable, I will aim to improve the API, so that an EGL environment can be set up with a minimum of code. When I’m happy with the results, version numbers will be bumped up to 1.x, with a corresponding assurance of API stability.
Metadata
Release files for Pegl 0.2a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Pegl-0.2a1.tar.gz | 43.8 kB | Without provenance | Details for Pegl-0.2a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Pegl-0.2a1-py3-none-any.whl | Python 3 | none | any | Details for Pegl-0.2a1-py3-none-any.whl |
Total release size: 105.5 kB
Release files / Pegl-0.2a1.tar.gz
| Download URL | Pegl-0.2a1.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
996cb72511844975c69e36737322292b9cb6137b186fc69ec7c4eefd8998e5a6
|
|
BLAKE2b-256 checksum How to use checksums |
ef74ac7798cd6248243ca50117d680053a03334a66a7c879d8e9b9b0b7cc75a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Release files / Pegl-0.2a1-py3-none-any.whl
| Download URL | Pegl-0.2a1-py3-none-any.whl |
|---|---|
| Size | 61.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1a2660427e5b547c877199444b6f64373e19b75a1f130dcbfc61a3750e135ab
|
|
BLAKE2b-256 checksum How to use checksums |
84807780b026d3587fc1b41f92eefae2b0bebeac0485aea08f51c84c36e83634
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Security for Pegl 0.2a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.