-
Notifications
You must be signed in to change notification settings - Fork 5
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
Improvements for Families Module (interactive docs, better io, typo fixes) #252
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…/coxeter into shape-families-tables
This commit resolves an issue where Sphinx will not copy static X3D files from the source to the build directory before loading extensions, which results in a FileNotFoundError and causes the build process to exit. It is documented in Sphinx issues #2090 and #1810 that this is expected behavior.
for more information, see https://pre-commit.ci
This is required for the paper figure notebooks.
…/coxeter into shape-families-tables
for more information, see https://pre-commit.ci
…/coxeter into shape-families-tables
Would it be possible to use https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path |
Or perhaps you only need to explicitly list the files in the static path? |
I just now saw your suggestions. I tried using Edit: confirmed. When I put |
Ah, that is unfortunate. |
The Johnson solids page takes about ~5 seconds to load on my M1 Mac. |
Description
I have made several changes related to the
families
module:1. Interactive Documentation
I have created interactive documentation for each of the shape families. Previously, users had to go digging through the SI of cited papers in order to know what ID and name they needed to get a specific shape. Now, there is a new section of the documentation, accessible via the sidebar, titled "Shape Family Tables". Tables contain basic information about the shapes (ID, name, number of vertices, number of faces), as well as interactive models that allow users to actually see what the shapes look like.
To make these new pages, I created a minimal sphinx extension, some CSV data tables, and exported X3D models for all of the members of the discrete shape families. I also modified the default page template and created some custom CSS.
Two things I need feedback on:
PyramidDipyramidFamily
andPrismAntiprismFamily
are deprecated, so I went ahead and made their pages anyway.2. Better IO to X3D (and by extension to HTML)
In order to make the interactive models more clear, I modified
io.to_x3d()
to highlight the shape edges. Sinceio.to_html()
callsto_x3d()
under the hood, it was also affected. I created new control files for the io unit tests to reflect the updated functionality. In the process, I also tweakedtest_io.py
so that it generated new control files better.3. Typo fixes in JSON files
During the development process, I encountered several typos in the reference geometry data stored in JSON files in
families/data
. These typos are as follows:science1220869.json
: for shapeJ86
, the name was given as "Spenocorona", but it should be "Sphenocorona"_previous_science1220869.json
: same as previousjohnson.json
: for shape "Sphenocorona" (note the spelling is already correct here), the vertices did not match those inscience1220869.json
, so I updated the vertices in this file to match those in that file.That last typo is concerning. I only found it because when I corrected the spelling of "Sphenocorona" in the first two files, I stated getting an
AssertionError
intests/test_shape_families.py::test_science_family()
forname="J86"
. If you look at the code for that test,KeyError
s for shapes in the Johnson Family cause a short-circuit in the check for vertices equality. As far as I can tell, there are no more misspellings in shape names, but there may still be name mismatches that I haven't found yet. Therefore, I strongly suggest we check every one of the names injohnson.json
to make sure this problem doesn't happen again.Personally, I'm not sure I really understand why we need
test_science_family()
. It seems to me that its only function is to check that shapes instantiated through data in individual family JSON files (platonic.json
,archimedean.json
, etc.) match those have the same vertices as shapes instantiated through data from the Damasceno paper (science1220869.json
), and since those JSON files should not ever change (except clearly here), I don't see why we should test that equivalency more than once. Perhaps I'm missing something?4. Build changes
The extension I wrote for item 1 above required me to make some small changes to the makefile and readthedocs build configuration. While the source X3D files should be copied to the build directory automatically, files in
source/_static
are only copied to the build directory after extensions are parsed, which causes Sphinx to throw aFileNotFoundError
as soon as it encounters the custom role defined in the extension. As far as I can tell, this issue is documented as expected behavior in sphinx-doc/sphinx#2090 and sphinx-doc/sphinx#1810. For this reason, I have modified the makefile to copy all X3D files to the build directory before runningsphinx-build
. I have also updated.readthedocs.yml
accordingly.Finally, I have also updated the docs' environment.yml file so that the notebooks build without errors.
Motivation and Context
These changes make the documentation for the
families
module more accessible and correct several bugs in the internal data and testing apparatus.Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist: