All Projects → stevengj → Nbinclude.jl

stevengj / Nbinclude.jl

Licence: other
import code from IJulia Jupyter notebooks into Julia programs

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Nbinclude.jl

Ppd599
USC urban data science course series with Python and Jupyter
Stars: ✭ 1,062 (+1080%)
Mutual labels:  jupyter-notebook, jupyter
Sci Pype
A Machine Learning API with native redis caching and export + import using S3. Analyze entire datasets using an API for building, training, testing, analyzing, extracting, importing, and archiving. This repository can run from a docker container or from the repository.
Stars: ✭ 90 (+0%)
Mutual labels:  jupyter-notebook, jupyter
Telepyth
Telegram notification with IPython magics.
Stars: ✭ 54 (-40%)
Mutual labels:  jupyter-notebook, jupyter
Computer Vision
Computer vision sabbatical study materials
Stars: ✭ 39 (-56.67%)
Mutual labels:  jupyter-notebook, jupyter
Nbconflux
nbconflux converts Jupyter Notebooks to Atlassian Confluence pages
Stars: ✭ 82 (-8.89%)
Mutual labels:  jupyter-notebook, jupyter
Nbgrader
A system for assigning and grading notebooks
Stars: ✭ 1,000 (+1011.11%)
Mutual labels:  jupyter-notebook, jupyter
Jupyter Themes
Custom Jupyter Notebook Themes
Stars: ✭ 8,879 (+9765.56%)
Mutual labels:  jupyter-notebook, jupyter
Geemap
A Python package for interactive mapping with Google Earth Engine, ipyleaflet, and folium
Stars: ✭ 959 (+965.56%)
Mutual labels:  jupyter-notebook, jupyter
Covid19 Dashboard
A site that displays up to date COVID-19 stats, powered by fastpages.
Stars: ✭ 1,212 (+1246.67%)
Mutual labels:  jupyter-notebook, jupyter
Algorithm Playground
An (old) and unstructured (messy tbh) collection of programming exercises.
Stars: ✭ 75 (-16.67%)
Mutual labels:  jupyter-notebook, jupyter
Dashboards
[RETIRED] See Voilà as a supported replacement
Stars: ✭ 986 (+995.56%)
Mutual labels:  jupyter-notebook, jupyter
Repo2docker Action
GitHub Action for repo2docker
Stars: ✭ 88 (-2.22%)
Mutual labels:  jupyter-notebook, jupyter
Machinelearningcourse
A collection of notebooks of my Machine Learning class written in python 3
Stars: ✭ 35 (-61.11%)
Mutual labels:  jupyter-notebook, jupyter
Ncar Python Tutorial
Numerical & Scientific Computing with Python Tutorial
Stars: ✭ 50 (-44.44%)
Mutual labels:  jupyter-notebook, jupyter
Python Training
Python training for business analysts and traders
Stars: ✭ 972 (+980%)
Mutual labels:  jupyter-notebook, jupyter
Ipybind
IPython / Jupyter integration for pybind11
Stars: ✭ 63 (-30%)
Mutual labels:  jupyter-notebook, jupyter
Crime Analysis
Association Rule Mining from Spatial Data for Crime Analysis
Stars: ✭ 20 (-77.78%)
Mutual labels:  jupyter-notebook, jupyter
Sparkmagic
Jupyter magics and kernels for working with remote Spark clusters
Stars: ✭ 954 (+960%)
Mutual labels:  jupyter-notebook, jupyter
Juniperkernel
R Kernel for Jupyter
Stars: ✭ 67 (-25.56%)
Mutual labels:  jupyter-notebook, jupyter
Jupytemplate
Templates for jupyter notebooks
Stars: ✭ 85 (-5.56%)
Mutual labels:  jupyter-notebook, jupyter

NBInclude

Build Status Build status

NBInclude is a package for the Julia language which allows you to include and execute IJulia (Julia-language Jupyter) notebook files just as you would include an ordinary Julia file. That is, analogous to doing include("myfile.jl") in Julia to execute myfile.jl, you can do

using NBInclude
@nbinclude("myfile.ipynb")

to execute all of the code cells in the IJulia notebook myfile.ipynb. Similar to include, the value of the last evaluated expression in the last evaluated code cell is returned.

The goal of this package is to make notebook files just as easy to incorporate into Julia programs as ordinary Julia (.jl) files, giving you the advantages of a notebook (integrated code, formatted text, equations, graphics, and other results) while retaining the modularity and re-usability of .jl files.

Note: Scoping rules differ between interactive (IJulia, REPL) and non-interactive Julia code. Running a notebook as @nbinclude("foo.ipynb"; softscope=true) will load notebooks using "soft" global scoping similar to interactive (REPL) code in Julia 1.5+ or for IJulia with any Julia version. That flag's default value, false, will load notebooks with the "hard" scoping rule that Julia uses for non-interactive code (e.g. in include); see also the SoftGlobalScope package for more details.

Key features of NBInclude are:

  • The path of the notebook is relative to the path of the current file (if any), and nested inclusions can use paths relative to the notebook, just as for include.
  • In a module, included notebooks work fine with precompilation in Julia (and re-compilation is automatically triggered if the notebook changes).
  • Code is associated with accurate line numbers (e.g. for backtraces when exceptions are thrown), in the form of myfile.ipynb:In[N]:M for line M in input cell N of the myfile.ipynb notebook. Un-numbered cells (e.g. unevaluated cells) are given a number +N for the N-th nonempty cell in the notebook. You can use @nbinclude("myfile.ipynb", renumber=true) to automatically renumber the cells in sequence (as if you had selected Run All from the Jupyter Cell menu), without altering the file.
  • The Julia @__FILE__ macro returns /path/to/myfile.ipynb:In[N] for input cell N.
  • In IJulia, cells beginning with ; or ? are interpreted as shell commands or help requests, respectively. Such cells are ignored by @nbinclude.
  • counters and regex keywords can be used to include a subset of notebook cells to those for which counter ∈ counters and the cell text matches regex. For example, @nbinclude("notebook.ipynb"; counters=1:10, regex=r"#\s*EXECUTE") would include cells 1 to 10 from notebook.ipynb that contain comments like # EXECUTE.
  • A keyword anshook can be used to run a passed function on the return value of all the cells.
  • No Python or Jupyter dependency.
  • The softscope flag mentioned above.

To install it, simply do Pkg.add("NBInclude") as usual for Julia packages.

Contact

NBInclude was written by Steven G. Johnson and is free/open-source software under the MIT/Expat license. Please file bug reports and feature requests at the NBInclude github page.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].