Skip to content

Conversation

@LarsKue
Copy link
Contributor

@LarsKue LarsKue commented Mar 28, 2025

Some docstrings don't yet render correctly:

  • datasets is missing the 2nd half of the text
  • experimental is missing the "Proceed with caution."
  • simulators is missing the 2nd half of the text

We could also try to improve the links to keras classes with intersphinx.

@LarsKue LarsKue added the documentation Improvements or additions to documentation label Mar 28, 2025
@LarsKue LarsKue added this to the BayesFlow 2.0 milestone Mar 28, 2025
@LarsKue LarsKue requested a review from stefanradev93 March 28, 2025 10:30
@LarsKue LarsKue self-assigned this Mar 28, 2025
@LarsKue LarsKue requested review from Copilot and vpratz March 28, 2025 10:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the docstrings across multiple modules to address rendering issues in the API reference landing page. The changes complete truncated text in the "datasets", "simulators", and "experimental" modules, and provide clearer descriptions for the packages.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bayesflow/workflows/init.py Added docstring for the BasicWorkflow interface
bayesflow/utils/init.py Introduced a module-level docstring for utility functions
bayesflow/types/init.py Updated docstring to clarify type usage for annotations
bayesflow/simulators/init.py Expanded docstring to include missing text about the Simulator
bayesflow/networks/init.py Added improved description for neural network architectures
bayesflow/metrics/init.py Updated metric module docstring with clearer guidelines
bayesflow/experimental/init.py Fixed missing “Proceed with caution.” in the experimental modules
bayesflow/distributions/init.py Corrected and completed the distribution module docstring
bayesflow/diagnostics/init.py Refined docs for plotting and metric utilities
bayesflow/datasets/init.py Updated dataset module docstring to include complete text
bayesflow/approximators/init.py Added comprehensive description for approximator components
bayesflow/adapters/init.py Included clear narrative for adapter transforms detailing usage
Comments suppressed due to low confidence (2)

bayesflow/networks/init.py:2

  • [nitpick] The escaped 's' in this docstring appears unusual; please verify whether the backslash is necessary for correct rendering of the trailing 's' or if it can be removed.
A rich collection of neural network architectures for use in :py:class:`~bayesflow.approximators.Approximator`\ s.

bayesflow/metrics/init.py:2

  • [nitpick] The backslash before the trailing 's' in this link text seems atypical; please check if it's required for correct docstring formatting or if it should be omitted.
A collection of `keras.Metric <https://keras.io/api/metrics/base_metric/#metric-class>`__\ s for evaluating the

@codecov
Copy link

codecov bot commented Mar 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
bayesflow/adapters/__init__.py 100.00% <ø> (ø)
bayesflow/approximators/__init__.py 100.00% <ø> (ø)
bayesflow/datasets/__init__.py 100.00% <ø> (ø)
bayesflow/diagnostics/__init__.py 100.00% <ø> (ø)
bayesflow/distributions/__init__.py 100.00% <ø> (ø)
bayesflow/experimental/__init__.py 100.00% <ø> (ø)
bayesflow/metrics/__init__.py 100.00% <ø> (ø)
bayesflow/networks/__init__.py 100.00% <ø> (ø)
bayesflow/simulators/__init__.py 100.00% <ø> (ø)
bayesflow/types/__init__.py 100.00% <ø> (ø)
... and 2 more

Copy link
Collaborator

@vpratz vpratz left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for writing them :)

@LarsKue
Copy link
Contributor Author

LarsKue commented Mar 28, 2025

@vpratz Do you know why some of the text does not render correctly? I have tried searching for a solution to this but have not come up with anything. See the original post for examples.

@vpratz
Copy link
Collaborator

vpratz commented Mar 28, 2025

Sorry, I missed the original post, I'll take a look.
Regarding intersphinx for Keras: Unfortunately, as Keras is not using sphinx, intersphinx is not an option here as far as I could tell. If you come across a way to use intersphinx (or something similar) here, please let me know, it would certainly be a nice addition.

@vpratz
Copy link
Collaborator

vpratz commented Mar 28, 2025

So, the missing part is due to Sphinx autosummary only displaying what it considers the first sentence, so up to the first period (excluding special ones like those in brackets, classnames etc). I'll search if there are options in to adapt this behavior.

@vpratz
Copy link
Collaborator

vpratz commented Mar 28, 2025

From my first impression, it does not seem configurable. I think our main options are:

  • Rephrase/shorten, so that we only have one sentence that goes into the table. The full description will show up on the modules page.
  • Using UTF-8 fake dots, which are not matched by the regular expression, I think one dot leader would be the character of choice here. This is confusing for anyone trying to modify those docs in the future though.
  • Replacing the table with something manually written in the docs. This gives us more freedom, but is prone to duplicates/incongruent information of code vs. docs.

What do you think is best here? Or do you have other ideas?

@LarsKue
Copy link
Contributor Author

LarsKue commented Mar 31, 2025

@vpratz Thank you for the research. I'll improve the first sentence of the docs.

@vpratz
Copy link
Collaborator

vpratz commented Apr 1, 2025

Looks good to me, thanks for the changes :)

@vpratz vpratz merged commit 5c5bc6b into main Apr 1, 2025
15 checks passed
@vpratz vpratz deleted the populate-api-reference-landing-page branch April 1, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants