Coming from an R background, it’s extremely helpful (both as an asker & answerer) to have a package like https://reprex.tidyverse.org/ that prepares a MWE for public viewing, just by interacting with the clipboard. Any best practices here?
Pluto notebooks are a bit more involved, but work very well for this use case since they store the code, Project.toml, and Manifest.toml all in one file.
Is it a good idea to attach a Pluto notebook in a Discourse thread as a MWE? I’d have thought that wouldn’t be very friendly to people just trying to read & understand & reproduce a simple example. Do people use it that way in these forums?
I do agree that a Pluto notebook is a great encapsulation of all you need to know for reproducing something, though.
FWIW here’s an example of me using R’s reprex package recently to show a MWE of a bug:
I probably wouldn’t attach it, personally. I’d reproduce the code and other content directly in the post, but then potentially also upload the notebook file somewhere, for full reproducibility, and then link to it from the post. Having a notebook for a MWE definitely seems like a good idea.
IMO “full reproducibility” is not the actual goal. The goal is to have an example that can be run in several different environments. The differences between those environments are often the most important details to the conversation.
I think having a very simple text-based reprex or MWE mechanism would be really nice. Not just for forums like this, but also for company-internal discussion, isolation during debugging, etc.
In the R world, it’s often been the case that while preparing a reprex, I whittle things down far enough that I figure out the issue and don’t actually need to post anywhere. =)
The problem with putting the onus on the person asking the question is that they are the ones who are least likely to know about something like MinimumWorkingExamples, Pluto notebooks or other potential tools for the MWE problem. I feel like this is a problem best solved on the end of the person answering the question. They should have a tool at their disposal where they can take any self-contained snippet of code and paste it to run it, letting it build the environment automatically.
Pluto notebooks are exactly that. But instead of asking the OP to create and post a Pluto notebook for their MWE, we (the people answering the question) should just open a notebook ourselves and paste their code into a begin ... end block. I know it doesn’t reproduce the environment exactly as it exists for them, but we can always ask for a ]st in the case where we can’t reproduce their problem locally.
The problem with putting the onus on the person asking the question is that they are the ones who are least likely to know about something like MinimumWorkingExamples , Pluto notebooks or other potential tools for the MWE problem.
I mean, it’s easy enough to tell people.
It’s usually not easy in my experience as an answerer to “just” open a notebook, paste code, and execute, because it’s usually not runnable out of the box. That’s what reprex solves. Not a reproducible environment, just runnable code.
Maybe I should just build it. Coming from a community where I have seen how useful a tool like this is, I’m surprised to hear the reaction of people who don’t think it would be useful. I feel like there’s already an existence proof.
Not sure when/if I’ll get the time to actually do this, but I’m not sure this discussion is as productive as “just doing it” would be.
Not sure if you mean a Jupyter notebook or Pluto notebook here. Jupyter notebook, I agree; almost nothing ever works out of the box. Pluto notebook is a completely different thing, though, as I believe it does exactly what you’re looking for w.r.t. building the environment and running the code.
I don’t want to talk you out of building something cool, though! If you think it would be useful, I’m all for trying it out! But I’d also encourage you to open up a Pluto notebook some time and start pasting random examples from around this forum into it. I think you’ll be pleasantly surprised at how often it “just works” (so far I’ve tried a few examples today and haven’t found one that hasn’t worked).
Getting a “self-contained snippet of code” is itself non-trivial in practice, in my experience. People very often forget some piece of code that’s been part of their workflow for so long they basically take it for granted, or have other customizations that they forget to mention. So this makes it a potentially lengthy back and forth even to get to this stage. And it’s usually not a snippet of code at this point, it often gets to unwieldy lengths.
So overall, this approach would require that:
someone happens to come across the post
has expertise relevant to the question
is also able to spend time on this back and forth to get to the self-contained code
and has free compute resources and time to run the whole code in Pluto (which can get pretty expensive with a lot of code that people work on with Julia), and do that multiple times too since debugging or testing a fix usually requires that
The intersection of these criteria will in many cases tend towards zero, especially in the long term if people have to do this week after week (the people asking the questions change regularly, but those answering are largely from a small and finite set). It’s pretty cool that Pluto makes this approach plausible at all, on the technical side, but on the social side, it’s a tough ask on a volunteer Q&A forum. Asking the original poster to install and use a MinimumWorkingExamples package might also have its own friction, but it’s much more workable as a long term solution that doesn’t push people away from trying to answer questions.