-
Couldn't load subscription status.
- Fork 7
[DA-1179] add support for nested tutorial generation #60
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
[DA-1179] add support for nested tutorial generation #60
Conversation
…ctory structure. The directory path is now replaced with hyphens in the output markdown file name for better organization.
Summary of ChangesHello @nithishr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where the tutorial generation process would produce a single output for notebooks sharing the same name but residing in different nested folders. The core change modifies the naming convention for generated markdown files to include the notebook's directory structure, ensuring each tutorial has a unique and descriptive filename. This enhancement improves the clarity and organization of generated documentation. Additionally, a previously misplaced frontmatter file has been moved to its correct location. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Caution Notebooks or Frontmatter Files Have Been Modified
0 Notebook Files Modified:
1 Frontmatter Files Modified:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request introduces a change in how markdown file paths are generated from Jupyter notebooks, incorporating the directory structure into the filename to avoid naming conflicts when notebooks with the same name exist in different folders. This change ensures that each notebook gets a unique markdown file, addressing the issue of overwriting tutorials when reusing notebook names across different directories.
| # Get the directory path relative to the project_dir | ||
| dir_path = os.path.dirname(relative_path) | ||
| # Replace slashes with hyphens | ||
| dir_name = dir_path.replace(os.sep, "-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change introduces directory names into the markdown file name. It's important to ensure that very long directory names do not result in excessively long file names that could cause issues with file systems or other tools. Consider truncating or hashing the directory name if it exceeds a certain length.
Also, consider the case where dir_path is empty. The current implementation would result in a leading hyphen in the markdown file name. It might be better to conditionally include the dir_name only if it's not empty to avoid the leading hyphen.
| # Get the directory path relative to the project_dir | |
| dir_path = os.path.dirname(relative_path) | |
| # Replace slashes with hyphens | |
| dir_name = dir_path.replace(os.sep, "-") | |
| # Get the directory path relative to the project_dir | |
| dir_path = os.path.dirname(relative_path) | |
| # Replace slashes with hyphens | |
| dir_name = dir_path.replace(os.sep, "-") | |
| if dir_name: | |
| markdown_file = os.path.join(markdown_dir, f"{dir_name}-{notebook_name}.md") | |
| else: | |
| markdown_file = os.path.join(markdown_dir, f"{notebook_name}.md") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very relevant for this repo but have added it as it is not a bad idea in general
|
We would also need to wipe the current autogenerated tutorials before merging this, so that they are generated properly without duplicating the tutorials. |
…empty directory names. If no directory is present, the markdown file will now be named using only the notebook name.
The current generation is purely based on the notebook name.
With the way we are creating notebooks in folders by reusing the existing notebook name, we are getting only one tutorial rather than the individual ones. Examples can be found in GSI & FTS or Capella notebooks.
New Naming
Also added one misplaced frontmatter to the right place.