-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
🎁 Built-in Pkg management #844
Conversation
This comment has been minimized.
This comment has been minimized.
|
Is there a way for the user to "drop into" a terminal and provide the user input manually? |
This comment has been minimized.
This comment has been minimized.
@DilumAluthge @fredrikekre Can you point me to the Pkg source code that asks for input? I can't seem to find it |
@DilumAluthge it looks like the prompt and input happen on the terminal where you launched Pluto, so you should be able to make the choice there, but I don't see an easy way to:
I think the best solution for now is to try to set temporarily |
I am merging this to We will probably tag the |
WHAAAATTTTTTTTTTTTTT |
In trying this out (woop woop!), I found myself wanting to also use Pkg version syntax like Possible? |
@AshtonSBradley We can break this in two parts:
|
Is there an issue to track the "package from local path" feature? |
@Uroc327 no, feel free to open one! |
Watch a 15min video explaining this PR, or read the documentation
Table of contents
1. Motivation
The two main goals are:
This feature is designed with beginner programmers in mind, but I think that it will cover most use cases.
Example
A notebook with only this code:
using JSON
will have the used version number of JSON.jl stored in the notebook file. Loading a Pluto notebook will instantiate from this data. So:
2. Try it out!
(Use Julia 1.5, 1.6 or nightly (1.8))
Now, open a new notebook and import some packages!
3. More details
I want to offer a limited subset of Pkg functionality directly inside Pluto, mostly automated behind the scenes, to achieve these two goals. People who understand
Pkg
are not the intended audience, but there will be a way to opt out and usePkg
commands like before.Pkg.activate
anywhere in your code, Pluto's package management will be completely disabled, and you get the old behaviour. This way, notebooks that already usePkg
calls to manually set up a package environment will continue to work. This also means that we don't need to implement every feature to make advanced users happy.] dev
.Notebook load times
This change will also make notebook loading faster, compared to "
Pkg.add
notebooks" like in https://computationalthinking.mit.edu/ because:WIP screenshots
(i did not have these two packages installed before!)
Schermopname.2021-01-15.om.23.59.31.mov
Schermopname.2021-01-18.om.12.52.47.mov
I LOVE removing documentation, this is from the new PlutoUI sample notebook:
(advanced) Edit notebook environments using Pkg REPL
I am adding a function
Pluto.PkgUtils.activate_notebook("path_to_notebook.jl")
that activates a notebook Pkg environment in the REPL. It uses FileWatching to sync changes from either side (i.e. Pkg REPL changes are written to the notebook, editing the notebook updates the Pkg REPL env).Schermopname.2021-03-17.om.15.19.47.mov
For more (outdated) screenshots, see #661
5. TODO
TODO - UI
Pkg.activate
about disabled PlutoPkg - Show a message next toPkg.activate
about disabled PlutoPkg #1240TODO - backend
using Asdf
using Asdf
is gonePkg.activate
[compat]
entries to ProjectLOAD_PATH
to["@"]
LOAD_PATH
when PlutoPkg is disabledstack? requires.jl? copyofrequires.jl?Failed to precompile CSV #895workspace_use_distributed == false
? Seems fine to ignore, lets revisit laterPkg.add
withoutPkg.activate
? (solution: disable plutopkg)TODO - tests
EXTRAS
FUTURE
Pkg.Types.Context
workspace_use_distributed == false
?5eb81bf
(#844)6. Description of changes
Most of the added lines are because I updated our sample notebooks to use the new format, which includes a lengthy Manifest for the Plots.jl sample notebook. (907 additions are for sample notebooks)
Backend
src/packages/Packages.jl
is the most important. It contains the "Pluto package manager".test/packages/Basic.jl
to get a more high-level overview of the new behaviour.src/packages/PkgCompat.jl
contains calls to (internal) Pkg API.src/notebook/Notebook.jl
contains new code to read and write the Pkg data in the notebook file.Frontend
frontend/components/PkgStatusMark.js
is the little checkmark/icon that appears inline next to a package name. It is not a Preact component, but a real DOM element, because that works better inside a codemirror widget. This file also contains the helper text code.frontend/components/PkgPopup.js
is the popup.frontend/components/CellInput.js
contains nasty code to detectusing
andimport
statements and insert and update status marks inline. Note that this is just a visual frontend, it has no functional role in the package manager.