Skip to main content

Raylings ⚡

Docs CI License

An interactive, hands-on CLI learning environment for mastering Python Ray from scratch.

Inspired by the pedagogy of Rustlings and Ziglings, Raylings guides you through progressively challenging distributed computing exercises in Python. You will fix broken code, fill in missing distributed patterns, resolve performance bottlenecks, eliminate memory leaks, and build real-world distributed systems.

📚 Full Documentation Site: https://dnf0.github.io/raylings/
👉 New to Raylings? Read the Interactive Onboarding Guide for a deep dive into setup, preflight diagnostics, the tour engine, keyboard shortcuts, and troubleshooting.


What is Raylings?

Ray is a unified framework for scaling AI and Python applications from single laptops to massive multi-node clusters. While powerful, mastering Ray's mental models—futures, stateful actors, Plasma zero-copy memory, dynamic placement groups, and lineage-based fault tolerance—requires hands-on practice.

Raylings provides:

  • Preflight Diagnostics (raylings doctor): Built-in environment & hardware diagnostics checking Python 3.10+, Ray installation, CPU/RAM capacity, and cluster health.
  • Interactive Tour (raylings tour): 5-step interactive curriculum tour explaining distributed primitives, exercise workflow, and developer shortcuts.
  • Interactive File Watcher (raylings watch): Edit exercises in your favorite editor; Raylings automatically re-runs and validates your changes on save.
  • Sub-50ms Execution: Background Ray daemon re-uses a warm local cluster session for rapid turnaround.
  • 14 Chapters & 66 Exercises: From first remote tasks to distributed parameter servers, PyTorch DDP pipelines, Ray Serve DAGs, and KubeRay on Kubernetes.
  • Progressive Hints & Solutions: Stuck on an exercise? Get layered hints without spoiling the answer, or inspect canonical solutions when finished.
  • First-Class VS Code Extension: Dedicated sidebar tree view, status bar progress, on-save auto-evaluations, and built-in interactive walkthroughs.

Quickstart

Prerequisites

  • Python 3.10, 3.11, or 3.12
  • uv (recommended) or pipx / pip

1. Instant Run with uvx (No installation needed)

Initialize a workspace in any directory, run diagnostics, take the tour, and jump right in:

uvx raylings init
uvx raylings doctor
uvx raylings tour
uvx raylings watch

2. Standard Installation

Install globally or in your virtual environment:

pip install raylings
raylings init
raylings doctor
raylings tour
raylings watch

3. From Source

Clone the repository and install in editable mode:

git clone https://github.com/dnf0/raylings.git
cd raylings
pip install -e ".[dev]"
raylings doctor
raylings tour
raylings watch

Interactive Learning Workflow

Raylings starts on the first exercise in exercises/01_basics/basics01.py.

1. Open exercises/01_basics/basics01.py in your code editor.
2. Read the instructions, implement the Ray distributed calls, and remove '# I AM NOT DONE'.
3. Save the file. Raylings immediately tests your changes and advances to the next exercise.

Key CLI Commands

  • raylings doctor — Run preflight system, Python, and Ray environment diagnostics.
  • raylings tour — Launch the 5-step interactive onboarding tour (--step, -y, --json).
  • raylings init — Extract bundled exercises into the current directory.
  • raylings watch — Start continuous watching mode with keyboard shortcuts (n, p, r, h, q).
  • raylings run <exercise_name> — Run and verify a specific exercise.
  • raylings test — Run automated verification across all canonical reference solutions.
  • raylings hint <exercise_name> — Show progressive hints for an exercise (--level).
  • raylings list — View all chapters, exercises, and completion progress.
  • raylings progress — Display progress summary and next recommended exercise.
  • raylings daemon [status|start|stop|restart] — Manage the warm background Ray cluster session.

VS Code & IDE Integration

Raylings provides a first-class extension for VS Code and Cursor (editors/vscode):

  • Welcome Walkthrough: Interactive onboarding via Help > Welcome > Walkthroughs > Welcome to Raylings.
  • Exercise Explorer: Browse chapters and exercises with status badges in the Activity Bar.
  • Auto-run on Save: Automatically evaluates exercises on file save.
  • Status Bar: Live progress tracking and active exercise display.

Curriculum Map

Raylings covers 14 comprehensive chapters spanning core foundations to production ML engineering:

Chapter Title Topics Covered
01 Ray Core Foundations ray.init() mechanics, @ray.remote tasks, ObjectRef futures, parallel pipelines, ray.wait(), multiple return values
02 Distributed State & Actors Stateful actor classes, method serialization, actor handles, async actors, threaded actors, detached named actors, actor pools
03 Plasma Object Store & Zero-Copy Plasma in-memory architecture, zero-copy NumPy/PyArrow, ray.put(), object pinning, disk spilling, serialization closures
04 Scheduling & Placement Groups Fractional CPU/GPU resources, node affinity, STRICT_SPREAD, STRICT_PACK, multi-bundle gang scheduling, runtime environments
05 Fault Tolerance & Recovery Automatic task retries, actor restart policies, lineage reconstruction, spot instance & preemption handling
06 Cluster Architecture & Simulation Head vs worker nodes, GCS, Raylets, multi-node testing with ray.cluster_utils.Cluster, Ray Job Submission API
07 Patterns & Anti-Patterns Fixing nested ray.get(), task chunking/batching, actor bottleneck elimination, tree-structured aggregation
08 Ray Data (ETL & Batch) Ray Datasets, block partitioning, map_batches with PyArrow/NumPy, ActorPoolStrategy, streaming backpressure, PyTorch interop
09 ML Primitives from Scratch Distributed parameter servers, async vs sync parameter updates, ring all-reduce communication, distributed trainers
10 Ray Train (PyTorch DDP) TorchTrainer, ScalingConfig, distributed dataloaders, multi-GPU gradient sync, distributed checkpointing
11 Ray Tune (Hyperparameter Optimization) Search spaces, distributed trial execution, ASHA / HyperBand early stopping, Population-Based Training (PBT)
12 Ray Serve (Model Deployment) @serve.deployment, HTTP ingress, dynamic request batching (@serve.batch), multi-model DAGs, streaming LLMs, autoscaling
13 Observability & Debugging Chrome execution timelines (ray timeline), memory profiling (ray memory), Prometheus metrics, GCS dumps
14 KubeRay on Kubernetes RayCluster CRD, RayJob batch lifecycles, RayService rolling zero-downtime serving, KEDA autoscaling, pod eviction recovery

Documentation

The full documentation is available at https://dnf0.github.io/raylings/.


License

This project is licensed under the Apache License, Version 2.0.

Metadata

Release files for raylings 0.2.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 raylings 0.2.0
File Size Uploaded
raylings-0.2.0.tar.gz 149.5 kB Details

Built distribution (wheel)

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

Total release size: 379.1 kB

Release files / raylings-0.2.0.tar.gz

Download URL raylings-0.2.0.tar.gz
Size 149.5 kB
Tags Source
SHA-256 checksum
How to use checksums
be20fd649756937c5d6e0da8ee8fd8243e1eed414ed401db41a870b16fc91859
BLAKE2b-256 checksum
How to use checksums
f65061e2f0a82cfb69b0b13d656d751a20a7a5a508ed3df497c8aff050f501ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / raylings-0.2.0-py3-none-any.whl

Download URL raylings-0.2.0-py3-none-any.whl
Size 229.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
786591eb0c91b2b293509822a696a6eaceeb74876311e9e3831c2631bfdada51
BLAKE2b-256 checksum
How to use checksums
246f3964c4ba27bebd79d0a7dfaba4979c2a6de219e9e496dcc42eecced720b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

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