Skip to content

DOC improve reference API rendering - #1019

Merged
janfb merged 12 commits into
sbi-dev:mainfrom
tomMoral:DOC_improve_reference_page
Mar 25, 2024
Merged

janfb merged 12 commits into
sbi-dev:mainfrom
tomMoral:DOC_improve_reference_page

Conversation

@tomMoral

Copy link
Copy Markdown
Contributor

API rendering before change:
image

API rendering after change:
image

Also make DensityEstimator an abstract class (failure on instanciation if a abstract method is missing) and removed __init__ and check_condition_shape which are not part of the public API.
The description of the class is now included in the reference API page.

@codecov

codecov Bot commented Mar 19, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.85%. Comparing base (4c2f71e) to head (f6cf0a5).
Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1019      +/-   ##
==========================================
+ Coverage   76.37%   76.85%   +0.47%     
==========================================
  Files          84       89       +5     
  Lines        6507     6550      +43     
==========================================
+ Hits         4970     5034      +64     
+ Misses       1537     1516      -21     
Flag Coverage Δ
unittests 76.85% <ø> (+0.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@plcrodrigues

Copy link
Copy Markdown
Collaborator

Added a few things:

  • Splitting the API reference into folders as done in the draft Improve documentation website, add automatic API docs #964
  • Added some color tags so it is easier to distinguish classes from methods and functions, etc
  • Changed the heading level to two so to show the names of the methods on the right column
Screenshot 2024-03-20 at 10 31 00

@janfb

janfb commented Mar 20, 2024

Copy link
Copy Markdown
Contributor

Can we close the draft #964 then?

@plcrodrigues

Copy link
Copy Markdown
Collaborator

Yes, just did that!

@janfb

janfb commented Mar 20, 2024

Copy link
Copy Markdown
Contributor

I suggest to move the changes to sbi/neural_nets/density_estimators to a separate PR and focus this PR on the changes to the docs/, would you agree?

In that separate PR, we could also add the changes planned in #1061 , #1046

@janfb janfb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is great, thanks!
Please remove the changes to snpe_a.py - we will fix them in the other PR on the DensityEstimator abstraction. #1072

Comment thread docs/docs/reference/inference.md Resolved
Comment thread sbi/inference/snpe/snpe_a.py Resolved

@famura famura left a comment

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.

Your changes made the docs far more readable


::: sbi.inference.posteriors.direct_posterior.DirectPosterior
selection:
filters: [ "!^_", "^__", "!^__class__" ]

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.

I have a question on these filters. Do they work for main page as well as for the table of contents (right side)? In other words? is it possible to filter different things for them?

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.

I don't think this works to have different navigation on the right side as I think this is mostly decided based on the headers part and not based on mkdocstrings extension which is the one responsible for generating this part.

But I am pretty sure there are some options to tweak the the navigation bar in mkdocs and to filter some of the headers in the TOC.

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.

I see. Can you explain to my why the init fcns are displayed in the doc in the last snapshot picture (2 days ago) but not in the one before that? (search for "API rendering after change:")?

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.

because pedro changed the heading levels.
basically the nav shows all headerd above level 3, my proposal was with class and func as header 3 (and thus methods as header 4) while now it is header 2.

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.

I see, so the lower heading_level is, the more (less important) things are displayed

Comment thread docs/mkdocs.yml Resolved
@tomMoral

Copy link
Copy Markdown
Contributor Author

The PR is green, let me know if anything more is required :)

@janfb janfb mentioned this pull request Mar 22, 2024
8 tasks done
@plcrodrigues

Copy link
Copy Markdown
Collaborator

Hi, sorry for bothering you guys (@janfb and @michaeldeistler) but what is the current politics for dealing with PRs in sbi? Should we wait for one of you guys (or someone else from the mackelab) to review and merge the branch? or can we do it?

On a related topic, someone will have to do the mkdocs gh-deploy in the gh-pages branch so that changes made in this PR and several others are taken into account in the website. When would be the correct moment to do so?

@michaeldeistler michaeldeistler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For PRs which do not make any fundamental changes to the core of the codebase (like this one) I am fine if you review amongst yourselves and merge, especially if one of us has already had a look before.

@janfb

janfb commented Mar 25, 2024

Copy link
Copy Markdown
Contributor

Hi, sorry for bothering you guys (@janfb and @michaeldeistler) but what is the current politics for dealing with PRs in sbi? Should we wait for one of you guys (or someone else from the mackelab) to review and merge the branch? or can we do it?

On a related topic, someone will have to do the mkdocs gh-deploy in the gh-pages branch so that changes made in this PR and several others are taken into account in the website. When would be the correct moment to do so?

thanks for bringing this up. I agree with @michaeldeistler but I think we should find a general solution to this. At the moment, everyone in team contributor can click the merge button once there is one approval. Maybe we should restrict this to a team of maintainers because the contributor team became quite large recently :)

Regarding the docs, I can do that.

@janfb
janfb merged commit a2ab100 into sbi-dev:main Mar 25, 2024
@famura

famura commented Mar 26, 2024

Copy link
Copy Markdown
Collaborator

Maybe we should restrict this to a team of maintainer

I'd be interested on how to do that. Last time I checked, it was not straight forward. This might be a good point to start

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.

5 participants