Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

  • Understand the issue: code-block directives in fourier.py don't execute code or generate images
  • Change code-block:: python directives to plot:: directives for examples that generate plots (lines 73-94, 124-145)
  • Add complete setup code to plot directives so they are self-contained and can execute properly
  • Keep code-block for examples that are purely for syntax demonstration

Summary

Fixed rendering issues by including setup code in plot directives:

  1. Lines 73-94: Plot the prior fourier seasonality trend (now includes full setup)
  2. Lines 124-145: Plot with hierarchical coordinates (now includes full setup)

Each plot directive is now self-contained with all necessary imports and setup code, ensuring the yearly variable is properly defined when the plot executes. The setup code is still shown separately in code-block:: directives for educational reference, but the plot directives contain complete working examples.

Original prompt

This section details on the original issue you should resolve

<issue_title>Fourier example images not building</issue_title>
<issue_description>
Reference: https://www.pymc-marketing.io/en/stable/api/generated/pymc_marketing.mmm.fourier.html
</issue_description>

Comments on the Issue (you are @copilot in this section)

@OriolAbril The first block of code in the [source file](https://github.com/pymc-labs/pymc-marketing/blob/main/pymc_marketing/mmm/fourier.py) is using the matplotlib `plot` directive so the images are shown but the code isn't (this is the default behaviour but can be configured). The other code blocks are using the `code-block` directive which is only for syntax highlight and monospaced font, it won't execute the code inside it.

The code-block directive should be changed to either the plot directive or the ipython one.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


📚 Documentation preview 📚: https://pymc-marketing--2067.org.readthedocs.build/en/2067/

@github-actions github-actions bot added no releasenotes docs Improvements or additions to documentation good first issue Good for newcomers . Doesn't require extensive knowledge of the repo and package model components Related to the various model components research_complete labels Nov 4, 2025
…ate images

Co-authored-by: juanitorduz <22996444+juanitorduz@users.noreply.github.com>
@github-actions github-actions bot added the MMM label Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.56%. Comparing base (daba54b) to head (f89f24e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2067   +/-   ##
=======================================
  Coverage   92.56%   92.56%           
=======================================
  Files          68       68           
  Lines        9420     9420           
=======================================
  Hits         8720     8720           
  Misses        700      700           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI changed the title [WIP] Fix Fourier example images not building Fix Fourier example images not building in documentation Nov 4, 2025
Copilot AI requested a review from juanitorduz November 4, 2025 21:21
Copilot finished work on behalf of juanitorduz November 4, 2025 21:21
Copy link
Collaborator

@juanitorduz juanitorduz left a comment

Choose a reason for hiding this comment

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

Adress the feedback @copilot

Comment on lines 55 to 57
.. plot::
:context: close-figs
:nofigs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot undo this change, we do not need this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit 3ed3567. The setup code block is now back to code-block:: python.

Comment on lines 97 to 99
.. plot::
:context: close-figs
:nofigs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this change as we do not need it @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit 3ed3567. The hierarchical setup code block is now back to code-block:: python.

Co-authored-by: juanitorduz <22996444+juanitorduz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 4, 2025

Adress the feedback @copilot

Addressed in commit 3ed3567. Reverted the setup code blocks (lines 55-69 and 95-107) back to code-block:: directives. Only the two examples that actually generate plots (lines 73-81 and 111-120) remain as plot:: directives.

Copilot AI requested a review from juanitorduz November 4, 2025 21:54
Copilot finished work on behalf of juanitorduz November 4, 2025 21:54
Copy link
Collaborator

@juanitorduz juanitorduz left a comment

Choose a reason for hiding this comment

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

Co-authored-by: juanitorduz <22996444+juanitorduz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 4, 2025

@copilot

Addressed the rendering issue in commit 582e9c2. Both plot directives now include the complete setup code so they execute properly and generate images.

Copilot AI requested a review from juanitorduz November 4, 2025 22:24
Copilot finished work on behalf of juanitorduz November 4, 2025 22:24
@juanitorduz
Copy link
Collaborator

@williambdean WDYT?

@williambdean williambdean marked this pull request as ready for review November 17, 2025 21:48
@juanitorduz juanitorduz merged commit f59d7e3 into main Nov 17, 2025
37 of 38 checks passed
@juanitorduz juanitorduz deleted the copilot/fix-fourier-image-building branch November 17, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation good first issue Good for newcomers . Doesn't require extensive knowledge of the repo and package MMM model components Related to the various model components no releasenotes research_complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fourier example images not building

3 participants