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

Automatically extract page contributor information during web build #770

Merged
merged 48 commits into from
Sep 18, 2023

Conversation

VojtechStep
Copy link
Collaborator

@VojtechStep VojtechStep commented Sep 14, 2023

The contributor list is sorted by number of commits. Any suggestions for wording and visual style are appreciated. There is a new system for attributing work to contributors, which is now opt-in; add yourself to scripts/contributors_data.toml if you want to be mentioned on the website, or have someone do it for you.

See the latest version here: https://unimath.vojtechstep.eu

Homepage

The logo now properly changes color on dark themes. The font size is bigger, and some of the window size calculations were changed so that the content doesn't overlap the right sidebar, and that sidebar is hidden on smaller screens where it's not useful. It's also hidden when printing a page with Ctrl+P, which should make it more usable.

image

Page attribution

The "Content created by:" line is only included in Agda source files, and the Created/Modified and Recent changes sections are only included in Agda source files and guides in the Overview section.

image

Recent changes

image

Updated list of contributors

Now including co-authors; visible names, links to github and association between visible names and git usernames can be customized via the scripts/contributors_data.toml file

image

Proper syntax highlighting with dark theme support

image

image

Next steps

#777 and #459 are still open; I'm still not convinced about Egbert's idea of listing changed files for every contributor.

Fixes #439
Fixes #507

@EgbertRijke
Copy link
Collaborator

Would it be possible/desirable to display this information immediately below the title of the page?

Don't we want to sort contributors by last name, if a first and last name are available?

Would it be possible to also display the date that the file was created, and perhaps the last date that the file was edited?

@EgbertRijke
Copy link
Collaborator

Also: Awsome!!

@fredrik-bakke fredrik-bakke added website enhancement New feature or request labels Sep 14, 2023
@VojtechStep
Copy link
Collaborator Author

I moved the contributors to the top.

@VojtechStep
Copy link
Collaborator Author

I added the "Created" and "Modified" fields, and now's the time when I'll need anyone's aesthetic help to make it look reasonable 😅.
I can also offer the following alternative date formats:
image
Personally I prefer the current one, %as, i.e. YYYY-MM-DD.

@VojtechStep
Copy link
Collaborator Author

I added the "Recent changes" section to the bottom, I'll need ideas to style that as well. I also don't think it should be a problem to add links to the corresponding commits in the GitHub repo.

That's everything from me for today.

@VojtechStep
Copy link
Collaborator Author

I also didn't address the contributor sorting; TBH I like it sorted by number of commits (if only for the fact that git does that automatically for me and I don't have to do any further processing 😅).

@EgbertRijke
Copy link
Collaborator

I added the "Created" and "Modified" fields, and now's the time when I'll need anyone's aesthetic help to make it look reasonable 😅.
I can also offer the following alternative date formats:
image
Personally I prefer the current one, %as, i.e. YYYY-MM-DD.

Yes, just the date is fine

@EgbertRijke
Copy link
Collaborator

I also didn't address the contributor sorting; TBH I like it sorted by number of commits (if only for the fact that git does that automatically for me and I don't have to do any further processing 😅).

Sure, that works for now. But that also sounds like we can't manually add names because this script will always rewrite the contributor attribution?

@EgbertRijke
Copy link
Collaborator

Instead of just "Modified" I would say "Last modified"

@VojtechStep
Copy link
Collaborator Author

I also didn't address the contributor sorting; TBH I like it sorted by number of commits (if only for the fact that git does that automatically for me and I don't have to do any further processing 😅).

Sure, that works for now. But that also sounds like we can't manually add names because this script will always rewrite the contributor attribution?

That is correct, all of this information is automatically extracted from git metadata with no option to tweak it from within the file whatsoever.

@EgbertRijke
Copy link
Collaborator

BTW it doesn't look like its sorted by number of commits, but it's sorted by first name. We had this problem before: with this sorting it displays capitalized names before uncapitalized names. It looks wrong to me.

