-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adopt temporalio/snipsync for documentation #10768
Comments
It looks like an interesting solution. We definitely need something like this, and I suppose I had stared building my own tooling, which is probably a bad idea. The snipsync repo does not seem very active or popular and uses npm and yarn which I am not sure many DataFusion contributors would be familiar with. I wonder if there are other solutions out there? |
There are other such as https://github.com/SimonCropp/MarkdownSnippets, but I know Temporal is a popular OSS product, with excellent documentation, see https://temporal.io/blog/snipsync-overview So I guess there are these two options, and maintaining our tool |
I believe we now achieve this goal using the doctest! macro -- for example datafusion/datafusion/core/src/lib.rs Lines 618 to 643 in 37e54ee
|
@alamb there might still good reasons to consider snipsync or an approach such as the one that snipsync implements:
What do you think about modifying the macro to support these two features?
use std::error::Error;
// Snipstart: "Snip1"
print!("foo");
// Snipend
print!("Some uninteresting code");
// Snipstart: "Errors"
panic!("Something went wrong");
// Snipend You can print foo in Datafusion using the `print!` macro:
<!--include examples/example_1.rs snip-name="Snip1" -->
Another important feature in Datafusion is `panic!`, which can be used like so:
<!--include examples/example_1.rs snip-name="Errors" --> |
I think in theory it sounds great. I have no strong preference on tool or methodology. What I think is important is that it is as easy as possible to write / maintain the documentation + examples (clear docs on how to document things, good examples of doing so with the docs) |
Is your feature request related to a problem or challenge?
Datafusion documentation is amazing and examples are too. However, inline snippets might fall out of sync from the codebase and are not very easy to consume because you often need to figure out the required imports to get a snippet to compile. On the other side, writing a full Rust script in a documentation page creates too much noise and make the documentation less effective.
Describe the solution you'd like
Ideally, we would have snippets that are portions of executable scripts, so that we can via CI/CD execute them and confirm they are not obsolete, but at the same time only the relevant section of the script is included in the docs.
We can use https://github.com/temporalio/snipsync for the purpose
Describe alternatives you've considered
No response
Additional context
I was working on a separate issue for documentation, and I have found myself facing the problem that I mentioned above, see #7306 (comment)
The text was updated successfully, but these errors were encountered: