-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep documentation for previous spec versions alongside draft
#505
Conversation
8fddbe3
to
6ca0311
Compare
fd3e256
to
18fd07c
Compare
0b8e9ab
to
1c3000e
Compare
I would add a README to the spec directory explaining how the layout works and what steps need to be taken to make a spec release (if there are a lot of them, maybe it could be put into a script). Also, make sure we do test making a release to make sure everything works. |
41e3423
to
5ba1794
Compare
Let's hold off on this refactor until the changes to the standard that modify content (new functions, keywords, etc.) are done for |
* Rudimentary `array_api_stubs` pkg and folder-per-version docs * Regex nitpick ignore for array types * Move `2021.12` docs to respective sub-folders * Fix autosummary by patching stub sub-modules in `conf.py` * Rudimentary build-all Makefile rule * Specify versions in `conf.py` * Use `versions.json` method for sphinx-material Otherwise don't think we can get links working on nested pages Notably this usually won't work locally - see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp * Update image paths to shared `_static/` * Use vars in `make build` definition * Expand regex used to identify unwanted type hint prefixes * Update `pages.yml` workflow * Store gh-pages `.gitignore` in `main` to be copied over * `_spec_conf.py` -> `_array_api_conf.py` * Basic package necessities * Replace `requirements.txt` with extra dependency `doc` * Basic local build guide * Update preview workflow * Remove out-of-date make things, new top-level Makefile * Minor `CONTRIBUTING.md` improvements * Basic `_array_api_conf.py` module docstring * Move quickstart to `README.md` * Use `array_api` as opposed to `signatures` for `2021.12` autodoc * More consistent Makefile * Introduce `_ghpages` to hold the non-Sphinx static files * Rudimentary spec release guide * Guide to preserve history for future spec releases
23a0512
to
6eb8df3
Compare
Alright, I'll need to sleep on it but I think I'm happy with this PR. It was kind of a nightmare getting this PR updated post the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks good. I reviewed each file. A few minor nitpicks/questions.
I'll leave it to you, @honno, to address, as may depend on what sort of Git magic is required. Additionally, would be good to know whether merging this PR requires any special consideration (e.g., whether we can squash commit or not).
Co-authored-by: Athan <[email protected]>
1820739
to
399cd77
Compare
In case there's anything else, it should be fine to push commits on this PR, only the history shouldn't be changed without consideration.
Yeah this can't be squashed in as it would break the preserved blame history. Either "Create merge commit" (i.e. the default for repos unless modified in settings) or "Rebase and merge" will be fine. |
WIP PR to resolve #488. This PR keeps the source of the
2021.12
spec in theHEAD
commit 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.12
anddraft
versions. Importantly files for both versions preserve their history (solution used), so you cangit blame
the2021.12
files 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_stubs
which holds the signature stubs of all versions, which lives insrc/
and can be installed viapip install .
. Currently you can see in themain
branch 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.py
imports the same_array_api_conf
module, 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.modules
in theconf.py
of every version-doc gives us consistency, basically just so we don't have to worry about modifying the.. currentmodule
targets for every version.Building the spec website is now fully reproducible locally via the introduced
make build
command (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)build
will still serve us well when working on just the draft version.TODOs
2021.12
spec/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:
signatures
module 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.12
spec so links don't break.self
param 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.html
magic 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.html
and 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 😅