Skip to content

refactor: distinguish data fields in the yaml files from the webpage template#563

Merged
fpvandoorn merged 13 commits intoleanprover-community:lean4from
grunweg:MR-refactor-fields-strawman
Jan 9, 2025
Merged

refactor: distinguish data fields in the yaml files from the webpage template#563
fpvandoorn merged 13 commits intoleanprover-community:lean4from
grunweg:MR-refactor-fields-strawman

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented Dec 21, 2024

Currently, {Hundred,ThousandPlus}Theorem mix data for two different purposes:

  • the decl{s} fields contain the parsed declarations from the yaml file
  • the doc_decls fields contains the source code for the corresponding generated documentation

Make this distinction clearer by introducing a new class for theorems on the webpage: this allows omitting the decls field, and contains doc_decls instead. This will allow for stronger validation of the yaml files in mathlib. It also provides a shared abstraction between 100.yaml and 1000.yaml.

While at it, we also

@grunweg grunweg force-pushed the MR-refactor-fields-strawman branch from 77c06c4 to 460953d Compare December 21, 2024 11:38
@grunweg grunweg changed the title chore: refactor data fields for the webpage refactor: distinguish data fields in the yaml files from the webpage template Dec 21, 2024
This is another difference between 100.yaml and 1000.yaml.
We choose to match the upstream field names; this is easy to do now.
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 7, 2025

Thanks for your review! I just saw this now (while I was pushing some additional commits). I'll incorporate it now.

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 7, 2025

I have addressed all comments.

url: Optional[str] = None
note: Optional[str] = None
# any additional notes or comments
comment: Optional[str] = None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing my local tests of this PR to fail, so I have temporarily patched this out so I can keep checking things, but just to make sure, the idea is to merge leanprover-community/mathlib4#20078 (temporarily breaking the website), and then merge this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right... I noticed a moment ago, but then forgot that 1000.yaml also contains some instances of note now...
I created leanprover-community/mathlib4#20555, which should allow landing this PR.

Copy link
Copy Markdown
Contributor Author

@grunweg grunweg Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I'm not sure what the standard for "no changes breaking the webpage" is: given that the procedure so far has been somewhat permissive with "if the website breaks just once, that's ok", I'm fine with putting in some effort to avoid intermediate broken states - but bending over backwards seems a bit out of proportion.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I maybe should have said this up front, but I'm personally also fine with having the website be temporarily broken while we coordinate efforts between repos. Sorry to make you go through the effort, but to keep the process simple, let's close leanprover-community/mathlib4#20555 and focus on getting someone (Floris?) to merge leanprover-community/mathlib4#20078 (which looks about done to me) and once that's in, I'll try and merge this immediately so there's no actual downtime.

bryangingechen added a commit to leanprover-community/mathlib4 that referenced this pull request Jan 7, 2025
Copy link
Copy Markdown
Collaborator

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just synced the dataclasses to leanprover-community/mathlib4#20078 via copy-paste and realized that we should have corresponding comments here as well:

Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Copy link
Copy Markdown
Collaborator

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now works locally (modulo a temporary patch to the comment field, which will become unncessary once leanprover-community/mathlib4#20078 is merged).

As mentioned above, I plan to merge this once that PR is in to avoid website downtime.

@fpvandoorn
Copy link
Copy Markdown
Member

LGTM

I'm happy to merge, but maybe it's better to wait until the Mathlib PR has actually been merged into master?

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 9, 2025

The mathlib PR has been merged now.

@fpvandoorn fpvandoorn merged commit 97fa06d into leanprover-community:lean4 Jan 9, 2025
@grunweg grunweg deleted the MR-refactor-fields-strawman branch January 9, 2025 13:36
@bryangingechen
Copy link
Copy Markdown
Collaborator

The build is failing, but I think it's just because doc-gen hasn't run yet (and hence we still have an old version of the yaml files). Let me re-trigger a docs build and then see if the website gets fixed.

@fpvandoorn
Copy link
Copy Markdown
Member

I think this line is causing the failure
https://github.com/leanprover-community/mathlib4/blob/b835401242941974a4e26e186a2e76e2032e8709/docs/1000.yaml#L1294

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 9, 2025

Right. I wonder why leanprover-community/mathlib4#20078 didn't cover this... but leanprover-community/mathlib4#20554 does include the fix now.

@bryangingechen
Copy link
Copy Markdown
Collaborator

Ah, looks like #20078 doesn't actually cause the build to fail when an error is detected: https://github.com/leanprover-community/mathlib4/actions/runs/12690334474/job/35370960547#step:19:8

I've submitted a fix at leanprover-community/mathlib4#20614

@bryangingechen
Copy link
Copy Markdown
Collaborator

After retriggering the docs build once again, the website build finally succeeded! Everything looks OK at first glance...

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 9, 2025

There is one bug: the count in 1000.yaml is wrong --- is only counts theorems with an author; it should count theorems with either an author, or a decl or decls field. Does one of you know jekyll better than me and suggest the right incantation? (I don't know any jekyll at all.)

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 9, 2025

The same filter should be applied in 1000-missing.html.

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jan 9, 2025

I asked on zulip.

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.

3 participants