Here's a handy function:
function two_cols(left, right)
HTML("""
<style>
div.two-cols {
display: flex;
width: 100%;
}
### A Pluto.jl notebook ### | |
# v0.10.9 | |
using Markdown | |
using InteractiveUtils | |
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). | |
macro bind(def, element) | |
quote | |
local el = $(esc(element)) |
Here's a handy function:
function two_cols(left, right)
HTML("""
<style>
div.two-cols {
display: flex;
width: 100%;
}
Michael Alexander: I am trying to convert a Jupyter notebook and would like the output of Pkg.status() and Pkg.instantiate() to show within the Pluto notebook, not in the terminal. Is there a way to force certain messages to show in the notebook? (PS - I love Pluto and the JuliaCon talk was "out of this world"!)
karl: I don't think that is possible. Unless you find a way to relay the printed messages into a string and return that string as the output of a cell.
karl: For what do you need the output inside the notebook?
James Fairbanks: just guessing, but this is a technique people do in notebooks to help users make sure they have the same versions as the author. Maybe you could do Pkg.instantiate() and then ;cat Manifest.toml to get the version numbers to appear?
karl: Does pluto support shell commands like ;cat?
### A Pluto.jl notebook ### | |
# v0.11.4 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ fcd73180-dcc9-11ea-25e7-2dab70526b7d | |
x = 1 | |
# ╔═╡ 09c77f6c-dcca-11ea-3b55-2dba2bfce9f8 |
using Unitful, BSON | |
ufoo = 3.0u"m/s" | |
BSON.@save "test.bson" ufoo | |
function get_ufoo() | |
BSON.@load "test.bson" ufoo | |
return ufoo |
@info "Welcome to Julia! Let's get started" | |
@info "Setting up the environment - grab a cup of tea" | |
import Pkg | |
# we activate a clean environment called "pluto" - this does not affect the environment that your code runs in | |
# for using fool-proof package environments inside notebooks, see https://github.com/fonsp/Pluto.jl/issues/142#issuecomment-642049815 | |
Pkg.activate("pluto") | |
Pkg.Registry.update() | |
Pkg.add("Pluto") |
### A Pluto.jl notebook ### | |
# v0.9.11 | |
using Markdown | |
macro bind(def, element) | |
quote | |
local el = $(esc(element)) | |
global $(esc(def)) = Core.applicable(Base.peek, el) ? Base.peek(el) : missing | |
el | |
end |
# this time i _did_ run the code - copy paste this into the REPL | |
# https://www.youtube.com/watch?v=m2DvmHusyk4 | |
# put something.jl from this gist in the same dir | |
import Pluto | |
session = Pluto.ServerSession() | |
try |
### A Pluto.jl notebook ### | |
# v0.11.12 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ f9feaf76-eeb5-11ea-2fa6-fd388c9b677d | |
begin | |
import Pkg | |
Pkg.activate(mktempdir()) |
julia> import Pkg; Pkg.activate(mktempdir()); | |
julia> Pkg.add(Pkg.PackageSpec(url="https://github.com/giordano/DebugArtifacts.jl.git")) | |
Activating new environment at `/tmp/jl_6YznSC/Project.toml` | |
Cloning git-repo `https://github.com/giordano/DebugArtifacts.jl.git` | |
Updating git-repo `https://github.com/giordano/DebugArtifacts.jl.git` | |
Updating registry at `~/.julia/registries/General` | |
Updating git-repo `https://github.com/JuliaRegistries/General.git` | |
Resolving package versions... |