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

Hide runtime info behind <details> #104

Merged
merged 24 commits into from
Mar 15, 2022
Merged

Hide runtime info behind <details> #104

merged 24 commits into from
Mar 15, 2022

Conversation

st--
Copy link
Member

@st-- st-- commented Jan 29, 2022

resolves #100

@st-- st-- changed the title Hide package/computer info behind <details> Hide runtime info behind <details> Jan 29, 2022
@codecov
Copy link

codecov bot commented Jan 29, 2022

Codecov Report

Merging #104 (9acae42) into master (e8513ad) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #104   +/-   ##
=======================================
  Coverage   95.78%   95.78%           
=======================================
  Files           4        4           
  Lines         285      285           
=======================================
  Hits          273      273           
  Misses         12       12           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8513ad...9acae42. Read the comment docs.

@devmotion
Copy link
Member

Is it possible to use the same approach in the notebook output as well?

The only unfortunate point, I think, is that it's quite easy to miss this information - not because it's collapsed but mainly because it seems it isn't shown as a heading anymore and just appears after the last sentence or plot. Maybe it would be a bit clearer if this collapsed info appears at the end of the setup section? Alternatively, since I guess it might be difficult to implement this in the pre-process function, maybe have still a separate section in the end of the example and then at the collapsed info in this section?

@st--
Copy link
Member Author

st-- commented Jan 29, 2022

I had skipped it for the notebooks because theo had looked into it and said it was buggy (see source code).

I think it's sufficiently visible as is - anyone who is looking for it can see it - the point was to make it less visible because for most people most of the time it will just be unnecessary information.

@st--
Copy link
Member Author

st-- commented Jan 29, 2022

So the <details> block works fine in the actual jupyter notebook (when downloading locally), just nbviewer stops parsing markdown once it encounters the html tags. I don't mind either way - I could happily live both with the formatting looking off on nbviewer, and with not hiding it at all on the notebook. As long as it's hidden away in the docs.:)

docs/literate.jl Outdated
info_footer = """
#md # ```@raw html
# <details>
# <summary><h3>Click to expand package and system information</h3></summary>
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried out putting a <h3> inside the <summary>, but it makes the formatting look weird in the docs.

Suggested change
# <summary><h3>Click to expand package and system information</h3></summary>
# <summary><strong>Package and system information (click to expand)</strong></summary>

Copy link
Member Author

Choose a reason for hiding this comment

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

@devmotion have you looked at the docs preview with this change?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I did but it does not address my comments. I think it should be in a separate section, it doesn't belong in the last section of the example and is clearly enough separated visually: #104 (comment)

@rossviljoen
Copy link
Collaborator

If the formatting's broken, I'd vote for just not hiding it in the nb

@devmotion
Copy link
Member

I think it's sufficiently visible as is - anyone who is looking for it can see it - the point was to make it less visible because for most people most of the time it will just be unnecessary information.

I don't have a problem with collapsing it - I just don't like that the reduced version is not separated clearly from the rest anymore. Maybe just put it in a separate section in the end, as suggested above? I.e. something like

## Package and system information

```@raw html
<details>
...
</details>
```

docs/literate.jl Outdated Show resolved Hide resolved
st-- and others added 2 commits January 31, 2022 14:28
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
docs/literate.jl Outdated Show resolved Hide resolved
st-- and others added 3 commits January 31, 2022 16:14
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@st--
Copy link
Member Author

st-- commented Jan 31, 2022

If the formatting's broken, I'd vote for just not hiding it in the nb

I've managed to fix it: ) @rossviljoen

docs/literate.jl Outdated

using Literate: Literate

const MANIFEST_OUT = joinpath(EXAMPLE, "Manifest.toml")
mkpath(joinpath(OUTDIR, EXAMPLE))
cp(joinpath(EXAMPLEPATH, "Manifest.toml"), joinpath(OUTDIR, MANIFEST_OUT); force=true)

""" adapted from HttpCommon.jl """
Copy link
Member Author

Choose a reason for hiding this comment

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

to avoid an extra dependency (which at this point every example would have to add) for just for one function

Comment on lines -19 to -21
manifest_status = sprint() do io
Pkg.status(; io=io, mode=Pkg.PKGMODE_MANIFEST)
end
Copy link
Member Author

Choose a reason for hiding this comment

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

wasn't used anywhere

docs/literate.jl Outdated
Comment on lines 84 to 85
#nb <a href="$(MANIFEST_OUT)">download the full Manifest.toml</a>.
#md [download the full Manifest.toml]($(MANIFEST_OUT)).
Copy link
Member Author

Choose a reason for hiding this comment

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

Nbviewer needs the HTML link as it does not parse markdown within HTML.
Documenter treats the markdown-style link slightly differently from the HTML link, and the latter would point to the wrong path.

docs/literate.jl Outdated Show resolved Hide resolved
docs/literate.jl Outdated Show resolved Hide resolved
docs/literate.jl Outdated Show resolved Hide resolved
docs/literate.jl Outdated Show resolved Hide resolved
docs/literate.jl Outdated Show resolved Hide resolved
docs/literate.jl Outdated Show resolved Hide resolved
docs/literate.jl Outdated Show resolved Hide resolved
Copy link
Collaborator

@rossviljoen rossviljoen left a comment

Choose a reason for hiding this comment

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

One weird formatting issue but otherwise lgtm

docs/literate.jl Outdated Show resolved Hide resolved
@st--
Copy link
Member Author

st-- commented Feb 1, 2022

I'm happy with how it all looks now, and everything is working in both the docs and nbviewer.
I would like to keep it as it is now. I think it's an improvement over both the immediately-previous state and over how it was before we added any runtime details to the notebooks.
I've already spent way more time than I meant to on trying to make the docs better.
I've already nearly decided to just give up and stop contributing altogether.

@st-- st-- requested a review from devmotion February 1, 2022 08:28
Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

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

I appreciate your efforts @st-- but unfortunately I don't have anything new to add. It seems @theogf and I would both prefer a separate section with a heading and some collapsed details. I am convinced this improves discoverability and helps those interested in such information while keeping the distraction and amount of additional information for those not interested minimal. I made inline suggestions that you should be able to accept without additional manual changes.

st-- and others added 8 commits March 15, 2022 13:14
* Fix file size of notebook

* Fix format

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Change comment

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* CompatHelper: bump compat for "GPLikelihoods" to "0.3"

* Reorder Gamma parametrization

* Update project versions

* Missing one

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Théo Galy-Fajou <[email protected]>
* Fix outdated `literate.jl` script

* Fix format
* stab at submodules

* move approx_lml to API

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* clean up imports

* remove unused imports

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* docfix

* missing import

* test: remove submodules from api docs

* subpages in docs

* hide private API docstrings

* mention types in api/index.md

* qualify

* remove extra line

* minor bump#

* change docs/ compat

* update test compat

* explicitly `@reexport` to avoid exporting the submodules!

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* add likelihood imports

* add import

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* add import

* Update src/SparseVariationalApproximationModule.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@st-- st-- merged commit f0a258e into master Mar 15, 2022
@st-- st-- deleted the st/examples_details branch March 15, 2022 12:05
@devmotion
Copy link
Member

Was it decided in a meeting that the PR should be merged in its current state? I'm a bit surprised since it seems @theogf's and my comments were not addressed and I don't think we had a vote on this design question (IIRC it was only suggested on Slack a while ago).

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.

[Tutorials] Hide the whole runtime info within a <details></details> block
4 participants