Make the pypy3 kernel build and run - #100
Merged
Merged
Conversation
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.
The pypy3 kernel didn't evaluate, let alone build.
nix flake checkfails onmainbecause of it,via
lspProbeEnvs:Four things were stacked up behind that:
Evaluation. A package unsupported on PyPy throws when its
outPathis forced, even as acheck input, and
requiredPythonModulesforces every element vialib.unique. Two chains hitit:
ipython → stack-data → typeguard → mypy, anddebugpy → django → objgraph.C extensions that don't build on PyPy —
brotlicffi,cmarkgfm,forbiddenfruit,msgspec, all test-suite-only. Rather than chase each, the kernel's interpreter getsdoCheck = falseacross its package set.overridePythonAttrsre-runsbuildPythonPackage, socheck inputs are never added, which also subsumes 1. (
overrideAttrscan't: it edits thederivation after those inputs have been evaluated.)
pyzmq builds and runs against cffi on PyPy, but nixpkgs only wires up the Cython path. Needs
cffi/pycparserin bothbuild-systemanddependencies.kernel.nixhardcoded"${python}/bin/python". A PyPy env hasbin/pypy3and nobin/python, so the generatedkernel.jsonpointed at a nonexistent binary. Now usespython.interpreter.Coverage
The sample environment and the kernel test both existed but were commented out — 7bad590 "Comment
pypy3 sample environment internals for now" (2024-10-10) and
-- tests' ("pypy3", "pypy3")— sobuild-sample-environmentswas passing on an empty environment and nothing exercised the kernel.That's how it rotted unnoticed. Both are re-enabled here.
The test is a new minimal spec rather than the commented-out line, which reused the CPython
kernelSpecand would have dragged scipy, pylint, pyright and python-lsp-server onto PyPy. Itcovers the kernel: expected fields,
print("hi"), andplatform.python_implementation()returningPyPy.Testing
Kernel executes code end to end, via a real Jupyter
execute_requestagainst the built spec:Point 4 changes the CPython argv too (
bin/python→bin/python3.13), checked the same way:KERNEL SAID: CPython 3.13.12.Sample environment builds, and its
kernel.jsonnow points at.../bin/pypy3.11with display namePyPy 7.3.20. Test suite compiles.nix flake checkpasses locally.Note
Disabling checks across the whole PyPy package set is broad, and means PyPy packages ship untested.
Given how much of PyPy is broken in nixpkgs — four C extensions plus pyzmq in one small closure —
that seems the right trade, but say so if you'd rather have a narrow per-package list.
Split out of #98.