Repository navigation
Let QLDPC_GAP_COMMAND choose the command that runs GAP, and document GAP on Windows - #1061
Merged
Merged
Conversation
…GAP on Windows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… written Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…us references Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… name for each GAP concept Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e separate-program backend Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…xactly Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Motivation
Issue #294 reports that a Windows user with the official GAP installer could not use GAP from qLDPC, and that
conda install -c conda-forge gapfails on Windows. Neither route can work today:passagemath-gappublishes no Windows wheels, conda-forge builds GAP only for Linux and macOS, and the GAP installer for Windows runs GAP inside a bundled Cygwin throughgap.bat, adding nogapcommand. Withoutpassagemath-gap, qLDPC could only start GAP as a baregaponPATH. This pull request does not make GAP work on Windows, so it refers to #294 without closing it. It lets users point qLDPC at a GAP that is not onPATH, on any platform, and documents the options on Windows.Changes
The environment variable
QLDPC_GAP_COMMANDnow sets the launch command with which qLDPC starts GAP as a separate program; unset or blank, qLDPC runsgapas before, andpassagemath-gapstill takes precedence. qLDPC splits the launch command at whitespace outside double quotes and removes the double quotes, keeping every other character, so Windows paths need no escaping; an unmatched quote raises aValueError. Theqldpc.external.gapmodule docstring holds the full contract: when qLDPC uses the launch command, how it is split, which GAP options qLDPC appends, and what a wrapper must do. A wrapper must pass on those options and standard input, and write nothing of its own to standard output or standard error. GAP must also be able to open qLDPC's package directory as a path on the system where Python runs. The installation guide, the library map, andClassicalCode.from_namepoint to that docstring. "Launch command" is kept distinct from "commands", which in this module means GAP code, as inget_output(*commands).GAP processes no longer inherit Python's standard input. With a user-chosen launch command, a wrapper that ignores its arguments would otherwise start an interactive GAP that waits for input, which could hang
is_callable(), a check meant to be safe for automatic backend selection. The availability check now treats anyOSErrorfrom starting the launch command as "not callable", and the prompt shown when GAP cannot be called prints the launch command as written.The installation guide gains a "GAP on Windows" section. It says what is unavailable, recommends running qLDPC inside WSL (as the GAP developers recommend for GAP), where
pip install 'qldpc[gap]'works, and notes that the copy/paste fallback works with the installer's GAP console. It also stops suggesting conda-forge on Windows. Several nearby docstrings that described the GAP backends inaccurately are corrected, such as the return value ofis_installedafter the user agrees to the manual workflow, and whenget_outputraisesFileNotFoundError.Testing
Nothing here was run on Windows.
test_commandchecks the following:clear_cache();test_get_outputchecks that GAP code goes in-cnormally and on standard input withuse_pipe=True. Mutation checks confirmed that these tests fail without the closed standard input, with#treated as a comment, with the old prompt quoting, or with code always sent through-c. Running the availability check with a launch command that reads standard input, undersleep 6 | ..., now returns at once instead of blocking for the full 6 seconds.Additional notes
Whether some launch command runs the installer's Cygwin GAP from Windows Python is untested, so the docs give no Windows recipe. The installer's
gap.batcannot serve as one, since it ignores its arguments. A Windows user could try a launch command and report on #294.