Skip to content
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

Add zengl 1.16.0 #4208

Merged
merged 1 commit into from Oct 18, 2023
Merged

Add zengl 1.16.0 #4208

merged 1 commit into from Oct 18, 2023

Conversation

szabolcsdombi
Copy link
Contributor

@szabolcsdombi szabolcsdombi commented Oct 9, 2023

Description

Added zengl 1.16.0

ZenGL provides OpenGL binding for Python.
The same code that runs natively also runs in the browser as-is without modifications.
It does not depend on SDL, emscripten GLES or anything else.
It binds directly to WebGL2.

Working demo: https://szabolcsdombi.github.io/zengl/

image

Checklists

  • Add a CHANGELOG entry
  • Add / update tests
  • Add new / update outdated documentation

@szabolcsdombi szabolcsdombi marked this pull request as draft October 9, 2023 06:42
@szabolcsdombi szabolcsdombi changed the title Add zengl 1.15.0 Add zengl 1.16.0 Oct 14, 2023
@szabolcsdombi szabolcsdombi marked this pull request as ready for review October 14, 2023 10:31
@szabolcsdombi
Copy link
Contributor Author

I am running the tests from ./run_docker.sh as follows:

szabi@bf7ba56f9cb2:/src$ pytest --runtime chrome -k zengl
============================================================================================ test session starts =============================================================================================
platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /src
configfile: pyproject.toml
testpaths: src, pyodide-build, packages
plugins: pyodide-0.23.2, asyncio-0.21.0, cov-4.0.0, benchmark-4.0.0, httpserver-1.0.6, hypothesis-6.75.2
asyncio: mode=Mode.STRICT
collected 2177 items / 2174 deselected / 3 selected                                                                                                                                                          

packages/_tests/test_packages_common.py .s                                                                                                                                                             [ 66%]
packages/zengl/test_zengl.py s                                                                                                                                                                         [100%]

============================================================================================== warnings summary ==============================================================================================
pyodide-build/pyodide_build/buildpkg.py:8
  /src/pyodide-build/pyodide_build/buildpkg.py:8: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    import cgi

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================== 1 passed, 2 skipped, 2174 deselected, 1 warning in 3.48s ==========================================================================
szabi@bf7ba56f9cb2:/src$ 

my package is built:

szabi@bf7ba56f9cb2:/src$ pyodide build-recipes zengl
The following packages are already built: distutils, hashlib, liblzma, lzma, micropip, openssl, packaging, pydecimal, pydoc_data, sqlite3, ssl, test, and zengl                                               
All packages already built. Quitting.

packages/zengl/test_zengl.py Outdated Show resolved Hide resolved
packages/zengl/test_zengl.py Outdated Show resolved Hide resolved
@ryanking13
Copy link
Member

I am running the tests from ./run_docker.sh as follows:

Sorry, you need to update pytest-pyodide version in the docker image before running the test.

pip install -U pytest-pyodide

The CI looks good generally. Could you add @pytest.mark.driver_timeout(60) decorator on your tests to increase the test timeout?

@szabolcsdombi
Copy link
Contributor Author

thank you, it works now.

_tests/test_packages_common.py::parse_package[zengl] PASSED                                      [ 33%]
_tests/test_packages_common.py::import[chrome-zengl] PASSED                                      [ 66%]
zengl/test_zengl.py::render_with_webgl2[chrome] <- .docker_home/.../decorator.py PASSED          [100%]

@szabolcsdombi
Copy link
Contributor Author

Here is a complete list of commands to achieve running tests:

./run_docker
pip install -U pytest-pyodide
PYODIDE_PACKAGES=zengl make
pytest --runtime chrome -k zengl -vvv

Previously I did:

./run_docker
make
pyodide build-recipes zengl # this will build zengl but it won't be visible for the tests, see the commands above
pytest ...

Copy link
Member

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is ready to merge.

@hoodmane
Copy link
Member

Thanks @szabolcsdombi!

@hoodmane
Copy link
Member

It is still timing out on firefox. Maybe xfail it?

@szabolcsdombi
Copy link
Contributor Author

szabolcsdombi commented Oct 16, 2023

would xfail waste a minute?

getContext returns null or undefined.
getContext only works for '2d' in this firefox.

skip does not work either.

if not gl:
    pytest.skip('webgl2 not supported')  # raises Skipped and cannot be pickled

so i moved the context creation behind an if.

@szabolcsdombi
Copy link
Contributor Author

  • rebased on top of main
  • fixed the changelog conflict
  • squashed commits

@hoodmane
Copy link
Member

Interesting I'll look into fixing pytest.skip inside of @run_in_pyodide.

@szabolcsdombi
Copy link
Contributor Author

I have looked into that, forked pytest-pyodide, but I found it too hard to track down the place to add my changes. Namely I found no way to nicely catch and re-raise exceptions first propagating through the js invocation in the run method of the base class.

pytest.skip(msg) just raises Skipped(msg) nothing special there.

I would love to help.

@hoodmane hoodmane merged commit 45b3b2c into pyodide:main Oct 18, 2023
39 of 40 checks passed
@hoodmane
Copy link
Member

Thanks for contributing this @szabolcsdombi! It looks very nice.

I have looked into that, forked pytest-pyodide, but I found it too hard to track down the place to add my changes.

Well thanks for looking into it. It is a bit of a confusing package...

@hoodmane
Copy link
Member

@szabolcsdombi
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants