Skip to content

Conversation

@max-models
Copy link
Owner

@max-models max-models commented Jun 22, 2025

Published docs to https://max-models.github.io/maxplotlib/

For now, the tutorials are simply generated

@max-models max-models linked an issue Jun 22, 2025 that may be closed by this pull request
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 22, 2025

Reviewer's Guide

Introduces a full “gallery” of Jupyter‐based tutorials integrated into Sphinx, updates CI to auto‐build and publish HTML docs, refactors a couple of plotting interfaces, and cleans up the existing tutorial notebooks for consistency.

Class diagram for updated plotting interfaces

classDiagram
  class Canvas {
    +plot_matplotlib(show=True, savefig=False, layers=None, usetex=False)
  }
  class TikzFigure {
    +plot_matplotlib(ax, layers=None)
  }
  class LinePlot {
    +add_node(x, y, label=None, content="", layer=0, **kwargs)
  }
  Canvas --> TikzFigure : add_tikzfigure()
  Canvas --> LinePlot : add_subplot()
  TikzFigure <|-- LinePlot
Loading

File-Level Changes

Change Details Files
Add new tutorials and integrate with Sphinx documentation
  • Introduce tutorial notebooks 01–06 under tutorials/
  • Configure nbsphinx and copy tutorials into docs via conf.py
  • Add Sphinx makefiles (Makefile, make.bat) and index.rst
  • Enable mathjax and autodoc in Sphinx extensions
tutorials/tutorial_01.ipynb
tutorials/tutorial_02.ipynb
tutorials/tutorial_03.ipynb
tutorials/tutorial_04.ipynb
tutorials/tutorial_05.ipynb
tutorials/tutorial_06.ipynb
docs/source/conf.py
docs/Makefile
docs/make.bat
docs/source/index.rst
pyproject.toml
Configure CI to build and upload HTML docs
  • Add build_docs job to GitHub Actions pipeline
  • Install Sphinx‐related dependencies in CI
  • Run make html and upload docs/build/html as artifact
.github/workflows/ci_pipeline.yml
Update pyproject and development tooling
  • Add docs extras (myst-parser, nbsphinx, etc.)
  • Include nbstripout and pre-commit hooks
  • Extend maxplotlib[test] to maxplotlib[test,docs]
pyproject.toml
.pre-commit-config.yaml
Clean up and simplify tutorial_02 notebook
  • Convert first cell to markdown heading
  • Remove large embedded outputs and base64 images
  • Update PDF compile targets (tutorial_02_01/02/03.pdf)
  • Reset execution_count and clear outputs
tutorials/tutorial_02.ipynb
Refactor plotting interfaces and add diagnostics
  • Extend plot_matplotlib signature to accept layers
  • Add debug print statements in Canvas and Tikzlayer
  • Adjust compile_pdf call to use new defaults
src/maxplotlib/canvas/canvas.py
src/maxplotlib/subfigure/tikz_figure.py
src/maxplotlib/subfigure/line_plot.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @max-models - I've reviewed your changes - here's some feedback:

  • It looks like you left debug print statements in canvas.plot_matplotlib and line_plot.add_node—please remove those so the API is clean.
  • This PR mixes huge notebook-output stripping with API changes and CI additions—consider splitting notebook cleanup, code refactors (like the plot_matplotlib signature change), and docs/CI updates into smaller focused PRs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- It looks like you left debug `print` statements in `canvas.plot_matplotlib` and `line_plot.add_node`—please remove those so the API is clean.
- This PR mixes huge notebook-output stripping with API changes and CI additions—consider splitting notebook cleanup, code refactors (like the `plot_matplotlib` signature change), and docs/CI updates into smaller focused PRs.

## Individual Comments

### Comment 1
<location> `src/maxplotlib/canvas/canvas.py:208` </location>
<code_context>

         for (row, col), subplot in self.subplots.items():
             ax = axes[row][col]
+            print(f"{subplot = }")
             subplot.plot_matplotlib(ax, layers=layers)
             # ax.set_title(f"Subplot ({row}, {col})")
</code_context>

<issue_to_address>
Debug print statement left in production code.

Remove the print statement or replace it with appropriate logging if necessary.
</issue_to_address>

### Comment 2
<location> `src/maxplotlib/subfigure/line_plot.py:250` </location>
<code_context>
         if layer in self.layers:
             self.layers[layer].add(node)
         else:
+            print(f"{self.layers = } {layer = }")
             self.layers[layer] = Tikzlayer(layer)
             self.layers[layer].add(node)
</code_context>

<issue_to_address>
Debug print statement should be removed.

Consider removing this print statement or replacing it with a logger at the appropriate log level.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@max-models max-models merged commit 6f9918f into devel Jun 22, 2025
2 checks passed
@max-models max-models deleted the 13-create-a-gallery branch June 22, 2025 10:29
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.

Create a gallery

2 participants