Site d'apprentissage de Python par la pratique. https://genepy.org
  • Python 58%
  • HTML 20.5%
  • CSS 16%
  • JavaScript 4.5%
  • Jinja 0.9%
  • Other 0.1%
Find a file
2026-05-14 19:24:55 +02:00
.github Also pushing on github, proofreading README. 2022-05-23 15:35:46 +02:00
deploy Opt for psycopg connection pooling. 2026-04-19 16:06:20 +02:00
doc Got pypi.org/p/genepy, yay! 2026-05-07 15:39:58 +02:00
genepy_org Add a basic auth middleware for websockets. 2026-05-08 19:45:03 +02:00
hkis Avoid wrapping between → and DÉMARRER 2026-05-14 19:24:55 +02:00
locale/fr/LC_MESSAGES Rename hackinscience_org to genepy_org 2025-02-10 21:26:33 +01:00
templates Admin: Move templates inside app. 2023-04-10 14:21:53 +02:00
.gitignore Merge remote-tracking branch 'ansible/ansible' 2025-02-10 21:46:14 +01:00
correction_bot.py No need to pass user-id everywhere, the user knows if he's logged. 2025-05-11 18:35:56 +02:00
docker-compose.yml Dropping Celery: no asyncio support, no multithreading support. 2024-05-26 18:24:48 +02:00
Dockerfile add support for docker / docker-compose 2020-12-23 14:29:39 +01:00
LICENSE sed hackinscience to genepy. 2025-02-06 10:33:32 +01:00
manage.py Rename hackinscience_org to genepy_org 2025-02-10 21:26:33 +01:00
mypy.ini Mandatory black, pylint, mypy, flake8 before editing þ 2018-10-23 23:42:15 +02:00
pyproject.toml Passing tox. 2026-05-08 15:32:59 +02:00
README-docker.md Rename hackinscience_org to genepy_org 2025-02-10 21:26:33 +01:00
README.md Monitoring inscription rates. 2025-02-09 23:44:18 +01:00
requirements-dev.txt help page from markdown in admin to real page. 2025-01-20 13:38:02 +01:00
requirements.txt Bump dependencies. 2025-04-03 08:39:15 +02:00

Genepy

Genepy is an open-source platform to practice any programming language with live feedback. The canonical instance of Genepy, to practice Python, is known as Genepy.org had already been teaching Python to 25k+ users.

Documentation

https://doc.genepy.org

The pages

A page is literally a URL in your site, it can contain text (stored Markdown) and/or exercises.

For example the automatically created page at /help is aimed to store text but no exercises, and the page at /exercises is aimed to present some exercises, maybe after an intro text, or without any text.

You can live with only those two pages, or create a whole set of pages like one exercise page per programming language, or per topic, per student class, ...

Once logged, the users are redirected to the first page (the one with the smallest position).

The tags

Exercises can optionally be tagged, like easy, numpy, rust, or whatever helps you organize your exercises. Exercises can have multiple tags.

Stats

I like getting some stats from the DB like:

Time to give a correction

SELECT date_trunc('month', created_at) m,
       TO_CHAR(min(corrected_at - created_at), 'MI:SS.MS') min,
       TO_CHAR(max(corrected_at - created_at), 'MI:SS.MS') max,
       TO_CHAR(avg(corrected_at - created_at), 'MI:SS.MS') avg1,
       PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY (corrected_at - created_at)) median
FROM hkis_answer
WHERE is_corrected AND created_at > now() - interval '1 year'
GROUP BY m
ORDER BY m;

On genepy.org the median went from 0.7s (march 2022) to 0.4s (march 2023), back to 0.5s (October 2024). Beware there's always students running infinite loops so the max can't be low.

Success ratio on exercises

SELECT exercise.title_en,
       COUNT(1), 100 * SUM(CASE WHEN answer.is_valid THEN 1 ELSE 0 END)/COUNT(1) "success ratio"
FROM hkis_answer answer
JOIN hkis_exercise exercise ON exercise.id = answer.exercise_id
WHERE answer.created_at > NOW() - INTERVAL '1 week'
GROUP BY exercise.id, exercise.title_en, exercise.position
ORDER BY exercise.position;

Inscriptions

SELECT COUNT(1), TO_CHAR(DATE_TRUNC('day', date_joined), 'YYYY-MM-DD Day') d
FROM auth_user
WHERE date_joined > DATE_TRUNC('day', NOW() - INTERVAL '31 day')
GROUP BY d
ORDER BY d;

How does the checker bot work?

The answers are load-balanced to correction workers using Redis, so you can have multiple machines dedicated to correct loads of answers.

Once received by a worker the worker runs two things:

  • A check.py script is then started in a sandbox (no internet connectivity, restricted file system, CPU, memory usage, …). This is the script that check the student answer, the protocol is simple: if the script exits with non-zero, then answer is wrong. And what's been printed (both stdout and stderr) is displayed, as Markdown, to the student. If the answer is right and nothing is printed, a default congratulation message is used.

check.py is to be written in Python, but it's not limited to check Python answers, if you want to check for shell script or C, or whatever, the check.py can use subprocess to run the answer script, or compile the answer code, or whatever needed.