Skip to main content

learnlog

A Python package that automatically logs code development and program runs.

By adding import learnlog as the first import in a Python file, every program run is recorded transparently: source code changes, command-line arguments, standard input/output/error, and unhandled exceptions. The data is stored in a hidden local Git repository.

Activating a project

After learnlog init python, activate the project environment in bash:

eval "$(learnlog activate)"
# When finished:
eval "$(learnlog deactivate)"

In Windows PowerShell:

learnlog activate | Invoke-Expression
# When finished:
learnlog deactivate | Invoke-Expression

If PowerShell blocks activation scripts, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once for your user. Use --shell bash, --shell powershell, or --shell cmd to choose the syntax explicitly. The commands print code for that shell to execute. Interactive tutorials need WSL on Windows: learnlog tutorial list works natively and marks them needs WSL, and learnlog tutorial run says so instead of starting.

Use cases

  • Sharing live-coding sessions. A teacher adds import learnlog to demonstration scripts during a lecture or tutorial. After the session the teacher pushes the log to a remote repository:

    learnlog set-remote git@gitlab.kth.se:dbosk/lecture01.git
    learnlog push
    

    Students clone the log and replay it step by step:

    learnlog clone git@gitlab.kth.se:dbosk/lecture01.git
    learnlog play
    

    Alternatively, when a shared Git remote is not available, the teacher can export the log as a portable bundle file:

    learnlog export -o lecture01.bundle
    

    The teacher distributes the file (e.g. via a course page) and students replay it directly:

    learnlog play lecture01.bundle
    

    Older recordings can also be reused as debugging case studies for later students.

  • Studying, supporting, and reviewing how students code. A researcher creates an empty Git repository for each student. Each student adds import learnlog to their programs and pushes the log:

    learnlog set-remote git@gitlab.kth.se:dbosk/alice-log.git
    learnlog push
    

    The researcher then clones each student's repository to analyse the development data:

    learnlog clone git@gitlab.kth.se:dbosk/alice-log.git
    learnlog play
    learnlog analyse X-Tag=lab1 X-Tag=lab2
    

    The analyse command generates LaTeX reports of edit--run cycles. The optional positional arguments filter events by Column=Regex boundaries—here, only events between tags lab1 and lab2 are included.

    Alternatively, the student can export the log as a bundle and submit it through the course platform:

    learnlog export -o alice-log.bundle
    

    The researcher then replays it directly:

    learnlog play alice-log.bundle
    

    This gives a complete timeline of how students develop and debug their code. Students can use it for self-review, or show a TA what they already tried before asking for help. Teachers can reuse old recordings of authentic problems as debugging instruction material, train TAs on common difficulty patterns and authentic debugging traces, inspect development paths during assessment moderation, improve assignments and curricula, and compare cohorts or interventions. The same recordings also support reproducible bug reports, research on programming process, and authorship review, including possible AI-assisted or externally authored work when the final submission does not match the recorded development path.

Release files for learnlog 0.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for learnlog 0.25
File Size Uploaded
learnlog-0.25.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for learnlog 0.25
File Interpreter ABI Platform
learnlog-0.25-py3-none-any.whl Python 3 none any Details

Total release size: 120.7 kB

Release files / learnlog-0.25.tar.gz

Download URL learnlog-0.25.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2f101636a77e82141a4de3bde847c70b1d49e0f03602161c02debcb9aa31a8b3
BLAKE2b-256 checksum
How to use checksums
9ca9d8e609a399768c3e941ef7a40725f4a40f582da91e8d1c2c41768481536a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.14.4 Linux/7.0.0-31-generic

Release files / learnlog-0.25-py3-none-any.whl

Download URL learnlog-0.25-py3-none-any.whl
Size 117.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f92d3896ca80064b220aa3f3108190b1c5f9e2833801fa426fb740b721ce763
BLAKE2b-256 checksum
How to use checksums
d9f82f0ca70d96cb31731621680ea6ca0dccbf7d06041f9462e9eaf859210472
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.14.4 Linux/7.0.0-31-generic

Release history Release notifications | RSS feed

0.26

2 release files

This release

0.25 This release

2 release files

0.24

2 release files

0.23

2 release files

0.22

2 release files

0.21

2 release files

0.20

2 release files

0.19

2 release files

0.18

2 release files

0.17

2 release files

0.16

2 release files

0.15

2 release files

0.14

2 release files

0.13

2 release files

0.12

2 release files

0.11

2 release files

0.10

2 release files

0.9

2 release files

0.8

2 release files

0.7

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page