@VojtechStep
Copy link
Collaborator Author

BTW it doesn't look like its sorted by number of commits, but it's sorted by first name. We had this problem before: with this sorting it displays capitalized names before uncapitalized names. It looks wrong to me.

Nope, it's certainly sorted by number of commits - the names are explicitly generated with the -n flag to git shortlog for it to be so, and some file have "Egbert Rijke and Fredrik Bakke", while others have "Fredrik Bakke and Egbert Rijke".

@VojtechStep
Copy link
Collaborator Author

It is possible that multiple users have the same number of commits (as is the case in the Order theory file, where Jonathan, Victor and Louis all have 1 commit); in which case I assume it sorts alphabetically

@EgbertRijke
Copy link
Collaborator

BTW it doesn't look like its sorted by number of commits, but it's sorted by first name. We had this problem before: with this sorting it displays capitalized names before uncapitalized names. It looks wrong to me.

Nope, it's certainly sorted by number of commits - the names are explicitly generated with the -n flag to git shortlog for it to be so, and some file have "Egbert Rijke and Fredrik Bakke", while others have "Fredrik Bakke and Egbert Rijke".

Darn! I have to find those files and work on them harder!

@EgbertRijke
Copy link
Collaborator

There is one more issue I would like to know. Sometimes people change their names. When they do, and update their info on github, do the updated names show up automatically on our website? Or does it show their names at the time they committed the work? I would not like it if our website accidentally outs those people.

@VojtechStep
Copy link
Collaborator Author

All this information is from git, not GitHub; git has no concept of identity beyond username and email, which are associated to every commit at the time of authoring, and they are part of the commit data, so changing it would require rewriting history. I would like to show GitHub usernames instead, but we'd need some sort of mapping from git usernames to GitHub usernames. I haven't thought this through, I'll take a look at it either tomorrow or on Sunday.

@EgbertRijke
Copy link
Collaborator

Ok, let's think this through carefully.

@VojtechStep VojtechStep force-pushed the feature/website-improvements branch from ebd10e3 to e3be3ec Compare September 15, 2023 13:54
@VojtechStep
Copy link
Collaborator Author

I summarized the result of our discussion with @EgbertRijke in the description of the last commit, let me paste it here as well:

After some discussion with Egbert, we came to the conclusion that we
should make it possible for contributors to the library to choose how
they are presented on the website, without that presentation being
immediately linked to their GitHub account(s), and without needing to
rewrite the commit history in situations where the identity associated
with past commits is no longer the one a contributor wants to be
identified with.

The solution we came up with is to have a collection of contributor
identities, not a priori linked to any other service, where
individuals can set their preferred display name and "claim" git
usernames. When information obtained from the git log is
presented (currently the "Created by" page header and "Recent changes"
footer of pages), this table is consulted at website build-time to
display the preferred name.

If a contributor chooses not to be presented on the website, they can
be left out of the table.

The next step is to use this table to generate the CONTRIBUTORS.md
file from git log as well, instead of relying on GitHub APIs.

@EgbertRijke
Copy link
Collaborator

EgbertRijke commented Sep 15, 2023

For recent changes, perhaps the following format would be cleaner:

