Skip to content
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

Docpipeline tests by chapter and section #1022

Merged
merged 16 commits into from
Apr 3, 2024
Merged

Conversation

mmatera
Copy link
Contributor

@mmatera mmatera commented Mar 14, 2024

This continues #1021, and starts to tackle the problem of accessing tests by chapter and section without interacting over the full documentation.

For chapters, the change is quite straightforward. On the other hand, for sections, I think we need to think a little bit what is the best way to do this.

One possibility would be to produce the documentation entry from the docstring of the target builtin, without passing through the documentation. The other way to go would be to keep a dictionary in the documentation, storing all the sections "by slug".

Thoughts?

@mmatera mmatera force-pushed the more_docpipeline_fixes branch from d8f07f5 to b3777f1 Compare March 16, 2024 12:45
@mmatera mmatera force-pushed the more_docpipeline_fixes branch from 2f6eabb to 4dd5b72 Compare March 30, 2024 19:20
mmatera added 6 commits March 30, 2024 16:21
* Fix references in ImportExport
* Makes key generation more deterministic
* Fix typos in docstrings and comments
* Add the new versions of test_* in mathics.docpipeline, and keep the old ones
  when the new ones fail.
* Make more deterministic the key generation for ``DocTest``
* DRY __init__ methods in classes inside  latex_doc.py
more moving code around
@mmatera mmatera force-pushed the more_docpipeline_fixes branch from 4dd5b72 to cd0d92c Compare March 30, 2024 19:24
@mmatera mmatera marked this pull request as ready for review March 30, 2024 19:46
@mmatera
Copy link
Contributor Author

mmatera commented Mar 30, 2024

Now, this PR was updated with part of #1025, but produces the documentation following the pattern closer to Mathics 6.0

imagen

This PR is another version of #1025, which produces a documentation with
the same format as in the 6.0.4 documentation.
@mmatera
Copy link
Contributor Author

mmatera commented Mar 30, 2024

This is how Graph looks in the Pymathics section part:

imagen

@mmatera mmatera mentioned this pull request Apr 2, 2024
@mmatera
Copy link
Contributor Author

mmatera commented Apr 2, 2024

Now the subsections have numbers:
imagen

What I still do not like about this is that Symbol references look different for symbols inside packages and symbols in shallow modules:

imagen

In any case, one possible fix would be to put the symbols in shallow modules inside a "default" guide.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

This is how Graph looks in the Pymathics section part:

imagen

The numbers go back to 1. It would be much better instead to continue from the last previous chapter number. In particular the last chapter was 52. Units and Quantities. So Graphs should be chapter 53.

(It looks like some fragile pytests that refer to subsection* need to be adjusted to subsection without the star.)

@rocky
Copy link
Member

rocky commented Apr 3, 2024

For chapters, the change is quite straightforward. On the other hand, for sections, I think we need to think a little bit what is the best way to do this.

One possibility would be to produce the documentation entry from the docstring of the target builtin, without passing through the documentation. The other way to go would be to keep a dictionary in the documentation, storing all the sections "by slug".

Thoughts?

by slug seems fine.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

What I still do not like about this is that Symbol references look different for symbols inside packages and symbols in shallow modules:

The images and looking at the PDF don't bother me in the slightest. Eventually, I imagine everything will be under some guide section of some sort. So this kind if thing is temporary.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

@mmatera with this organization, can we now redo the code in Mathics3 Modules so that they are now organized more like the way builtins work? Or does more need to be done?

@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

@mmatera with this organization, can we now redo the code in Mathics3 Modules so that they are now organized more like the way builtins work? Or does more need to be done?

With these changes, docpipeline works in pymathics modules without making any changes. Also, each module is treated exactly as it were part of mathics.builtin (except that the results are associated to the Modules part)

@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

This is how Graph looks in the Pymathics section part:
imagen

The numbers go back to 1. It would be much better instead to continue from the last previous chapter number. In particular the last chapter was 52. Units and Quantities. So Graphs should be chapter 53.

The problem is that we put modules in a different part. There is a way in LaTeX to set the initial chapter number in a Part by hand, but at this point I guess would be a higher-order correction.

(It looks like some fragile pytests that refer to subsection* need to be adjusted to subsection without the star.)

