Skip to content
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

Ingredients and Plutos package manager #10

Open
karlwessel opened this issue Mar 3, 2022 · 4 comments
Open

Ingredients and Plutos package manager #10

karlwessel opened this issue Mar 3, 2022 · 4 comments

Comments

@karlwessel
Copy link

Currently, when I have an ingredient that imports a package, then I have to import that package also manually in each notebook that uses that ingredient. Would it be possible for Pluto to automatically add those packages to the environment of the notebook that includes the ingredient?

Even better for reproducibility would be of course if both keep their own environment, but that probably isn't possible.

@Pangoraw
Copy link
Member

Pangoraw commented Mar 3, 2022

I am not sure I understand what you mean by package here. Are you using @ingredients on:

  • Another Pluto notebook with its own environment
  • A plain Julia file
  • The entry point of a package (Package.jl/src/Package.jl)

@karlwessel
Copy link
Author

The first one, another Pluto notebook with its own environment

@karlwessel
Copy link
Author

So I have a notebook that has some cell using SomePackage. When I want to use that notebook as an ingredient in another notebook I manually have to also add a Cell containing using SomePackage.

@fonsp
Copy link
Member

fonsp commented Mar 8, 2022

This is a really good question @karlwessel ! And a larger project that we still need to figure out.

Ideally, the other notebook's env will be added as a Pkg dependency to the main notebook. That way, the dependencies of the other notebook will be made available, respecting constraints in the embedded Project.toml of the other notebook (which Pluto automatically writes).

The basic idea is to create a temporary folder containing the Project.toml (with some additions) and Manifest.toml from the notebook and a file src/SomeName.jl containing something like module SomeName $(notebook code) end. Then in the main notebook, this folder would be added as dependency using Pkg.develop.

But this leads to a reproducibility problem: we want someone else to be able to open the notebook. So far, our reproducibility has always focused on a single file, but in this case, you also need the other notebook file, and the temporary package files need to be generated before instantiating the notebook's environment. Maybe the other notebook's contents should be embedded in the file of the main notebook? Tricky tricky

Then some other aspects that come into play:

cc @pankgeorg @dralletje

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants