maniator / Sefaria-Project

New Interfaces for Jewish Texts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Interfaces for Jewish Texts

Sefaria is creating interfaces, apps (like a source sheet builder) and infrastructure (like an API and a structured dataset) for Jewish texts and textual learning. Our demo is up at www.sefaria.org.

You can find outputs of our entire database in Sefaria-Export.

Interested developers should join the sefara-dev mailing list.

For general discussion about the project, please post to the Sefaria Forum.

You can post bugs or request/discuss features on GitHub Issues. Tackling an issue marked as a "Starter Project" is a good way to sink your teeth into Sefaria.

Our complete list of development tasks is stored on our Engineering WorkFlowy. If you're interested in working on a project you see listed here, please email the sefara-dev mailing list.


Getting Started

Install Python

Most UNIX systems come with a python interpreter pre-installed.

For Windows:

Go to the Python Download Page and download and install python. Add the python directory to your OS' PATH variable. See here

(Optional) Install virtualenv:

If you work on many Python projects, you may want to keep Sefaria's python installation separate using Virtualenv. If you're happy having Sefaria requirements in your main Python installation, skip this step.

Install virtualenv then enter these commands:

virtualenv venv --distribute
source venv/bin/activate

Now you should see (venv) in front of your command prompt. The second command sets your shell to use the Python virtual environment that you've just created. This is something that you have to run everytime you open a new shell and want to run the Sefaria demo. You can always tell if you're in the virtual environment by checking if (venv) is at the beginning of your command prompt.

Pip:

If you don't already have it in your Python installation, install pip. Then use it to install the required Python packages.

pip install -r requirements.txt

If you are not using virtualenv, run it with sudo: sudo pip install -r requirements.txt

If you see an error about a missing 'python.h' file, you'll need to install the Python development libraries.

On Debian systems:

sudo apt-get install python-dev

On Fedora systems:

sudo yum install python-devel

After installing the Python development libraries, run pip install -r requirements.txt again.

Pip and Virtualenv for Windows Users:

Use instructions here and then make sure that the scripts sub folder of the python installation directory is also in PATH.

Create a local settings file:

cd sefaria
cp local_settings_example.py local_settings.py
vim local_settings.py

Replace the placeholder values with values with those matching your environment. Choose a name for you local database (sefaria will be the default created by mongorestore below). You can leave SEFARIA_DB_USER ad SEFARIA_DB_PASSWORD blank if you don't need to run authentication on mongo.

Create a log directory:

create a directory called "log" under the project folder. Make sure that the server user has write access to it by using a command such as chmod 777 (only on the log directory!!)

Get mongod running:

If you don't already have it, install MongoDB. Our current data dump requires MongoDB version 2.6 or later. To get Mongo running:

mongod

Put some texts in your database:

A MongoDB dump of our database is available via DropBox. Download this content, then from the parent directory which contains dump run:

mongorestore --drop

This will create (or overwrite) a mongo database called sefaria.

Set up Django's local server

manage.py is used to run and to manage the local server. Is is located in the root directory of the Sefaria-Project code base.

Django auth features run on a separate database. To init this database and set up Django's auth system, switch to the root directory of the Sefaria-Project code base, and run:

python manage.py syncdb

Run the development server:

python manage.py runserver

You can also make it publicly available by specifying 0.0.0.0 for the host:

python manage.py runserver 0.0.0.0:8000

Exploring the Code

Some of the most important code is found in:

  • static/js/reader.js - JS for reader app
  • static/js/sheets.js - JS for source sheet builder
  • static/js/util.js - JS shared across apps
  • sefaria/reader/views.py - view methods for almost all API calls
  • sefaria/sheets.py - backend for source sheets
  • sefaria/model/ - Class based resource and logical models for almost all Sefaria data

Command Line Interface

The shell script cli will invoke a python interpreter with the core models loaded, and can be used as a standalone interface to texts or for testing.

$ ./cli
>>> p = LinkSet(Ref("Genesis 13"))
>>> p.count()
226

Thanks

We're grateful to the following orgazations for providing us with donated services:

License

GPL

About

New Interfaces for Jewish Texts


Languages

Language:JavaScript 39.0%Language:HTML 31.0%Language:Python 24.1%Language:CSS 5.3%Language:PHP 0.6%Language:Shell 0.0%Language:Batchfile 0.0%