Date. Author (and coathors?). _Short commit title (#PR)_. Short commit hash.

@VojtechStep
Copy link
Collaborator Author

For recent changes, perhaps the following format would be cleaner:

Date. Author (and coathors?). _Short commit title (#PR)_. Short commit hash.

Thanks for pointing out the missing coauthors, they should be properly included in the Recent changes section now. I tried you suggested formatting; I think it's a step in the right direction, although I'm not a fan of the hash at the end. I'll try and play with it a bit more on Sunday.
image

@EgbertRijke
Copy link
Collaborator

EgbertRijke commented Sep 15, 2023

Well, since these titles are mostly PR titles (unless the commits are prehistoric) I think it makes sense to link to the specific PR. It is an easy way to get more information about the specific change that is listed here under recent changes.

I see now that your comment was about the hash. We could omit the hash.

@EgbertRijke
Copy link
Collaborator

Perhaps if we don't display the hash, the formatting could be cleaned up as follows:

Date. Authors and coauthors. _Title_. [#PR](link-to-pr)

@fredrik-bakke
Copy link
Collaborator

This makes it very similar to how we cite references currently, which is a nice bonus to consistency :)

@VojtechStep
Copy link
Collaborator Author

VojtechStep commented Sep 15, 2023

I'd rather not try to be smart and parse the PR from the commit message, but instead make a link to the specific commit (which we can do, since that's derived from the hash), and there GitHub adds the link for us - for example this a link to the last commit above: bfab474

edit: Github shortens the link, it looks like this https://github.com/UniMath/agda-unimath/commit/bfab47422b6f0110462fba1081ebd786257f38fc

@EgbertRijke
Copy link
Collaborator

I'd rather not try to be smart and parse the PR from the commit message, but instead make a link to the specific commit (which we can do, since that's derived from the hash), and there GitHub adds the link for us - for example this a link to the last commit above: bfab474

edit: Github shortens the link, it looks like this https://github.com/UniMath/agda-unimath/commit/bfab47422b6f0110462fba1081ebd786257f38fc

Sounds good!

@EgbertRijke
Copy link
Collaborator

EgbertRijke commented Sep 15, 2023

On the other hand, the link to pull request #XYZ seems to be just

https://github.com/UniMath/agda-unimath/pull/XYZ

So it looks like "trying not to be smart" might actually require some effort in this case

@VojtechStep
Copy link
Collaborator Author

On the other hand, the link to pull request #XYZ seems to be just

https://github.com/UniMath/agda-unimath/pull/XYZ

So it looks like "trying not to be smart" might actually require some effort in this case

"Trying not to be smart" in this case means not parsing the commit message at all, and instead use the commit hash we get from git 🤷

@EgbertRijke
Copy link
Collaborator

Yes, I think it will look better with it.

@EgbertRijke
Copy link
Collaborator

The following names need corrections:

Elif Uskuplu
Victor Blanchi
Ian Ray
Ivan Kobe
Daniel Gratzer
Maša Žaucer

@VojtechStep
Copy link
Collaborator Author

Thank you; I chose the display names that appeared on the existing contributors page, if these are more appropriate I will change them.

@EgbertRijke
Copy link
Collaborator

Can I launch it?:)

@VojtechStep
Copy link
Collaborator Author

If you feel like it 👀

@EgbertRijke
Copy link
Collaborator

Let's gooooooo 🚀

@EgbertRijke EgbertRijke merged commit 6af959b into UniMath:master Sep 18, 2023
@EgbertRijke
Copy link
Collaborator

Thank you for your amazing work!

@VojtechStep
Copy link
Collaborator Author

Now let's cross our fingers that the website build runs correctly in the CI 😅

@EgbertRijke
Copy link
Collaborator

It would be so funny if you made the entire website redirect here

@EgbertRijke
Copy link
Collaborator

Now let's cross our fingers that the website build runs correctly in the CI 😅

You shouldn't have said that:)

@VojtechStep
Copy link
Collaborator Author

macOS doesn't have cp -T? How do you guys live?

@EgbertRijke
Copy link
Collaborator

Who said we live?

@VojtechStep
Copy link
Collaborator Author

I think I have to make a new PR for the fix

@EgbertRijke
Copy link
Collaborator

Lol, get some sleep

@VojtechStep
Copy link
Collaborator Author

If that next PR doesn't fix it then I'm leaving it for tomorrow

@VojtechStep
Copy link
Collaborator Author

And I just saw that the checkout action does a --depth=1, so I'll also need to fix that, but that'll have to wait until tomorrow

@EgbertRijke
Copy link
Collaborator

Actually your fix doesn't show the names and the recent changes anymore

@VojtechStep
Copy link
Collaborator Author

Hm, you're right, it looks like the git metadata option didn't get enabled

@VojtechStep
Copy link
Collaborator Author

That's so weird, the CI straight up doesn't run the script. At least the contributor list is now fixed. I'll investigate more today.

@EgbertRijke
Copy link
Collaborator

When I try to build the website locally I get this (if it is any help to you):

Traceback (most recent call last):
  File "/Users/egbertrijke/Repositories/agda-unimath/./scripts/generate_contributors.py", line 7, in <module>
    from utils.contributors import CONTRIBUTORS_FILE, parse_contributors_file, sorted_authors_from_raw_shortlog_lines
  File "/Users/egbertrijke/Repositories/agda-unimath/scripts/utils/contributors.py", line 3, in <module>
    import tomli
ModuleNotFoundError: No module named 'tomli'
make: *** [CONTRIBUTORS.md] Error 1

@VojtechStep
Copy link
Collaborator Author

I added a Python dependency to requirements.txt, I should have mentioned that, please run python3 -m pip install -r scripts/requirements.txt again. The thing is that if the script failed, we'd get an error log from mdbook and the action would fail. As it stands it looks like mdbook never runs the preprocessor at all. I'm experimenting with the action in my repo so that we don't have to speculatively merge PRs

@EgbertRijke
Copy link
Collaborator

EgbertRijke commented Sep 18, 2023

It seems that one new module called tomli is required. We should make a habit of updating the install guide when we add new dependencies to the repository. Is tomli the only new requirement?

@VojtechStep
Copy link
Collaborator Author

VojtechStep commented Sep 18, 2023

What would the update say? We already say that the developer needs to run the above command, you just need to rerun it when the list of dependencies changes.

Edit: Oh I see that we have an explicit list of dependencies in the prose. I'll update it when I fix the the CI.

@EgbertRijke
Copy link
Collaborator

It should say what the script does, i.e., what it installs when you run it. We should not ask people to trust us with our script if we don't tell them what it does:)

@VojtechStep
Copy link
Collaborator Author

#786 should both fix the CI and document the new dependency

fredrik-bakke pushed a commit to fredrik-bakke/agda-unimath that referenced this pull request Sep 21, 2023
fredrik-bakke added a commit to fredrik-bakke/agda-unimath that referenced this pull request Sep 21, 2023
commit 6f8fdc1
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 23:22:39 2023 +0200

    hom-types are homs

commit d7cffc3
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 23:10:50 2023 +0200

    `is-set-hom`

commit 3a646ce
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 22:53:24 2023 +0200

    fix hom-set function categories

commit 3bfc7dd
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 22:49:08 2023 +0200

    rename hom-sets to `hom-set`

commit fd15e21
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 21:42:14 2023 +0200

    some comments

