Skip to content

Conversation

@FBruzzesi
Copy link
Collaborator

Description

This PR substitutes the sphinx docs in favor of mkdocs style via mkdocs-material and mkdocsrings-python (depends on #586).

In particular it migrates all the notebooks directly to markdown files (almost one-to-one mapping).

Render locally

To render the documentation locally, you can run the following command from the root of the repository:

make docs

Then the documentation page will be available at localhost.

Remark

The majority of code displayed in the markdowns and code generate plots in the documentation is generated using the scripts in the docs/_scripts folder, and then accessed via the pymdown snippets extension.

To generate the plots from scratch it is enough to run the following command from the root of the repository:

cd docs
make generate-all

which will run all the scripts and save results in the docs/_static folder.

Notice that not every image is code generated!

dmypy.json

# editor
.vscode
Copy link
Owner

@koaning koaning Oct 30, 2023

Choose a reason for hiding this comment

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

CleanShot 2023-10-30 at 07 06 02@2x

Copy link
Owner

Choose a reason for hiding this comment

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

And I think we can move the Rstudio bit to a place where it's less front-and-center. Not that many folks will use it.

Copy link
Collaborator Author

@FBruzzesi FBruzzesi Oct 30, 2023

Choose a reason for hiding this comment

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

Should RStudio queue on the user guide? At the end of the day it is a tutorial just as the others?

Copy link
Owner

@koaning koaning left a comment

Choose a reason for hiding this comment

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

Left some initial comments. In short: this looks great and thanks for the effort!

dmypy.json

# editor
.vscode
Copy link
Owner

Choose a reason for hiding this comment

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

And I think we can move the Rstudio bit to a place where it's less front-and-center. Not that many folks will use it.

@koaning
Copy link
Owner

koaning commented Nov 7, 2023

I just approved the docstrings PR. I think once you agree it's good to merge in we can sync it here and start work on getting this merged in. 👍

@koaning
Copy link
Owner

koaning commented Nov 8, 2023

@FBruzzesi could you fix the optional dependencies CI job? I think runing mkdocs build there instead of sphinx should be fine as a check.

Comment on lines +3 to +4
# site_description: tbd
# site_url: tbd
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Left both to compile in the future

Copy link
Collaborator Author

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

As a minor comment but very annoying behaviour, I am getting a lot of warnings when building the docs locally.
Couldn't manage to find a fix for both image references and links for autorefers

@koaning
Copy link
Owner

koaning commented Nov 22, 2023

Yeah those warnings are annoying, but as long as there's a test in CI that confirms that it's still able to build then I think we can live with it.

One detail, I pay for mkdocstrings via their insiders program so if I render the page I can get a big of extra sugar on the methods/classes like here.

Preview

CleanShot 2023-11-22 at 20 34 15

@koaning
Copy link
Owner

koaning commented Nov 22, 2023

@FBruzzesi maybe as a final step, could we add a CI file like this one?

name: Confirm MKdocs can build

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.9]
        os: [ubuntu-latest]
    steps:
    - uses: actions/checkout@v1
    - name: setup ${{ matrix.python-version }}
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}
    - name: install
      run: |
        make install
    - name: build docs
      run: python -m mkdocs build

Just to confirm that the docs can build on each PR?

Comment on lines 46 to +50
- name: Docs can Build
run: |
sudo apt-get update && sudo apt-get install pandoc
python -m pip install -e ".[docs]"
sphinx-build doc docs
mkdocs build
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as a final step, could we add a CI file like this one?

@koaning how's that different from the one we have here?

Copy link
Owner

Choose a reason for hiding this comment

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

Ah! I somehow missed that. LGTM then :)

@FBruzzesi
Copy link
Collaborator Author

One detail, I pay for mkdocstrings via their insiders program so if I render the page I can get a big of extra sugar on the methods/classes like here.

That's a nice touch! Indeed you are also the only one to be able to deploy them in any case 😂

BTW the meth for method is just hilarious

Comment on lines +116 to +118
validation:
absolute_links: ignore
unrecognized_links: ignore
Copy link
Collaborator Author

@FBruzzesi FBruzzesi Nov 27, 2023

Choose a reason for hiding this comment

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

Found these parameters to have waaaaaaaay less info/warning when building the docs

@koaning koaning merged commit 2831264 into koaning:main Nov 29, 2023
@FBruzzesi FBruzzesi deleted the docs/mkdocs-site branch November 30, 2023 08:07
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.

2 participants