DataDeps.jl icon indicating copy to clipboard operation
DataDeps.jl copied to clipboard

Pluto.jl support

Open fonsp opened this issue 1 year ago • 1 comments

Hi! Thanks for this cool package!

Using MLDatasets.jl in Pluto does not always work 😵‍💫 which is a shame because it's really useful for our Julia-beginner target audience! Running iris = Iris() will leave the cell stuck running forever. This is because DataDeps.jl tries to ask the user for permission:

Do you want to download the dataset from ["https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"] to "/Users/fons/.julia/scratchspaces/124859b0-ceae-595e-8997-d05f6a7a8dfe/datadeps/Iris"?
[y/n]

But Pluto does not have a stdin terminal interface, users cannot enter y/n. In Pluto, Base.isinteractive() returns false to tell packages about this (previous discussion with good foresight in https://github.com/oxinabox/DataDeps.jl/issues/12#issuecomment-354108496 🌟), but it looks like DataDeps instead uses the "CI" env variable to make this distinction.

Ideally, running MLDatasets.Iris() in a non-interactive session should throw an error saying that you should set DATADEPS_ALWAYS_ACCEPT, perhaps with an example code snippet.

Ideas

Perhaps Base.isinteractive() can be used instead of env_bool("CI")?

Or a bit more low-level: function better_readline can throw when stream === stdin and isinteractive is false? Since this is guaranteed to block forever.

Let me know what you think, thank you!

PS I knowwww that Pluto should "just" support terminal input, but it's really really complicated! And by not supporting it, we have a nice side effect that people will author notebooks that never require user input to re-run on another computer.

fonsp avatar Nov 20 '24 11:11 fonsp