Skip to main content

PyOS

Build your own operating system in Python -- then play with it.

Python 3.14+ CI Docs License: MIT

Ever wondered what happens when you open a program, save a file, or connect to the internet? PyOS is a complete operating system simulator that lets you see every piece -- processes, memory, filesystems, networking -- and poke at them from a real shell. Built with test-driven development and written for learners.

What Does It Look Like?

  ======================================
            PyOS v0.1.0
     A simulated operating system
  ======================================

  [POST] CPU ... OK
  [POST] Memory ... OK
  [POST] Storage ... OK
  [BOOT] Loading kernel image v0.1.0 ... OK
  [OK] Logger
  [OK] Memory manager (256 frames)
  [OK] Slab allocator
  [OK] File system (journaled)
  [OK] Scheduler (FCFS)
  [OK] Init process (PID 1)

Kernel running. Type 'help' for commands, 'exit' to quit.

root@pyos $ ps
PID  State    Name
1    READY    init

root@pyos $ fork 1
Forked process 1 → child PID 2 (init)

root@pyos $ pstree
init (PID 1)
  └── init (PID 2)

root@pyos $ learn
Available tutorials:
  processes  — What is a process and how do they work?
  memory     — How does the OS manage memory?
  filesystem — How are files stored and organised?
  shell      — What is a shell and why do we need one?
  scheduling — How does the CPU decide what to run next?
Type 'learn <topic>' to start a tutorial.

Features

  • Six CPU schedulers -- FCFS, Round Robin, Priority, Aging, MLFQ, and CFS with multi-core support
  • Virtual memory -- page tables, address translation, swap (FIFO/LRU/Clock), slab allocator, and mmap
  • Journaled filesystem -- inodes, directories, hard/soft links, file descriptors, /proc, and crash recovery
  • Full network stack -- sockets, DNS, HTTP, and TCP with three-way handshake, flow control, and congestion control
  • Shell scripting -- pipes, variables, conditionals, job control, tab completion, and 80+ built-in commands
  • Interactive tutorials -- guided lessons that teach OS concepts hands-on using real system calls

Install

pip install pyos-learn
pyos

Want the browser-based terminal too?

pip install pyos-learn[web]
pyos-web

Learn the Concepts

Each guide explains one part of the OS with real-world analogies and simple language.

Guide What You'll Learn
What Is an OS? The big picture -- what an OS does and why you need one
Processes Programs that are running, how they take turns, forking, and threads
Memory How the OS manages limited memory with pages, virtual addresses, and swap
Filesystem How files and folders are organised, and how they're saved to disk
The Kernel The brain of the OS -- boot sequence and system calls
The Shell Typing commands, pipes, scripting, and environment variables
Devices and Networking Hardware, inter-process communication, disk scheduling, and sockets
Interrupts and Timers Interrupt controller, vectors, masking, timer, preemption
TCP: Reliable Delivery Three-way handshake, flow control, congestion control, retransmission
Users and Safety Permissions, signals, logging, and deadlocks
Synchronization Mutexes, semaphores, condition variables, and race conditions
The Boot Chain What happens between pressing power and seeing a prompt
Framebuffer Pixel-level graphics, drawing shapes, and displaying images
TUI Dashboard A live terminal dashboard that shows OS internals in real time
Permissions File ownership, read/write/execute bits, groups, and ACLs
Binary Loader Loading and running programs -- how exec works
Containers Lightweight isolation with PID, mount, and network namespaces
Inter-Machine Networking Connecting multiple kernels with bridges and clusters
Interactive Tutorials Guided lessons that teach OS concepts hands-on
Web UI Browser-based terminal interface

Development

git clone https://github.com/robcox2910/py-os.git
cd py-os
uv sync --all-extras
uv run pytest

See CONTRIBUTING.md for coding standards and PR workflow.

Releasing

Other projects in the series (PyStack) use a pinned release of this one, not whatever is on main. To publish a change for them:

  1. Merge the change to main.
  2. Tag it: git tag -a vX.Y.Z -m vX.Y.Z && git push origin vX.Y.Z. A change to the public API bumps the minor version (v0.1.0 → v0.2.0); anything else bumps the patch (v0.1.0 → v0.1.1).
  3. In each project that uses it, edit the tag in [tool.uv.sources], run uv lock --upgrade-package <name>, and open a pull request so CI checks the pair together.

This project is one of a series that builds real systems "from scratch in Python" to teach how they work. See the series home for the full story.

Project What it teaches Repository Docs
PyOS Operating systems py-os Docs
Pebble Compilers and programming languages pebble-lang Docs
PyDB Relational databases pydb Docs
PyKV Key-value stores pykv Docs
PyDocDB Document databases pydoc-db Docs
PyGraphDB Graph databases pygraphdb Docs
PyTSDB Time-series databases pytsdb Docs
PyVecDB Vector databases pyvecdb Docs
PyColDB Column-family databases pycoldb Docs
PyCrypt Cryptography pycrypt Docs
PyNet Computer networking pynet Docs
PyWeb HTTP web servers pyweb Docs
PyGit Version control pygit Docs
PySearch Search engines pysearch Docs
PyMQ Message queues pymq Docs
PyLLM Language models (the brain) pyllm Docs
PyScheduler Job scheduling pyscheduler Docs
PyStack Full-stack integration pystack Docs

Documentation

Full docs (with kid-friendly explanations of every idea): https://robcox2910.github.io/py-os/

Metadata

Release files for fromscratch-pyos 0.3.0

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

Source distribution (sdist)

Source distribution for fromscratch-pyos 0.3.0
File Size Uploaded Provenance
fromscratch_pyos-0.3.0.tar.gz 521.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fromscratch-pyos 0.3.0
File Interpreter ABI Platform
fromscratch_pyos-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 738.9 kB

Release files / fromscratch_pyos-0.3.0.tar.gz

Download URL fromscratch_pyos-0.3.0.tar.gz
Size 521.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dc230b19467457f9c69256441f462f3f36a0154928e6e29e2488b22357cb4089
BLAKE2b-256 checksum
How to use checksums
e97a6b5fac8dd640484d32e59519e6e5a177bee7a7027f7e4894c27cd50d6b77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / fromscratch_pyos-0.3.0-py3-none-any.whl

Download URL fromscratch_pyos-0.3.0-py3-none-any.whl
Size 217.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14839a06e436437ddda47fb6333355692143cd70046bd8c64173a46c4afd3c55
BLAKE2b-256 checksum
How to use checksums
3e28161e683a3341374bf21f40d872d06f68b991f4ee66f95ce0f3824201243c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for fromscratch-pyos 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fromscratch_pyos-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

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