Coder Social home page Coder Social logo

oxinabox / ipynb2literatejulia Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 3.0 503 KB

NBConverter stuff to convert Jupyter Notebooks in to Julia Literate.jl files (This is the opposite of Literate.jl)

License: MIT License

Smarty 11.54% Python 40.89% Shell 8.05% Julia 39.53%
nbconvert julialang jupyter

ipynb2literatejulia's Issues

new nbconvert, template

This seems to fail on nbconvert 6.0.7:

jupyter nbconvert  --to script "$1" --config literate_config.py --template=literate.tpl 

(Same with --template-file=literate.tpl )

Skipping the --template=literate.tpl makes it run, but the markdown cells are dropped.

The changelog mentions changes to the template system

suggested Julia function to simplify workflow

""
    literate_run_nbconvert(;OutputDir="",ConfigDir="")

Convert all Julia ipynb notebooks to jl files, using nbconvert

# Input
- `OutputDir::String`:  path to output folder
- `ConfigDir::String`:  path to where literate_config.py and literate.tpl are

"""
function literate_run_nbconvert(;OutputDir="",ConfigDir="")

    Files = filter(x->endswith(lowercase(x),".ipynb"), readdir())

    ConfigFile = joinpath(ConfigDir,"literate_config.py")
    TemplFile  = joinpath(ConfigDir,"literate.tpl")

    for i = 1:length(Files)
        printstyled("\n\n-------------Converting $(Files[i])-------------\n",color=:blue)
        run(`jupyter nbconvert  --to script $(Files[i]) --output-dir $OutputDir --config $ConfigFile --template $TemplFile --Application.log_level='DEBUG'`)
    end

end

directory for output as last argument

(This is a great little utility BTW, so thanks for it!)

I think it would be nice to be able to do something like

bash literate_run_nbconvert.sh demo/ODEIntroduction.ipynb another_output_folder

to specify another_output_folder ๐Ÿ™‚

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.