Repository navigation
Conversation
Sphinx sets a flag that makes pyglet skip creating its hidden window, so no OpenGL context exists. psychopy.visual imports psychopy.tools.gltools, which queries OpenGL at import time, and that query segfaults. Mocking only gltools avoids the query and keeps psychopy.visual importable and documented.
JoKeyser
added a commit
to CMDN-Lab/psychopy-plugin-lsl
that referenced
this pull request
Oct 6, 2026
JoKeyser
added a commit
to dhprlab/psychopy-cyclus2
that referenced
this pull request
Oct 6, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks a lot for maintaining this template, it helps me getting started much easier.
While trying it out I hit a crash when building the docs, so here is a small fix (probably with a fairly indirect root cause behind it).
When trying to build the docs, it segfaults while reading
coder/ExampleVisualStim. I saw this with PsychoPy 2026.2.4, pyglet 1.5.27, Sphinx 8.1.3 and Python 3.10, both on Linux with a display and on macos-latest. (Used command:sphinx-build docs_src docs -b dirhtml).With this PR,
docs_src/conf.pynow mockspsychopy.tools.gltools.With it,
psychopy.visualgets imported and documented without segfault.My best guess at the cause: Sphinx imports
psychopy.visualto document the plugin, which importspsychopy.tools.gltools, which queries OpenGL at import time.pygletskips creating its hidden window when sphinx is insys.modules, so there is no OpenGL context and the query crashes in native code. Thetry/exceptaround it can't catch that. I also triedautodoc_mock_imports, but it doesn't help: the crashing import happens insphinx.pycode, outsideautodoc's mock context.To check it yourself:
pip install -e .[docs] && sphinx-build docs_src docs -b dirhtmlWhat I tested: The build succeeds on Linux laptop (Python 3.10), and the full docs workflow succeeds on macos-latest.