Repository navigation
Restore Python 3.9 compatibility - #49
Merged
Merged
Conversation
- Skip the sphinx-collections fork on Python < 3.10; it now requires >=3.10 and is only needed for docs builds. - Add sequential_pure_callback, which passes vmap_method="sequential" only when the installed JAX supports it. Older JAX (the newest available on Python 3.9) rejects that argument but is sequential under vmap by default. - Load the docs extension as sphinx_collections; the fork dissolved the sphinxcontrib.collections namespace package. - Drop the py.path argument from pytest_collect_file; pytest 9 removed it.
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 Python 3.9 CI job has been failing at
pip install. This PR fixes that failure and a JAX incompatibility that would have come up right after it. It also fixes two related issues found along the way.Changes
sphinx-collections requires Python 3.10+.
requirements.txtinstalled the unpinned forkgit+https://github.com/anugrahjo/sphinx-collections.git. That fork recently merged upstream v0.3.1, which declaresrequires-python >=3.10. On 3.9, pip fails withrequires a different Python: 3.9.25 not in '>=3.10'. The package is only used for building the docs, so it now has apython_version >= "3.10"marker. ReadTheDocs builds on 3.11 and still installs it.pure_callback(..., vmap_method="sequential")fails on older JAX. Newer JAX needs this argument for custom ops (and other callbacks) inside a vmap. Older JAX, including 0.4.30 (the newest release for Python 3.9), doesn't accept it and fails withTypeError: Value 'sequential' ... is not a valid JAX type. Older JAX already runs callbacks sequentially under vmap by default. The new helpersequential_pure_callbackincsdl_alpha/backends/jax/utils.pypassesvmap_methodonly whenjax.pure_callbackaccepts it. All four call sites use it:CustomExplicitOperation.compute_jaxCustomJacOperation.compute_jaxSubOperation.compute_jaxfallback_to_inline_jaxDocs extension renamed. The same upstream merge removed the
sphinxcontrib.collectionsnamespace package, sodocs/conf.pynow loadssphinx_collections. The collections config and thewriter_functiondriver are unchanged.pytest 9 compatibility.
conftest.pydeclared thepathargument inpytest_collect_file, which pytest 9 removed.file_pathwas already being used, sopathis dropped.Testing
A custom explicit op inside a
BLoop(jax.vmap), including its derivative, through the JAX backend:TypeError(vmap_method)NotImplementedErrorifvmap_methodis left outFull suite, installed the same way CI installs it:
--backend jax.The failures are
TestProduct::test_functionality(--backend jax) andtest_docstrings(3.10 only). Both also fail onmainlocally.requirements.txtinstall on Python 3.10 succeeds, and the collections steps run.sphinxcontrib.collectionsno longer imports with the current fork.