Keep documentation for previous spec versions alongside draft#505
Merged
kgryte merged 18 commits intodata-apis:mainfrom Jan 18, 2023
Merged
Keep documentation for previous spec versions alongside draft#505kgryte merged 18 commits intodata-apis:mainfrom
draft#505kgryte merged 18 commits intodata-apis:mainfrom
Conversation
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.
WIP PR to resolve #488. This PR keeps the source of the
2021.12spec in theHEADcommit of the repo, which is important for backporting features and cross-version tooling (i.e.array-api-tests).Note on the diff: it's bloated by having soft-duplicated the docs/stubs so we can have
2021.12anddraftversions. Importantly files for both versions preserve their history (solution used), so you cangit blamethe2021.12files like they were on release day. The bloated diff otherwise seems inevitable, asgit(or at least GitHub) can't mark multiple files as renamed, even if there are no changes to either file 😕It won't be up-to-date but you can check https://honno.dev/array-api/ for rendered docs. I've also updated live previews, but that won't work for this PR as it requires the default branch to be updated too (does work for
honno/array-api).What this PR changes
This introduces a module
array_api_stubswhich holds the signature stubs of all versions, which lives insrc/and can be installed viapip install .. Currently you can see in themainbranch only draft stubs are available, living inspec/API_specification/array_api(this PR moves them tosrc/array_api_stubs/_draft/).To hold the non-docstring documentation of all versions,
spec/now contains technically separate Sphinx docs for each version in respective folders (i.e.spec/2021.12/andspec/draft/). Sphinx configuration is however mostly shared, as eachconf.pyimports the same_array_api_confmodule, i.e.The main drive in having technically separate docs is to keep utilising Sphinx's autodoc, which is incredibly useful but ill-equipped of having multiple spec versions in the repo. The ability to monkey-patch
sys.modulesin theconf.pyof every version-doc gives us consistency, basically just so we don't have to worry about modifying the.. currentmoduletargets for every version.Building the spec website is now fully reproducible locally via the introduced
make buildcommand (I wrote a quickstart for building the spec inREADME.md). Before we would just update the current version folder ingh-pages, which is sensible for most docs, but feels a bit loosey-goosey if we want the ability to backport things and generally it's nice to build the whole website locally. The pages workflow now works withpip install .[doc]andmake build, but I have yet to update the preview workflow.sphinx-(auto)buildwill still serve us well when working on just the draft version.TODOs
2021.12spec/stub files(So beware, there's going to be a fair few force-pushes here.)
Follow-up PRs
First point of order is known backport candidates. On the top of my head:
signaturesmodule to array_api #430 had to be backported for this PR to work, so follow-up should be redirectingsignatures.<file>.*to respectivearray_api.*urls, just for the2021.12spec so links don't break.selfparam to array object properties #464__array_api_version__in API specification section #480And then I would want the package to actually be useful by tooling, notably
array-api-tests—see #472 for what I've already worked on in this regard. Another PR could automate releases (probably CalVer'd) anytime a workflow detects the package has changed (inspired by Hypothesis here, and for our purposes should be simple). I've already upload the package to PyPI asarray-api-stubs(just to park it), so any consortium member who's interested, feel free to ask me to make you a collaborator on PyPI.Also, CircleCI doesn't handle that
index.htmlmagic that happens when you go to "folder" URL, i.e.https://output.circle-artifacts.com/output/job/kfc/artifacts/0/_site/latest/won't redirect to.../index.htmland so give us a seamless preview when checking non-draft versions. Generally site previews seems to be an unintended but popular use of artifacts (related discussion). A way to handle this, probably by making the version jumping explicitly suffix hrefs withindex.html, would be nice.So that's broad strokes. Obviously lots of little details but I didn't want to make the PR body an automatic TL;DR heh... hopefully those details speak to themselves, so if not I have/should/will be writing documentation (ofc still working on this PR). Both excited and terrified to hear what folks think 😅