csev/py4e: the source behind the Python for Everybody course site
Web site for www.py4e.com and source to the Python 3.0 textbook
At a glance
- What is it?
- csev/py4e is the repository that builds www.py4e.com and holds the Python 3 textbook sources. It is a Tsugi-based PHP site plus book and code folders, not a pip package, and the quiz content lives in a separate private repository.
- Who is it for?
- Adopt csev/py4e if you run a course and want the Python for Everybody materials under your own domain with LTI launches into an LMS, and you are willing to run PHP, MySQL and a Tsugi checkout. Do not adopt it if you only want the book or the code samples: book3, figures and code3 can be read and copied without installing anything.
- Can I use it commercially?
- The repository metadata does not identify a licence. Check the project’s published terms and any component-specific licences before reuse.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- csev/py4e3,113 ★ · +11
| Repository | 2026-09-24 | 2026-11-25 |
|---|---|---|
| csev/py4e | 3.1k | 3.1k |
11 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What csev/py4e actually is, and who ends up installing it
This repository is not a library you import. It is the web application behind www.py4e.com, plus the source of the Python for Everybody textbook. The README describes it as "Course materials for www.py4e.com" and points at four content folders: book3, figures, images and code3. The Python 3 versions of the code all live in code3.
That split matters when you decide whether to adopt it. Two audiences arrive here. The first wants the book and the exercises and never needs PHP: they can take book3 and code3 and leave. The second runs a course and wants a site where students log in with Google, do autograded homework, and get grades tracked. That second group is who the setup instructions are written for, and the instructions assume a Mac with MAMP, MySQL, and a second checkout of Tsugi cloned inside the py4e folder.
The topics list confirms the shape: course-materials, lti, mooc, oer. LTI and MOOC are the load-bearing ones. The site is built so the same content can be delivered two ways, either launched from a Learning Management System through LTI keys, or run as a standalone MOOC where students log in directly with Google and earn badges.
How the site is put together: Tsugi mounted under py4e
The architecture is a PHP application with a second PHP application nested inside it. You clone py4e, then clone tsugi into the py4e folder. Tsugi supplies the LMS machinery: login, announcements, pages, LTI launches, the admin console, and the database layer through $CFG->pdo.
Three files carry most of the wiring. tsugi_settings.php holds non-private configuration and is included by tsugi/config.php. tsugi.php mounts the common controllers such as /announcements, /login and /pages directly under py4e, so those paths look like part of the site rather than a separate tool. buildmenu.php builds the navigation. If you plan to change the menu, that is the file, not a theme setting.
Because Tsugi is a store as well as a runtime, tools are installed into it rather than vendored into py4e. The README notes that the other two required LTI tools already ship in the py4e/tools folder, while peer grading and Gift Quiz come from outside. That is the reason the install sequence keeps sending you back to the database upgrade: each newly installed module brings its own tables.
Installing csev/py4e on localhost with MAMP and Tsugi
The README gives a Macintosh and MAMP path. Install MAMP first, then check the repository out into a top level folder under htdocs and clone Tsugi inside it.
cd /Applications/MAMP/htdocs
git clone https://github.com/csev/py4e.git
cd py4e
git clone https://github.com/csev/tsugi.gitNext create the database and a dedicated user. The README uses the name tsugi with the utf8 character set and the credentials ltiuser and ltipassword.
CREATE DATABASE tsugi DEFAULT CHARACTER SET utf8;
CREATE USER 'ltiuser'@'localhost' IDENTIFIED BY 'ltipassword';
GRANT ALL ON tsugi.* TO 'ltiuser'@'localhost';
CREATE USER 'ltiuser'@'127.0.0.1' IDENTIFIED BY 'ltipassword';
GRANT ALL ON tsugi.* TO 'ltiuser'@'127.0.0.1';Inside the tsugi folder, copy the distributed config and edit it. The README lists the values used on MAMP, including the PDO string with port 8889, the admin password, and the application home.
$wwwroot = 'http://localhost:8888/py4e/tsugi';
$CFG->pdo = 'mysql:host=127.0.0.1;port=8889;dbname=tsugi';
$CFG->dbuser = 'ltiuser';
$CFG->dbpass = 'ltipassword';
$CFG->apphome = 'http://localhost:8888/py4e';
$CFG->servicename = 'PY4E';Then open http://localhost:8888/py4e/tsugi/. The README says it should complain that tables do not exist and point you at the admin console at /py4e/tsugi/admin, which asks for the admin password before unlocking. Run the Upgrade Database option, or create the tables from the command line instead.
cd py4e/tsugi/admin
php upgrade.phpKeep refreshing /py4e/tsugi until the error messages clear. One step is easy to miss and breaks things quietly: in the database, in the lti_key table, the row whose key_key is google.com needs a value in the secret column. The README is explicit that anything will do as long as it is not empty, and that leaving it empty stops the internal LTI tools from launching. After that, install the peer-grading tool from https://github.com/tsugitools/peer-grade through the admin install page, re-run the database upgrade, then do the same for Gift Quiz. A test launch environment is available at /py4e/tools/ using the key 12345, which lets you launch as instructor and student without an LMS.
What you cannot get from the public repository
The quiz content is not here. The README asks you to contact Chuck for access to a private py4e repository, and states that access is given only to people seriously installing the software and verified as teaching the course and adopting the materials. If you are granted access, you clone py4e-private next to py4e and point a config value at it.
$CFG->giftquizzes = $CFG->dirroot.'/../py4e-private/quiz';You also need a quiz unlock password from the same source, and quiz content has to be loaded one course context at a time. This is the sharpest limitation in the whole setup, and it is a policy decision rather than a technical one. A self-hoster can stand up the full site, install both external tools, and still have no quizzes. If quizzes are the reason you are deploying, the deployment is not finished until that access is arranged, and the README does not describe a fallback.
The same goes for the book and code folders: nothing in the README explains how the site renders book3, so a reader who wants to change the textbook presentation is working from the repository layout rather than from documentation.
Google login and the LTI key you have to patch by hand
Google login is optional and documented as a console walkthrough. You create an OAuth Client ID of type Web Application, set the authorized JavaScript origin to http://localhost, and set the redirect URI to http://localhost/py4e/login. The README notes that neither value should carry a port number, which is counterintuitive when the rest of the setup is running on 8888 and 8889. The client ID and secret go into config.php as $CFG->google_client_id and $CFG->google_client_secret, and there is a separate $CFG->google_map_api_key for a Maps key.
Once login works, the README describes the intended experience: browse the site logged out, then log in with Google and the UI changes, showing Assignments and LTI autograders inside Lessons. To become an instructor in the global course, you log in, visit /tsugi/admin, enter the admin password, and use the administration console to view the context and promote the account. The README warns that the Admin entry does not appear in the dropdown until you have visited the admin UI once and logged in successfully, which is a confusing first-run experience worth knowing about in advance.
How this compares with pulling the textbook alone
The obvious alternative is to skip the application and take the content. book3, figures, images and code3 are plain folders in the same repository, and the README points at book3/README.md for details on the book. If your goal is to read the material, assign the exercises, or fork the text, cloning the repository and ignoring the PHP is a legitimate approach, and it avoids MySQL, Tsugi, the admin console, and the private quiz repository entirely.
The difference in approach is real rather than cosmetic. The full site gives you LTI launches from an LMS, Google-authenticated student accounts, grade tracking, badges, autograded assignments and peer grading. The content-only path gives you files. Anything you want beyond files, you build. That trade is the decision point for this repository: it is a course delivery platform that happens to ship a textbook, not a textbook that happens to ship a website.
The release history supports reading the project as long-lived and occasionally reorganized. The tags carry their own commentary: v2.0 is labelled "Prior to the big Tsugi Merge", v2.1 "Before major cleanup", and the most recent release, 26.07.1, is labelled "Pre Accessibility Fixes". The last push to the repository was on 2026-09-16. There is also a TODO_2026.txt at the top level, which suggests work is still being tracked in the repository rather than in an issue tracker.
Maintenance cost and licensing
Running this means running three things that each move independently: the py4e checkout, the nested Tsugi checkout, and MySQL. Because Tsugi is cloned rather than pinned by a package manager, upgrading means pulling in that folder and re-running the database upgrade, and the README's install flow already requires that upgrade step after each module is added. Plan for the upgrade to touch tables.
The repository states no licence. The README does not name one, and the top-level file list shows no LICENSE file. The materials are described as OER in the repository topics and there is an OER.md file at the top level, but the repository itself gives no licence identifier, so anyone redistributing the textbook, the figures or the code should establish the terms from the project directly rather than assume. This is a description of what the repository does and does not state, not legal advice.
The private quiz repository adds a second dependency that is not versioned with the public code. If your course depends on quizzes, your deployment depends on access that the README says is granted case by case.
Editorial conclusion
Adopt csev/py4e if you run a course and want the Python for Everybody materials under your own domain with LTI launches into an LMS, and you are willing to run PHP, MySQL and a Tsugi checkout. Do not adopt it if you only want the book or the code samples: book3, figures and code3 can be read and copied without installing anything. Before committing, verify that the peer-grade and Gift Quiz modules install and that the database upgrade completes, and check whether the quiz content you need is inside the private py4e-private repository, because the site will run without it but will not have quizzes.
Frequently asked questions
Is py4e free?
The README does not state a licence and the repository has no LICENSE file, so the public repository does not settle the question by itself. The quiz content is in a separate private repository that the README says is granted only to people verified as teaching the course and adopting the materials.
What programming language does py4e teach?
Python. The README says the Python 3 versions of the code are all in code3, and the book sources are in book3.
What is the Python for Everybody course?
It is the course behind www.py4e.com, and this repository holds its course materials plus the source of the Python 3 textbook. The site can run as a MOOC with Google logins or deliver content into an LMS through LTI launches.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/csev-py4e)Star history chart for your README
[](https://hysenlabs.com/projects/csev-py4e)Was this useful?