Yes, I realized that after pushing it up.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

Things are looking better. I am seeing that guide sections do not have labels associated with them, so I get

  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 231 undefined on input line 24606
  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 240 undefined on input line 41322

when I build the docs.

I suspect this is a two line change in latex_doc.py around line 800.

@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

Things are looking better. I am seeing that guide sections do not have labels associated with them, so I get

  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 231 undefined on input line 24606
  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 240 undefined on input line 41322

when I build the docs.

I suspect this is a two line change in latex_doc.py around line 800.

Yes, I see this kind of things related to how we handle keys for sections and subsections.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

One other thing I noticed is that in the manual chapters are sorted and we don't want that. That's why in previous versions and drafts there was a parameter when gathering chapters. That should be put back in.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

Things are looking better. I am seeing that guide sections do not have labels associated with them, so I get

  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 231 undefined on input line 24606
  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 240 undefined on input line 41322

when I build the docs.
I suspect this is a two line change in latex_doc.py around line 800.

Yes, I see this kind of things related to how we handle keys for sections and subsections.

Seems like an easy fix though.

@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

Things are looking better. I am seeing that guide sections do not have labels associated with them, so I get

  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 231 undefined on input line 24606
  Reference `reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values' on page 240 undefined on input line 41322

when I build the docs.
I suspect this is a two line change in latex_doc.py around line 800.

Yes, I see this kind of things related to how we handle keys for sections and subsections.

Seems like an easy fix though.

This was just that GuideSections lost their labels. Now it seems to work.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

Ok - everything looks good now. Thanks!

Some follow-on items (in a future PR?) are:

  1. Don't reset numbers between parts.
  2. Rewrite Mathics3 Modules graph and natural language to be organized the way builtins are. We should have done or should be doing this before we recommend that others use this to replace parts of the existing builtin. (There code may be additional scope issues in Mathics3 Modules, but that's another topic for another time.)

@rocky
Copy link
Member

rocky commented Apr 3, 2024

Something on my todo list before the release is to go over and read the entire doc more carefully. I see on page 29
further-tutorial-examples

there is a weird line break. And we have LaTeX format errors:

  Missing character: There is no ‐ ("2010) in font pplr8t!
  Missing character: There is no ‐ ("2010) in font pplr8t!

But more generally, there was some basic text that I had meant to go over. It was a while ago so I don't remember the details there and didn't write it down at the time.

@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

Ok - everything looks good now. Thanks!

Some follow-on items (in a future PR?) are:

1. Don't reset numbers between parts.

I found that commenting out a line in mathics.tex recovers this behavior. It is done now.

2. Rewrite Mathics3 Modules graph and natural language to be organized the way builtins are. We should have  done or should be doing this _before_ we recommend that _others_  use this to replace parts of the existing builtin. (There code may be additional scope issues in Mathics3 Modules, but that's another topic for another time.)

As far as I can see, pymathics.graphics has the same structure that mathics.builtin.arithmetic, and it is shown in a similar way. What is probably missing is more detailed content.

@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

Something on my todo list before the release is to go over and read the entire doc more carefully. I see on page 29 further-tutorial-examples

there is a weird line break.

I think this is an issue of the mathics.tex template.

And we have LaTeX format errors:

  Missing character: There is no ‐ ("2010) in font pplr8t!
  Missing character: There is no ‐ ("2010) in font pplr8t!

But more generally, there was some basic text that I had meant to go over. It was a while ago so I don't remember the details there and didn't write it down at the time.

In any case, these issues are not related to this PR, and can be corrected in another round.

@rocky
Copy link
Member

rocky commented Apr 3, 2024

Thanks for not resetting the chapter number between parts. Let's merge and pick up remaining things in future PRs.

@rocky rocky merged commit c3c1791 into master Apr 3, 2024
10 checks passed
@rocky rocky deleted the more_docpipeline_fixes branch April 3, 2024 21:56
@mmatera
Copy link
Contributor Author

mmatera commented Apr 3, 2024

Thanks for not resetting the chapter number between parts. Let's merge and pick up remaining things in future PRs.

Thank you for the revision and feedback!
Actually the issue with the chapter numbers was easy to solve because it was something that we had added as a hack in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants