Index Ai Academy
Phase 7 · Building software

Capstone: ship a small model library

A typed, tested and profiled package with a train and an eval command, a YAML config, logging and a wheel.

About 45 minutes · A free account opens the whole lesson.
Already have an account? Sign in to open this lesson

What it covers7

Why it matters

This is the capstone for the whole software phase. Almost every skill in it appears here at once: a generator for the data, a typed configuration, a command line with exit codes, logging, tests that survive random numbers, a profile, and a package someone else can install. The model is deliberately tiny, a line fitted to a few points, so the engineering is what you notice. It is the same shape as the training repository you will work in: a small library with a train command, an eval command, a config file and tests.

What you'll be able to do

  • Plan a small library from a brief: a dataset iterator, a typed config, a train and an eval command
  • Load a YAML config into a typed object, and avoid the way YAML turns 3e-4 into text
  • Test numeric code with a seed, and profile a training loop before and after one fix
  • Ship it: a command line with exit codes, a wheel built from its parts, a README and a portfolio brief
Quick check
A training script has the learning rate, the number of epochs and the seed written inside the code. A teammate wants to try ten different values. Where should those settings live?
  1. In a global variable at the bottom of the file
  2. In the commit message of the last change
  3. In a comment at the top of the training file
  4. In a config file the program reads, so runs need no edits
Show the answer

In a config file the program reads, so runs need no edits

Settings that change between runs belong outside the code: a config file, with the values passed to the program. Then a run is a new file, not a new edit, and the settings of every run are on record.

The brief: a small model library

You will build tinyfit, a small package that fits a straight line to a few points with mini-batch gradient descent. The model is simple on purpose. The package around it is the point.

It must:

  • read its settings from a YAML config into a typed object, and refuse a setting it does not know;
  • feed the data through a dataset iterator that yields one batch at a time;
  • train with a seed, so a run repeats exactly, and log one JSON line per epoch;
  • have a command line with train and eval commands that return exit codes;
  • be covered by tests, one of which trains a model on purpose, and be profiled once;
  • be packaged as a wheel, with a README.

This brings together Command-line programs (the commands), Logging (the log lines), Config files: YAML and TOML (the YAML), Testing numeric and random code (tests and seeds), Profiling numeric code and a training loop (the profile) and Packaging your code (the wheel).

Try it now

The plan. Each box becomes a function or a file, and each has its own test.

In your own words
In your own words: why plan the pieces as boxes and tests before writing the library?

Write a sentence or two, then compare it with a good answer in the lesson.

Build it: four checkpoints

Build the library in four pieces, and check each before the next. The data first, since everything uses it.

Checkpoint 1: the dataset as an iterator

A generator yields one batch at a time. It keeps no list of all the batches, so it works the same on ten points or ten million, and the training loop reads from it with a plain for:

import inspect


def batches(xs, ys, size):
    for start in range(0, len(xs), size):
        yield xs[start:start + size], ys[start:start + size]


xs = list(range(10))
ys = [2 * x + 1 for x in xs]
stream = batches(xs, ys, 4)
print(inspect.isgenerator(stream), next(stream))
print([len(bx) for bx, by in batches(xs, ys, 4)])
It runs right here in your browser, with nothing to install.

Ten points in batches of four make batches of 4, 4 and 2: the last one is smaller, and nothing is dropped.

Quick check
A dataset of 10 points is read in batches of 3. What does this print?
def batches(xs, size):
    for start in range(0, len(xs), size):
        yield xs[start:start + size]

print([len(b) for b in batches(list(range(10)), 3)])
  1. [10]
  2. [3, 3, 4]
  3. [3, 3, 3, 1]
  4. [3, 3, 3]
Show the answer

[3, 3, 3, 1]

Starts 0, 3, 6 and 9 give three batches of 3 and a last one of 1. Slicing past the end just returns what is there, so no point is lost.

Quick check
From the command-line lesson: main(argv) returns an exit code. What should tinyfit eval return when the fitted line is not good enough?
  1. Nothing: a script cannot tell
  2. The text 'failed'
  3. 0, with the message in the output
  4. A non-zero code, such as 1
Show the answer

A non-zero code, such as 1

Scripts and CI read only the exit code, so a failure must return non-zero. The words printed are for people. This is the convention the whole command-line lesson builds on.

Checkpoint 2: a typed config

The settings go in a YAML file and come out as a dataclass, so a misspelled setting is an error and a wrong type is converted on the way in. There is one trap: PyYAML reads a number written 3e-4 as the text "3e-4", because its rule for floats wants a dot. A model trains with a learning rate of text, and the error appears much later. Writing 3.0e-4 works, and converting with float makes the loader safe either way:

from dataclasses import dataclass

import yaml


@dataclass
class Config:
    lr: float = 0.05
    epochs: int = 40
    batch: int = 4
    seed: int = 0


def load_config(text):
    raw = yaml.safe_load(text) or {}
    types = {"lr": float, "epochs": int, "batch": int, "seed": int}
    for key in raw:
        if key not in types:
            raise ValueError(f"unknown setting: {key}")
    return Config(**{key: types[key](value) for key, value in raw.items()})


print(yaml.safe_load("lr: 3e-4"))
print(load_config("lr: 3e-4\nepochs: 5"))
try:
    load_config("lrr: 0.1")
except ValueError as error:
    print(error)

The first line shows the trap: a string. The loader's float(value) turns it into 0.0003, and a typo like lrr is refused by name.

Quick check
PyYAML reads lr: 3e-4 as the text '3e-4'. What is the safe fix in the loader?
  1. Convert each value to its type, such as float(value)
  2. Ignore the lr setting and use a fixed value
  3. Use a different file format for the numbers
  4. Write every number as text and hope it works out
Show the answer

Convert each value to its type, such as float(value)

A typed config turns each setting into the type it should have when it is loaded. float('3e-4') is 0.0003, and an int field gets int(value). A wrong type then fails at load time, not in the middle of a run.

Quick check
What does this print?
import yaml

print(yaml.safe_load("epochs: 5\nname: run1"))
  1. 5 run1
  2. {'epochs': '5', 'name': 'run1'}
  3. ['epochs', 'name']
  4. {'epochs': 5, 'name': 'run1'}
Show the answer

{'epochs': 5, 'name': 'run1'}

YAML reads a plain whole number as an int and a bare word as a string, and gives a dict. Only a float written without a dot, like 3e-4, is read as text.

Drill

A config that refuses what it doesn't know

Write load_config(text): read the YAML text, return a dict with lr as a float and epochs as an int, and raise ValueError(f"unknown setting: {key}") for any other key. Missing keys are fine.

import yaml


def load_config(text):
    return yaml.safe_load(text)


print(load_config("lr: 3e-4\nepochs: 5"))
In the lesson, your code is checked as you write it.
Drill

A dataset iterator

Write batches(xs, size) as a generator: it yields xs[0:size], then the next size items, and so on, ending with a shorter batch if needed. It must not build a list of all the batches first.

def batches(xs, size):
    return [xs]


print([len(b) for b in batches(list(range(10)), 4)])
In the lesson, your code is checked as you write it.

Checkpoint 3: tests with a seed

Three tests are enough to guard the library. The shuffle takes its generator from the config's seed, so every test repeats. One test trains a model on purpose and expects the loss to fall:

import random


def batches(xs, ys, size):
    for start in range(0, len(xs), size):
        yield xs[start:start + size], ys[start:start + size]


def train(lr, epochs, batch, seed, xs, ys):
    rng = random.Random(seed)
    w = b = 0.0
    order = list(range(len(xs)))
    losses = []
    for epoch in range(epochs):
        rng.shuffle(order)
        sx, sy = [xs[i] for i in order], [ys[i] for i in order]
        for bx, by in batches(sx, sy, batch):
            errs = [w * x + b - y for x, y in zip(bx, by)]
            w -= lr * 2 * sum(e * x for e, x in zip(errs, bx)) / len(bx)
            b -= lr * 2 * sum(errs) / len(bx)
        losses.append(sum((w * x + b - y) ** 2 for x, y in zip(xs, ys)) / len(xs))
    return w, b, losses


xs = [x / 10 for x in range(10)]
ys = [2 * x + 1 for x in xs]


def test_loss_falls():
    *_, losses = train(0.1, 300, 4, 0, xs, ys)
    assert losses[-1] < losses[0] / 100


def test_repeats_with_a_seed():
    assert train(0.1, 10, 4, 0, xs, ys) == train(0.1, 10, 4, 0, xs, ys)


def test_finds_the_line():
    w, b, _ = train(0.1, 500, 4, 0, xs, ys)
    assert abs(w - 2) < 0.05 and abs(b - 1) < 0.05


for test in (test_loss_falls, test_repeats_with_a_seed, test_finds_the_line):
    test()
    print(test.__name__, "passed")

The loss test is the "overfit one batch" idea: a model that cannot fit ten points on a line is broken. The repeat test is only possible because the seed goes in. The last test checks the answer against what the data was made from, with a tolerance.

Checkpoint 4: a profile before and after one fix

The training loop above does the update with a Python loop over each batch. Profile it, find the line that is called most, and fix just that. cProfile counts calls, and counts do not change between runs. The fix keeps the answer the same, which the cell checks:

import cProfile
import pstats
import random

import numpy as np


def predict(w, b, x):
    return w * x + b


def batches(xs, ys, size):
    for start in range(0, len(xs), size):
        yield xs[start:start + size], ys[start:start + size]


def fit_loop(xs, ys, epochs=20, lr=0.1, size=4):
    rng, w, b = random.Random(0), 0.0, 0.0
    order = list(range(len(xs)))
    for _ in range(epochs):
        rng.shuffle(order)
        for bx, by in batches([xs[i] for i in order], [ys[i] for i in order], size):
            gw = gb = 0.0
            for x, y in zip(bx, by):
                err = predict(w, b, x) - y
                gw, gb = gw + err * x, gb + err
            w -= lr * 2 * gw / len(bx)
            b -= lr * 2 * gb / len(bx)
    return w, b


def fit_array(xs, ys, epochs=20, lr=0.1, size=4):
    rng, w, b = random.Random(0), 0.0, 0.0
    order = list(range(len(xs)))
    for _ in range(epochs):
        rng.shuffle(order)
        for bx, by in batches([xs[i] for i in order], [ys[i] for i in order], size):
            bx, by = np.array(bx), np.array(by)
            err = predict(w, b, bx) - by
            w -= lr * 2 * (err * bx).mean()
            b -= lr * 2 * err.mean()
    return w, b


def calls_to_predict(fit, xs, ys):
    profiler = cProfile.Profile()
    result = profiler.runcall(fit, xs, ys)
    stats = pstats.Stats(profiler).stats
    return result, {func[2]: row[1] for func, row in stats.items()}["predict"]


xs = [x / 10 for x in range(10)]
ys = [2 * x + 1 for x in xs]
(before, calls_before), (after, calls_after) = (calls_to_predict(f, xs, ys)
                                                  for f in (fit_loop, fit_array))
print(calls_before, calls_after, np.allclose(before, after))

The loop called predict once per point per epoch, 200 times. The array version calls it once per batch, 60 times, and the answer is the same to within rounding. A measured result like that, a call count before and after with a proof that nothing changed, is what goes in the pull request.

Quick check
The profile showed 200 calls to predict before the fix and 60 after. 10 points, 20 epochs, batches of 4. Why 60?
  1. 60 is the number of weights in the model
  2. 3 batches per epoch, 20 epochs: one call per batch
  3. 10 points × 6 epochs, one call per point
  4. It is a rounding of 200 down to a tidy number
Show the answer

3 batches per epoch, 20 epochs: one call per batch

Ten points in batches of four make 3 batches per epoch (4, 4 and 2), and 3 × 20 epochs is 60 calls, one for each batch. Before the fix, each of the 10 points had its own call: 10 × 20 = 200.

In your own words
Why must the test for the faster training loop check that the answer is the same as before, and not only that it is faster?

Write a sentence or two, then compare it with a good answer in the lesson.

Ship it: a command line, a wheel and a portfolio brief

A library is finished when someone else can install it, run it and read what it does.

The command line

main(argv) takes the words, runs a subcommand and returns an exit code, as in Command-line programs. The cell trains on the built-in points, prints one JSON line per epoch for the last two epochs, and returns 0 only when the fitted line is close to the truth:

import argparse
import json
import random


def fit(lr, epochs, seed):
    xs = [x / 10 for x in range(10)]
    ys = [2 * x + 1 for x in xs]
    rng, w, b = random.Random(seed), 0.0, 0.0
    order = list(range(10))
    rows = []
    for epoch in range(1, epochs + 1):
        rng.shuffle(order)
        for i in order:
            err = w * xs[i] + b - ys[i]
            w -= lr * 2 * err * xs[i]
            b -= lr * 2 * err
        loss = sum((w * x + b - y) ** 2 for x, y in zip(xs, ys)) / 10
        rows.append({"epoch": epoch, "loss": round(loss, 6)})
    return w, b, rows


def main(argv):
    parser = argparse.ArgumentParser(prog="tinyfit")
    sub = parser.add_subparsers(dest="command", required=True)
    for name in ("train", "eval"):
        p = sub.add_parser(name)
        p.add_argument("--lr", type=float, default=0.05)
        p.add_argument("--epochs", type=int, default=200)
        p.add_argument("--seed", type=int, default=0)
    args = parser.parse_args(argv)
    w, b, rows = fit(args.lr, args.epochs, args.seed)
    if args.command == "train":
        for row in rows[-2:]:
            print(json.dumps(row))
        return 0
    good = abs(w - 2) < 0.1 and abs(b - 1) < 0.1
    print("ok" if good else "not close enough")
    return 0 if good else 1


print(main(["train", "--epochs", "200"]))
print(main(["eval", "--epochs", "200"]))
print(main(["eval", "--epochs", "2"]))

train prints its last two log lines and returns 0. eval returns 0 when the fitted line is near the truth and 1 when it is not, so a CI step or a shell script can read the result without parsing anything.

Worked example

Worked example: a wheel is a zip

A wheel is a zip file with the package's files and a small .dist-info folder that describes them. Build one by hand, read its metadata back and list what is inside, as an installer would.

import io
import zipfile

buf = io.BytesIO()
with zipfile.ZipFile(buf, "w") as wheel:
    wheel.writestr("tinyfit/__init__.py", "__version__ = '0.1.0'\n")
    wheel.writestr("tinyfit-0.1.0.dist-info/METADATA",
                   "Metadata-Version: 2.1\nName: tinyfit\nVersion: 0.1.0\n")
    wheel.writestr("tinyfit-0.1.0.dist-info/WHEEL",
                   "Wheel-Version: 1.0\nRoot-Is-Purelib: true\nTag: py3-none-any\n")

with zipfile.ZipFile(io.BytesIO(buf.getvalue())) as wheel:
    print(wheel.namelist())
    meta = wheel.read("tinyfit-0.1.0.dist-info/METADATA").decode()
    print(meta.splitlines()[1:])
In the lesson you can change this and run it.

The file name tinyfit-0.1.0-py3-none-any.whl encodes the name, the version and that it works with any Python and any platform. Inside are the package folder and a .dist-info folder whose METADATA says what the package is. Real builds are made by python -m build, from the pyproject.toml, which writes these same files and adds a RECORD of every file's hash. An installer unzips the wheel into the environment. Nothing runs at install time.

Quick check
What is a wheel (.whl) file?
  1. A compiled program that only runs on one computer
  2. A Docker image holding a whole system
  3. A text file that lists only the dependencies
  4. A zip of the package's files plus a .dist-info folder
Show the answer

A zip of the package's files plus a .dist-info folder

A pure-Python wheel is a zip. An installer reads its METADATA, checks the dependencies and unzips the files into the environment.

Portfolio brief

Ship your own small model library

Build and ship your own version of tinyfit, or a small library of your choosing that fits a model to data. Treat it as a portfolio piece: someone reading your repository should be able to install it, run it and see that you tested and measured it.

Write the README first: what the library does, how to install it and the two commands to run.

It must

  • A typed config loaded from YAML that refuses unknown settings and reads 3e-4 as a number
  • A dataset iterator written as a generator, with a test that no point is dropped
  • A train command that logs one JSON line per epoch and takes a seed, and an eval command that returns a non-zero exit code when the result is not good enough
  • At least three tests, including one that trains on a tiny dataset and expects the loss to fall, and one that checks a gradient or a shape
  • A profile (cProfile call counts or timings) before and after one fix, with a test that the answer did not change
  • A pyproject.toml, a built wheel, and a README with the install and run commands

Go further

  • Add logistic regression for two classes, with a test that the probabilities sum to 1
  • Add a GitHub Actions workflow that runs the tests and ruff on every push
  • Read the dataset from a CSV file, and test that a missing file gives a clear error
import random
from dataclasses import dataclass


@dataclass
class Config:
    lr: float = 0.05
    epochs: int = 40
    seed: int = 0


def batches(xs, ys, size):
    ...


def train(cfg, xs, ys):
    rng = random.Random(cfg.seed)
    ...


# your code: load_config, evaluate, main(argv), tests, and a profile
In the lesson, you build it here and the tutor can review it.

On the job: a library like this is what a teammate asks for in a pull request: the change, a test that fails without it, and a measured result. Put the config in the repository, pin the versions that matter, and make the exit code the truth. Then a failed run is a red CI job, not a surprise at the end of the week.

In your own words
A teammate installs your wheel, runs tinyfit train, and it works on your data but fails on theirs with a confusing error. What in the library would you look at first, and what would you add?

Write a sentence or two, then compare it with a good answer in the lesson.

Goes deeper in

Practice what you just read

  • 6 code examples you can edit and run
  • a practice exercise that checks your code
  • a 5-question quiz
  • 9 review cards for spaced repetition

Try a quiz question

Why does the dataset iterator use yield instead of returning a list of every batch?

  1. It produces one batch at a time, so memory stays small
  2. yield is required by Python for any loop over data
  3. A list of batches cannot be looped over in Python
  4. It makes the training more accurate on small data

Answer it at the end of the lesson to see if you're right, and why.

Before this lesson

Keep learning

Where this lesson leads.

575 lessons in thirteen phases. 176 are free without an account, and a free account opens the rest. See every lesson.

Phase 7 · about 48 hours of study

Software engineering

How software is built, from bits to tested, well-designed programs 59 lessons 1 free
  1. Iterators and generators FreeThe iteration protocol, yield, lazy pipelines and itertools, in small memory.45 min
  2. Context managersSetup and cleanup that always run: with, contextlib, transactions and atomic writes.35 min
  3. Closures and decoratorsFunctions that remember, wrap and extend other functions.40 min
  4. Exceptions in depthError hierarchies, chaining, notes, exception groups and warnings.40 min
  5. Pattern matchingmatch and case: literal, sequence, mapping and class patterns with guards.35 min
  6. Text, bytes and encodingsstr and bytes, UTF-8, decoding errors, normalization and base64.35 min
  7. Binary filesBytes as numbers, endianness, struct records, file signatures and checking uploads.45 min
  8. Testing your codeAutomated tests that prove code works and keep it working.45 min
  9. Testing with pytestFixtures, parametrize, mocks, temporary files and coverage.45 min
  10. Testing numeric and random codeClose enough for floats, seeds and what they fix, properties that hold for any input, a gradient check and overfit-one-batch.40 min
  11. Debugging systematicallyFind any bug with a method instead of guesswork.35 min
  12. Readable code and refactoringWrite code people can understand, and improve it safely.35 min
  13. Code style and toolsPEP 8, formatters, linters and type checkers, and how they fit together.35 min
  14. Types and data modelingType hints, dataclasses and checking data at the edges of a program.35 min
  15. Typing in depthGenerics, protocols, TypedDict, Literal and narrowing, checked by mypy.45 min
  16. Classes in depthProperties, alternative constructors, abstract base classes and tuned dataclasses.40 min
  17. Make your classes feel built inSpecial methods for printing, equality, ordering, arithmetic and containers.45 min
  18. Software designModules, interfaces and dependencies that keep big programs changeable.45 min
  19. LoggingLoggers, levels, handlers and configuration, without leaking secrets.40 min
  20. How computers run codeBits, memory, the processor, and what really happens when Python runs.40 min
  21. Arrays in memoryBuffers, dtypes, shapes and strides: why a transpose is free, and which operations copy.40 min
  22. Algorithm complexityCount the work code does, and see why some programs stop scaling.40 min
  23. Concurrency and asyncDo many things at once: processes, threads and the event loop.45 min
  24. Performance and profilingMeasure before you optimize, then fix the part that matters.45 min
  25. Profiling numeric code and a training loopWhere a training step spends its time, Amdahl's rule by hand, and cProfile on a loop with a slow batch function.40 min
  26. Reading C, C++, CUDA and RustPointers and loops in C, references and templates in C++, one-thread-per-element CUDA kernels, and Rust's Option, Result and ownership.30 min
  27. Core data structuresArrays, linked lists, stacks, queues and the hash table behind every dict.45 min
  28. Heaps and priority queuesA list read as a tree: the best k of a million without sorting, and where top-k hides in AI work.35 min
  29. Recursion, trees and graphsFunctions that call themselves, and the shapes most real data takes.45 min
  30. Searching, sorting and dynamic programmingThe classic algorithms, and the ideas behind them.45 min
  31. Dynamic programming in depthA method in five questions: state, choices, recurrence, base case and order. Coins where greedy fails, rebuilding the solution, packing a token budget, the likeliest path behind noisy readings, and what it costs.45 min
  32. Binary search trees and traversalsInsert, search and delete in a sorted tree, walk it four ways, and see why balance and B-trees matter.45 min
  33. Patterns for coding problemsTwo pointers, counting with dictionaries, prefix sums and sliding windows: O(n) answers to classic problems.45 min
  34. Project: a spell checker, three waysA sorted list, a hash set and a trie, measured for speed and memory, with suggestions.45 min
  35. Searching for solutionsBacktracking with pruning, Dijkstra's algorithm and A*, ending with an optimal sliding-puzzle solver.45 min
  36. Project: an unbeatable game opponentGame state and rules, minimax with a cache, and an exhaustive test that proves it never loses.45 min
  37. Databases and SQLStore, query and join data with the language every database speaks.40 min
  38. SQL for analysisSubqueries, CASE, common table expressions, outer joins and window functions on real order data.45 min
  39. Designing a databaseFrom one big table to related tables: keys, constraints, many-to-many and a loader that is safe to rerun.40 min
  40. Databases with an ORMSQLAlchemy models, sessions, relationships, transactions and the N+1 problem.45 min
  41. Changing a database safelyNumbered migrations in transactions, required columns and backfills, and expand-and-contract changes.40 min
  42. Secure codingInjection, escaping, secrets and passwords: the mistakes attackers look for.40 min
  43. Projects, packaging and CILay out a real project, pin its dependencies and test it on every push.35 min
  44. Config files: YAML and TOMLWrite YAML and TOML that parse as you meant, dodge the type traps, and validate what you load.25 min
  45. Command-line programsargparse subcommands, stdin, exit codes and testable main functions.40 min
  46. Packaging your codepyproject.toml, the src layout, versions, entry points and wheels.45 min
  47. Pipes and text tools in the shellgrep, wc, sort, uniq, head and cut, chained with pipes to answer questions about logs and data.25 min
  48. JSON on the command line: curl and jqCall APIs with curl, fail on HTTP errors, and pull values out of JSON with jq paths and select.25 min
  49. Shell scripts that fail safelyTurn commands into scripts with variables, set -euo pipefail and clear exit codes, and know when to switch to Python.25 min
  50. Reading and writing XMLElementTree, attributes and text, namespaces, building XML safely, and untrusted input.35 min
  51. Project: a word-guessing gamePlan a game with a flowchart, then build it from tested functions and one input loop.40 min
  52. Project: a card game of 21Turn written rules into functions, and make randomness testable.40 min
  53. Project: a drinks kioskA program with state and commands, built with functions, then refactored into classes.45 min
  54. Project: a flashcard trainerCards from a file, review boxes, and progress saved between runs.45 min
  55. Project: a price-watch alert botAn API client, alert rules, digest emails and a state file, so reruns never repeat.45 min
  56. Project: Pack Train, an arcade gameA grid game on the turtle canvas: game state as classes, a timer loop, key handlers and a saved best score.45 min
  57. Project: a private password-breach checkHash locally, send five characters, match locally: k-anonymity, safe logging and failure handling.40 min
  58. Capstone: a command-line appDesign, build and test a complete program with a database.45 min
  59. Capstone: ship a small model libraryA typed, tested and profiled package with a train and an eval command, a YAML config, logging and a wheel.45 min
Step by step 4 steps

Ship a small machine learning library in Python

The core of a typed, tested training package: a config that rejects unknown settings, mini-batches as a generator, a seeded training loop and an evaluation function.

Part of a free course 127 lessons

Free Python developer course

Go from your first line of code to working as a Python developer: projects, testing, data, databases, web apps and APIs, all in your browser.

Never trained an AI? Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account. Teach it to write