GithubHelp home page GithubHelp logo

pyweb's Introduction

PYWEB

PyWEB is a simple Python3 program which would allow you to tangle and weave your Jupyter notebooks.
Jupyter Notebooks are a very basic yet simple and effective implementation of Knuth's Literate Programming style which he invented back in 1980's. In literate programming style, you write down your ideas and code intermingled with each other in a plain text document. This document represents the "web" of your ideas and code. Then, source files which the compiler can parse are produced by tangling the web which involved extracting code from the text file. Documentation for the code is generated by a process called weaving.
You cannot say that Knuth's invention is useless: the original TeX engine was completely written in literate programming style using his Web programming system. It never became a fad for this approach of writing programs appears to be quite tedious (and corporates always prefer bad products which are shipped quickly and improved iteratively over one-shot great products).
In any case, more than 30 years later, Jupyter notebooks are being widely used both in academia and in the industry to write well organised, and documented computer code, codes which are used to train LLMs or to detect gravitational waves.
Given the importance of Jupyter Notebooks, I decided to write a simple program in Python which would allow me to extract source code and generate documentation. I call it PyWEB.
Yes, this name has been taken by numerous other products, but anyways!! I had fun writing this teeny-weeny code and that's the main point.

Usage

You can run pyweb by typing python3 pyweb.py in the terminal.
To tangle a file, i.e., to produce a source file from the JSON making up the Jupyter notebook, the syntax is:

python3 pyweb.py -t path/to/notebook/name-of-the-notebook extension-without-dot src-name path/to/src

To weave a file, i.e., to produce a documentation out of you Jupyter notebook, the syntax is:

python3 pyweb.py -t path/to/notebook/name-of-the-notebook format dco-name path/to/doc

PyWEB uses Jupyter's nbconvert utility to produce documentation.

Example

python3 pweb.py -t "Notebooks/Simple Bootloader.ipynb" asm "boot" boot/
python3 pweb.py -t "Notebooks/Linear Regression.ipynb" pdf "Linear Regression" Documentation/

pyweb's People

Contributors

prankapo avatar

Watchers

 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.