-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Provide support for inlining R examples in .Rd files via YAML #835
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
Conversation
|
@byronz Not sure why it passed tests locally but failed on CircleCI, but made a minor change and it looks 👌 now. |
| description=description.replace('\n', ' ') | ||
| )) | ||
| if rpkg_data is not None: | ||
| if rpkg_data is not None and rpkg_data.get('r_examples') is not None: |
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.
🐄 minor: 'r_examples' in rpkg_data
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.
That does look cleaner! Will edit and test; thanks for the feedback.
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.
fixed in a7883da
| result = "" | ||
| if the_ex and "code" in the_ex.keys(): | ||
| result += wrap("examples", | ||
| wrap("dontrun" if the_ex["dontrun"] else "", |
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.
if the_ex.get("dontrun")
When would a user want or not want dontrun?
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.
There's a slight delay when executing inline examples within R packages; CRAN requires that each example run and exit without errors in a second or two. Dash apps aren't typically terminated until the user interrupts them; this is problematic for CRAN (and devtools) checks.
In addition, CRAN checks will fail if a dependency does not exist in the repository when examples are executed. Setting \dontrun to TRUE allows the package author to include examples but specify that they not be executed during package tests.
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.
My apologies for not catching the initial comment previously, change has been made!
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.
fixed in cf0d476
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.
no worries, the way I wrote it did look like I was quoting you rather than suggesting a change.
|
@rpkyle this looks good - just two small changes as requested by me (before my question about |
| os.makedirs('R') | ||
| if os.path.isfile("dash-info.yaml"): | ||
| with open("dash-info.yaml") as yamldata: | ||
| rpkg_data = yaml.safe_load(yamldata) |
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.
We need a fallback declaration of rpkg_data if dash-info.yaml doesn't exist - like we had previously:
else:
rpkg_data = None(alternatively, initialize it to None up above the if os.path.isfile("dash-info.yaml") - just need to ensure it always exists by the time we ask for it below)
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.
Good catch. Sometimes I wish there was a ⚾️ mitt emoji.
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.
fixed in 139527d
alexcjohnson
left a comment
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 PR proposes to add functionality for storing R examples for help files in the
dash-info.yamlfile, as outlined in #831.Closes #831.