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

Utils lazy import #386

Merged
merged 2 commits into from
Oct 23, 2023
Merged

Utils lazy import #386

merged 2 commits into from
Oct 23, 2023

Conversation

almarklein
Copy link
Member

Refactor wgpu.utils a bit.

Before, wgpu.utils was not imported. When importing it, you'd get a few utils, but the shadertoy must be explicitly imported.

This makes that more consistent: The wgpu.utils module is imported by default, but its submodules are not. They have to be explicitly imported. This may break some code that use wgpu.utils.compute_with_buffers so I added a temporary stub function for it.

Also added stubs for the submodules to make them easier to discover in an interactive session. They get replaced as soon as the import for the real module happens.

The only exception is get_default_device(). That function is generally useful, so its present by default.

@almarklein almarklein requested a review from Korijn as a code owner October 23, 2023 11:07
@Korijn Korijn merged commit 871319f into main Oct 23, 2023
17 checks passed
@Korijn Korijn deleted the utils branch October 23, 2023 11:21
@almarklein almarklein mentioned this pull request Oct 23, 2023
30 tasks
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.

2 participants