commit a95c86c
Author: Egbert Rijke <[email protected]>
Date:   Thu Sep 21 12:59:34 2023 +0200

    The classification of cyclic rings (UniMath#757)

    Co-authored-by: izak <[email protected]>

commit df1e6e6
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 14:20:56 2023 +0200

    consistencies

commit 04cf136
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 14:14:52 2023 +0200

    add projections initial and terminal objects

commit 2ac83c1
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 12:42:50 2023 +0200

    Functors _between_ large...

commit 5577dbb
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 12:33:03 2023 +0200

    functors _between_ categories

commit 786664f
Merge: e0f6858 da7e412
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 12:26:28 2023 +0200

    Merge branch 'master' into functor-categories

commit e0f6858
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 02:08:26 2023 +0200

    pre-commit

commit 3933794
Author: Fredrik Bakke <[email protected]>
Date:   Thu Sep 21 02:06:48 2023 +0200

    the functor category and natural isomorphisms

commit da7e412
Author: Vojtěch Štěpančík <[email protected]>
Date:   Wed Sep 20 19:01:16 2023 +0200

    Coforks, coequalizers of types, their flattening lemma (UniMath#792)

    This PR introduces coforks of parallel maps, the dependent and
    non-dependent universal properties of coequalizers, the construction of
    coequalizers from pushouts, and the flattening lemma for coequalizers,
    asserting that sigmas commute with coequalizers.

    This development mirrors the development of cocones and pushouts.

    I also changed the statement of the flattening lemma for pushouts to one
    that sounds more natural to me - we can construct a cocone of sigma
    types from any cocone, not just a pushout; the previous definition
    required the vertex to be a pushout in those definitions. Now the
    statement is "if a cocone is a pushout, then the cocone derived from it
    is a pushout too".

commit d9a8a02
Author: Fredrik Bakke <[email protected]>
Date:   Wed Sep 20 03:07:19 2023 +0200

    refactor isomorphisms in small (pre-)categories

commit f47cf60
Author: Fredrik Bakke <[email protected]>
Date:   Wed Sep 20 00:54:35 2023 +0200

    `is-iso` to `is-iso-hom`

commit 7955721
Merge: d1a36f7 eda7bb2
Author: Fredrik Bakke <[email protected]>
Date:   Wed Sep 20 00:31:31 2023 +0200

    Merge remote-tracking branch 'agda-unimath/master' into functor-categories

commit d1a36f7
Author: Fredrik Bakke <[email protected]>
Date:   Wed Sep 20 00:29:10 2023 +0200

    preliminary extensionality of functors

commit 30bfd00
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 15:30:00 2023 +0200

    split up definition `functor-precategory-Precategory`

commit 3e22d2a
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 15:14:06 2023 +0200

    a little refactoring of natural transformations

commit a9f5f27
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 15:13:08 2023 +0200

    Use `C` instead of `P` dependent products of precategories

commit eda7bb2
Author: Egbert Rijke <[email protected]>
Date:   Tue Sep 19 22:01:57 2023 +0200

    Isomorphisms in large categories and large precategories (UniMath#791)

commit cdc008d
Author: Egbert Rijke <[email protected]>
Date:   Tue Sep 19 13:19:50 2023 +0200

    Add a dot after the sentence "Content created by..." (UniMath#790)

commit a081293
Author: Egbert Rijke <[email protected]>
Date:   Tue Sep 19 13:01:42 2023 +0200

    Add the universal property of identity systems to the overview tables (UniMath#789)

commit fec9c63
Merge: 65483f6 9d2c235
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 02:26:31 2023 +0200

    Merge branch 'master' into functor-categories

commit 65483f6
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 02:25:24 2023 +0200

    `comp-natural-transformation-Large-Precategory` and associated refactoring

commit 9c166ae
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 00:05:11 2023 +0200

    pre-commit

commit 08af608
Author: Fredrik Bakke <[email protected]>
Date:   Tue Sep 19 00:00:34 2023 +0200

    prepend `map-` to `(obj/hom)-functor`

commit 43ee8e8
Author: Fredrik Bakke <[email protected]>
Date:   Mon Sep 18 23:47:47 2023 +0200

    small fixes

commit 51ec628
Author: Fredrik Bakke <[email protected]>
Date:   Mon Sep 18 23:21:34 2023 +0200

    misc cleanup natural transformations

commit 8e6f821
Author: Fredrik Bakke <[email protected]>
Date:   Mon Sep 18 23:19:43 2023 +0200

    define representing arrow category

commit 9d2c235
Author: Vojtěch Štěpančík <[email protected]>
Date:   Mon Sep 18 15:52:57 2023 +0200

    Fix website CI (UniMath#786)

commit 1bea263
Author: Vojtěch Štěpančík <[email protected]>
Date:   Mon Sep 18 09:52:52 2023 +0200

    Always enable git metadata, fetch whole git history in pages CI (UniMath#785)

commit b1f027f
Author: Vojtěch Štěpančík <[email protected]>
Date:   Mon Sep 18 03:25:35 2023 +0200

    Try to fix website CI (UniMath#784)

commit 6af959b
Author: Vojtěch Štěpančík <[email protected]>
Date:   Mon Sep 18 03:01:42 2023 +0200

    Automatically extract page contributor information during web build (UniMath#770)

commit b66c539
Merge: 47f04e3 539174a
Author: Fredrik Bakke <[email protected]>
Date:   Mon Sep 18 01:19:20 2023 +0200

    Merge branch 'UniMath:master' into functor-categories

commit 47f04e3
Author: Fredrik Bakke <[email protected]>
Date:   Mon Sep 18 01:18:42 2023 +0200

    links functors between categories

commit 539174a
Author: Fredrik Bakke <[email protected]>
Date:   Mon Sep 18 00:39:14 2023 +0200

    Yoneda's lemma for categories (UniMath#783)

commit 0106784
Author: Egbert Rijke <[email protected]>
Date:   Sun Sep 17 18:05:43 2023 +0200

    Moving file about hexagons of identifications (UniMath#782)

commit b804ea5
Author: Egbert Rijke <[email protected]>
Date:   Sun Sep 17 11:45:44 2023 +0200

    Update README.md (UniMath#781)

commit f7d6658
Author: Egbert Rijke <[email protected]>
Date:   Sun Sep 17 11:24:59 2023 +0200

    Update README.md (UniMath#780)

commit f4f4ef2
Author: Egbert Rijke <[email protected]>
Date:   Sun Sep 17 11:13:37 2023 +0200

    Update README.md (UniMath#779)

commit 6df85b4
Author: Egbert Rijke <[email protected]>
Date:   Sun Sep 17 11:08:03 2023 +0200

    Fancy title on repo page (UniMath#778)

commit 1fb5dc5
Author: maybemabeline <[email protected]>
Date:   Sat Sep 16 22:32:19 2023 +0200

    Equivalence between the first sphere and the circle (UniMath#776)

    Co-authored-by: Egbert Rijke <[email protected]>

commit 1fe0803
Author: Fredrik Bakke <[email protected]>
Date:   Fri Sep 15 16:18:37 2023 +0200

    Define representations of monoids (UniMath#765)

commit c813a06
Author: Egbert Rijke <[email protected]>
Date:   Fri Sep 15 15:17:44 2023 +0200

    larger image, rounded corners (UniMath#774)

commit 0529896
Author: Egbert Rijke <[email protected]>
Date:   Fri Sep 15 13:23:30 2023 +0200

    update contributors (UniMath#773)

commit 5340335
Author: Egbert Rijke <[email protected]>
Date:   Fri Sep 15 10:58:02 2023 +0200

    update contributors, remove unused imports (UniMath#772)

commit 533cff1
Author: Egbert Rijke <[email protected]>
Date:   Fri Sep 15 01:08:32 2023 +0200

    Adding an art page (UniMath#771)

    Co-authored-by: Andrej Bauer <[email protected]>
    Co-authored-by: Matej Petković <[email protected]>

commit adf864e
Author: Egbert Rijke <[email protected]>
Date:   Thu Sep 14 16:44:32 2023 +0200

    Symmetric core of a relation (UniMath#754)

    In this PR we construct the symmetric core of a type valued relation and
    show that it is the right adjoint of the restriction functor from
    symmetric relations to relations. Everything we do in this PR is fully
    coherent and untruncated.

    ---------

    Co-authored-by: Fredrik Bakke <[email protected]>

commit 50fdf54
Author: Egbert Rijke <[email protected]>
Date:   Wed Sep 13 19:11:14 2023 +0200

    The one-object precategory of a monoid (UniMath#766)

commit 413a1bf
Author: Vojtěch Štěpančík <[email protected]>
Date:   Wed Sep 13 18:35:55 2023 +0200

    Flattening lemma for pushouts (UniMath#764)

commit d826323
Author: Egbert Rijke <[email protected]>
Date:   Wed Sep 13 17:00:53 2023 +0200

    rational commutative monoids (UniMath#763)

    This small PR factors out rational commutative monoids from UniMath#623.

    ---------

    Co-authored-by: Fredrik Bakke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request website
Projects
None yet
3 participants