GithubHelp home page GithubHelp logo

ciaranomara / pluto.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fonsp/pluto.jl

0.0 1.0 0.0 3.03 MB

⚡ Lightweight reactive notebooks for Julia

License: MIT License

HTML 5.08% Julia 60.71% CSS 11.48% JavaScript 22.73%

pluto.jl's Introduction

Pluto.jl

Writing a notebook is not just about writing the final document — Pluto empowers the experiments and discoveries that are essential to getting there.

Explore models and share results in a notebook that is

  • reactive - when changing a function or variable, Pluto automatically updates all affected cells.
  • lightweight - Pluto is written in pure Julia and is easy to install
  • simple - no hidden workspace state; intuitive UI.

reactivity screencap

Input

A Pluto notebook is made up of small blocks of Julia code (cells) and together they form a reactive notebook. When you change a variable, Pluto automatically re-runs the cells that refer to it. Cells can even be placed in arbitrary order - intelligent syntax analysis figures out the dependencies between them and takes care of execution.

Cells can contain arbitrary Julia code, and you can use external libraries. There are no code rewrites or wrappers, Pluto just looks at your code once before evaluation.

Output

Your notebooks are saved as pure Julia files (sample), which you can then import as if you had been programming in a regular editor all along. You can also export your notebook with cell outputs as attractive HTML and PDF documents. By reordering cells and hiding code, you have full control over how you tell your story.


Dynamic environment

Pluto offers an environment where changed code takes effect instantly and where deleted code leaves no trace. Unlike Jupyter or Matlab, there is no mutable workspace, but rather a one-to-one correspondence between variables and code. In a Pluto notebook, a variable or function definition always corresponds to the code that defines it — there is no hidden state.

Interactivity

Your programming environment becomes interactive by splitting your code into multiple cells! Changing one cell instantly shows effects on all other cells, giving you a fast and fun way to experiment with your model.

In the example below, changing the parameter A and running the first cell will directly re-evaluate the second cell and display the new plot.

plotting screencap


HTML interaction

Lastly, here's one more feature: Pluto notebooks have a @bind macro to create a live bond between an HTML object and a Julia variable. Combined with reactivity, this is a very powerful tool!

@bind macro screencap

notebook from vdplasthijs/julia_sir


You don't need to know HTML to use it! The PlutoUI package contains basic inputs like sliders and buttons.

But for those who want to dive deeper - you can use HTML, JavaScript and CSS to write your own widgets! Custom update events can be fired by dispatching a new CustomEvent("input"), making it compatible with the viewof operator of observablehq. Have a look at the sample notebooks inside Pluto to learn more!




Let's do it!

Ingredients

For one tasty notebook 🥞 you will need:

  • Julia v1.0 or above
  • Linux, macOS or Windows, Linux and macOS will work best
  • Mozilla Firefox or Google Chrome, be sure to get the latest version

Installation

Run Julia and add the package:

julia> ]
(v1.0) pkg> add Pluto

Using the package manager for the first time can take up to 15 minutes - hang in there!

To run the notebook server:

julia> import Pluto
julia> Pluto.run(1234)

Then go to http://localhost:1234/ to start coding!




Remote access

You can also run Pluto on a server, and use the browser on your own computer as user interface. For this, you need to set up an SSH tunnel. First, log in to your server using SSH and start a Pluto server. Then open a local terminal on your own computer and type:

ssh user@ipaddress -LN 1234:localhost:1234

with user and ipaddress filled in accordingly. You can then go to http://localhost:1234/ on your own computer to get started! For more info and instructions for Windows, see this guide.

To developers

Follow these instructions to start working on the package.

Note

We are happy to say that Pluto.jl runs smoothly for most users, and is ready to be used in your next project!

That being said, the Pluto project is an ambition to rethink what a programming environment should be. We believe that scientific programming can be a lot simpler. Not by adding more buttons to a text editor — by giving space to creative thought, and automating the rest.

If you feel the same, give Pluto a try! We would love to hear what you think. 😊

feedback screencap

Questions? Have a look at the FAQ.

Created by Fons van der Plas and Mikołaj Bochenski. Inspired by Observable.

pluto.jl's People

Contributors

fonsp avatar malyvsen avatar felixcremer avatar pocket-titan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.