Giter Site home page Giter Site logo

dirigible-spreadsheet's Introduction

Dirigible, the web-based Pythonic Spreadsheet

This is the source code from the end-of-lifed https://www.projectdirigible.com project, preserved for posterity and the curious

Installation instructions

cd dirigible
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser  # make yourself a user account.
python manage.py runserver

And visit http://localhost:8000

Security

This version of Dirigible has absolutely no security, so bewarned, before you put this on a public server -- anyone that logs in has the full access permissions of whichever user is running django, and you can use Python to do pretty much whatever you want!

Check out the chroot_recalculation branch for a slightly more secure approach

Some minimal context

(Probably best to play around with the spreadsheet a bit before reading this guide, to get an idea of what is possible. Try creating a couple of formulae with calculations, and maybe using a user-defined function from the usercode panel)

  • A Dirigible spreadsheet is "just" a python program, which is visible in the usercode panel on the right.

  • Recalculating the spreadsheet means executing that code, including two very important built-in functions: load_constants and evaluate_formulae.

In between those two functions, the user can add their own arbitrary code.

One global object is accessible, the worksheet (source)

A worksheet is compose of cells (it is in fact a dictionary, whose keys are the location, expressed as a tuple of column,row, and whose values are cell objects)

A cell (source) has two key attributes:

  • its formula, which may just be a constant like "hello" or "12,3", or a formula, like =A1+B1
  • its value, which is the result of evaluating the formula.

If the formula is a constant, its value is that constant.

If it's a real formula, then it will be evaluated as part of evaluate_formulae(). This involves:

  1. Parsing the formula (source)

    • cell formulae can include any valid python, as well as
    • special spreadsheet syntax, including cell references like A1 or B2, and special spreadsheet formulae like the SUM function
    • any special spreadsheet syntax is parsed and converted to Python
    • and finding out the dependencies. If the formula for cell A1 includes a reference to B1, then B1 is a dependency of A1
  2. Placing it into the whole spreadsheet's dependency graph (source)

  3. Evaluating all the branches of that graph, starting from its leaves, by evaluating the cell's formula to get its value. That can then be fed into cells that depend on it, and so on. (See calculate.py)

Cell formulae can also use any user-defined functions from the usercode.

Everything else is fairly peripheral. There is some monkeying around with json, some stuff with threads that's a throwback to some parallelisation features that I haven't finished removing.

Questions and requests for clarification are solicited, as are any pull requests for documentation, bugfixes, fixes to unit tests (of which all but three were passing in this modified version of our codebase, at the time of writing), or FTs (half-ported from old selenium)

dirigible-spreadsheet's People

Contributors

dbieber avatar hjwp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dirigible-spreadsheet's Issues

Export formulae

Dear folks,

first thanks very much for making this open source after you closed down Revolver!

I've always been really curious how it worked, and have finally come round to building it.
Really cool! I do have one question: is it possible to export the data while retaining simple formulae? I currently only see a csv export, but that removes any cell references and replaces it with the calculated values, right? So you cannot backup and then roundtrip a document that way. Is there another option to save data - or even get it from the backend of the server?

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.