Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gridding Cookbook to the gallery #159

Merged
merged 4 commits into from
Aug 7, 2023
Merged

Add Gridding Cookbook to the gallery #159

merged 4 commits into from
Aug 7, 2023

Conversation

r-ford
Copy link
Member

@r-ford r-ford commented Jul 18, 2023

This cookbook was removed in #142

@r-ford r-ford requested a review from a team as a code owner July 18, 2023 16:35
@r-ford r-ford requested review from ktyle and erogluorhan and removed request for a team July 18, 2023 16:35
@github-actions
Copy link

github-actions bot commented Jul 18, 2023

👋 Thanks for opening this PR! The Cookbook will be automatically built with GitHub Actions. To see the status of your deployment, click below.
🔍 Git commit SHA: 26b1afd
✅ Deployment Preview URL: https://ProjectPythia.github.io/cookbook-gallery/_preview/159

@r-ford
Copy link
Member Author

r-ford commented Jul 18, 2023

It looks like the issue is still there.

@brian-rose
Copy link
Member

The error log is not very helpful here. But I wonder if the gallery generator is choking on this line in the config file

title: (re)Gridding with xarray

Maybe the fact that the title starts with ( is breaking one of our scripts.

@brian-rose
Copy link
Member

After some local debugging, the reason turns out to be this line in the _gallery_info.yml file which has an empty tag:

tags:
  domains: 
  packages: 
    - xarray

etc.

Turns out our code doesn't know how to handle an empty set of tags.

A simple workaround would be to remove the domains field from the _gallery_info.yml file in the gridding cookbook repo. But our code shouldn't be that fragile. I'll see if there's a straightforward fix in the gallery code that we can implement here.

@brian-rose brian-rose requested a review from a team as a code owner July 18, 2023 18:59
@brian-rose
Copy link
Member

This should work.

The gallery code already had a check for empty tags but there was a bug in it. It was checking to see if the first item in a list was None, but there is no list at all in this case, just a plain old None.

@@ -68,7 +68,7 @@ def generate_repo_dicts(all_items):
gallery_info_dict = yaml.safe_load(urllib.request.urlopen(gallery_info_url))
thumbnail = gallery_info_dict["thumbnail"]
tag_dict = {
k: v for k, v in gallery_info_dict["tags"].items() if v[0] is not None
k: v for k, v in gallery_info_dict["tags"].items() if v is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to check for both v is not None and v[0] is not None?

Copy link
Member

Choose a reason for hiding this comment

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

Can't hurt. I just implemented that in the latest push.

@brian-rose brian-rose requested a review from jukent August 4, 2023 14:10
@brian-rose brian-rose merged commit a36e86f into main Aug 7, 2023
2 checks passed
@brian-rose brian-rose deleted the r-ford-patch-2 branch August 7, 2023 15:16
github-actions bot pushed a commit that referenced this pull request Aug 7, 2023
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.

3 participants