Skip to main content

tickertape for Python

Python bindings for tickertape, a local, append-only event journal on memory-mapped segment files. One writer process appends records; any number of readers, in the same or other processes on the same host, follow the journal live or replay it from any sequence number. Records are opaque payload bytes with a sequence number, a caller-defined schema id and two caller-supplied timestamps.

pip install tickertape

Prebuilt wheels: Linux (manylinux and musllinux, x86-64 and aarch64) and macOS (x86-64 and Apple Silicon), one wheel per platform for CPython 3.11 and newer. No runtime dependencies. Windows is not supported (neither is the journal).

Write, follow, replay

import time
import tickertape as tt

with tt.Writer("/tmp/journal") as writer:
    seq = writer.append(b"hello", schema_id=1, local_ts_ns=time.time_ns())
    seqs = writer.append_batch([b"a", b"b", b"c"], schema_id=[2, 2, 3])  # one call, returns range(1, 4)
    writer.checkpoint()  # durable, not only visible

with tt.Reader("/tmp/journal") as reader:
    for record in reader:  # the records committed so far; doesn't wait
        print(record.seq, record.schema_id, record.payload)
    reader.seek(2)
    batch = reader.read_many(1000)  # up to 1000 records, one call
    live = reader.next(timeout=5.0)  # waits for the writer (Ctrl-C works), None on timeout

iter(reader) returns a new iterator over the records committed so far. It never waits, and once it stops it stays exhausted; a later for loop over the reader starts a new iterator at the reader's current position. To follow the writer, call reader.next(timeout=...) (default None: wait forever) or read_many/read_batch with a timeout. The reader itself is not an iterator: next(reader) raises TypeError.

A complete example, with a live follower in a second process and a hand-off to pandas and DuckDB, is examples/end_to_end.py.

Visible versus durable

A record is visible to readers, and survives the writer process dying, as soon as append returns. It is durable (survives power loss, under the storage assumptions in the crash contract) only after a later checkpoint() returns. Closing a writer does not checkpoint. Readers that must never act on a record a power loss could erase use Reader(path, durable_only=True), which returns only records covered by the last checkpoint.

request_checkpoint() starts the same checkpoint on a thread of the library and returns at once with the sequence number it covers up to, so appends go on while it syncs; checkpoint_progress() returns a CheckpointProgress (durable: the last durable Checkpoint or None; pending: the frontier still in flight or None). One runs at a time; a request made while one runs waits for it, and later requests join it. checkpoint() and close() wait for it. A background checkpoint that fails is raised once, by the next request_checkpoint(), checkpoint_progress(), checkpoint() or close(), and poisons the writer like a failed checkpoint(). close() raises that error, or DurabilityLostError if the writer was already poisoned (the writer is closed either way); leaving a with block raises it too, unless the block raised. On Linux, Writer(early_writeback=True) (the default) starts the kernel's write-back as the writer goes, so a checkpoint finds less to write, and helper_cpus ("process", the default, "inherited" or a list of CPU numbers) places the writer's helper threads; both do nothing on macOS.

A failed checkpoint() poisons the writer: later checkpoints raise DurabilityLostError, appends keep working. The failure is not undone by reopening: records appended before a failed checkpoint may not be durable even if a writer opened later in the same boot checkpoints successfully (on Linux a failed fsync can drop the dirty pages). Treat a checkpoint error as an incident.

Batches and columns

append_batch(payloads, *, schema_id, venue_ts_ns, local_ts_ns) takes an iterable of payloads (not a single bytes, bytearray, memoryview or other bytes-like object, and not a str: those raise TypeError). Each metadata argument is one int for all records or an iterable with exactly one per record. All arguments are converted and their lengths checked before anything is appended, so a bad argument appends nothing. A record can still fail during the append, for example one that doesn't fit in a segment (RecordTooLargeError) or a full disk (StorageFullError). Then append_batch raises BatchAppendError: payloads[:e.appended] were appended (from sequence number e.first_seq), the rest were not, and e.__cause__ is the error.

To retry after resolving the cause, pass payloads[e.failed_index:] and slice every per-record metadata sequence at the same index (schema_id=schema_ids[e.failed_index:], ...); a single-int metadata value needs no slicing. append_batch consumes its arguments, so if you may retry, pass lists, tuples or arrays, not one-shot iterators or generators. An exception raised by an argument's iterator (including KeyboardInterrupt) propagates as it is, with nothing appended. A closed writer, or one used in a forked child, raises before consuming any argument.

read_many(max_records, *, timeout=0) waits up to timeout seconds for the first record, then returns what is already committed. read_batch does the same but returns a RecordBatch of columns: little-endian bytes for seq, schema_id, venue_ts_ns, local_ts_ns, and Arrow-style payload offsets and data. A RecordBatch has a length, can be indexed (batch[i], batch[-1]) and iterated (each item a Record); slicing raises TypeError (use batch.records()[a:b], or slice the arrays from to_numpy()). As for a list, an index must be an int (or have __index__): other types raise TypeError, and only an int out of range raises IndexError.

Timeouts are seconds as an int, a float or a datetime.timedelta. None, math.inf and any value too large to represent (such as sys.maxsize) wait forever; negative values and NaN raise ValueError. The defaults differ on purpose: next() waits forever, read_many and read_batch don't wait.

batch = reader.read_batch(100_000)
arrays = batch.to_numpy()  # needs numpy; numeric columns share the batch's buffers
table = batch.to_arrow()  # needs pyarrow; payload is large_binary
frame = batch.to_pandas()  # needs pandas

NumPy, pyarrow and pandas are optional and imported only when these methods are called.

Copies, lifetimes and threads

  • Payloads are bytes or any buffer of unsigned bytes (bytearray, memoryview, array('B'), uint8 NumPy arrays); buffers of other item types (array('b'), int8 or wider arrays) raise TypeError, view them as bytes first (memoryview(a).cast('B'), a.view(np.uint8)). append uses a bytes payload without copying it and copies other buffers once. The payload is then copied into the journal.
  • Every Record owns its payload as an ordinary bytes object; it stays valid after the reader moves on or closes. RecordBatch columns are bytes too; arrays made from them keep them alive.
  • A reader copies records into a staging buffer before building a result. Once all staged records have been delivered, it keeps at most 6 MiB (6,291,456 bytes) of that buffer for reuse (enough for read_batch(10_000) with payloads of a few hundred bytes); a larger one is freed, with the GIL released, by the read that delivers the last of them, before the call returns (or by a seek). Records that a read took from the journal but did not deliver, because it raised (on a signal, for example), stay staged in their buffer, however large, until a later read returns them.
  • The reader is tickertape's safe pread reader, memory-safe whatever other processes do to the files. The zero-copy mapped reader of the Rust library is not exposed to Python.
  • Blocking calls (next, waiting read_many/read_batch, checkpoint, opening a writer, batch loops) release the GIL.
  • Writer and Reader objects can be used from any thread; calls on one object are serialized. A waiting read holds its reader for at most 50 ms at a time, so other calls on that reader (seek, close(), another read) run in between; closed, position and repr never wait at all. Reads from several threads share the one cursor: each record goes to exactly one of them, in order, and which one gets it is unspecified. A read that does not wait returns nothing only when no committed record is left, even if another thread took the records it had found. Give each consumer its own reader. Changing the class of an argument (for example adding or removing its __iter__) from another thread while a call is using that argument is not supported.
  • close() from another thread (or from a signal handler) ends a read that is waiting on that reader within about 50 ms; the waiting call raises ValueError, also when its timeout has passed meanwhile.
  • Fork: a Writer or Reader belongs to the process that opened it. In a child created by fork() (including multiprocessing's default start method on Linux before Python 3.14), every method raises UsedAfterForkError without touching the journal. A handle is the child's own only if it was opened in the child; a process id that matches is not enough (the bindings also count forks, so a reused process id is still recognised as foreign). close(), leaving a with block and garbage collection in the child release the child's copies of the file descriptors and memory mappings and nothing else: the parent keeps the writer's lock, and nothing is synced, changed or removed. So once the parent closes its writer, the journal can be opened again while the child is still running. Close inherited handles early in the child (until then its copy of the lock file's descriptor keeps the journal locked after the parent closes it). A handle that another thread was using at the moment of the fork is never released in the child: its state may be half-updated, and the dead thread's frame keeps a reference to it anyway, so its descriptors (for a writer, including the lock) stay open until the child exits or calls exec. A read that a signal handler interrupted to fork raises UsedAfterForkError in the child when the handler returns, having consumed nothing (also if its timeout passed meanwhile or the handler closed the reader). More generally, the owner check is the last thing the bindings do before they hand a result or an exception back to the interpreter (an exception object is built before it): if Python code forks during a call (a signal handler, or a finalizer run by the garbage collector), the call raises UsedAfterForkError in the child, whatever it would have returned or raised. A fork that happens after that, while the interpreter delivers the result (stores it, adds a traceback entry, or runs a signal handler), is after the call. That last check compares only the bindings' fork count, which CPython's fork hooks advance (the full check, process id included, is made as each call starts): a child forked during a call by C code that bypasses those hooks (a direct fork() that does not call PyOS_AfterFork_Child, as CPython requires) is detected only when it next calls a method. Arguments are converted before a method runs, so an invalid argument raises its TypeError (or OverflowError) in any process. Open handles in the child after it starts, or use the spawn or forkserver start method.
  • Free-threaded Python: no free-threaded wheels are published (abi3 wheels cannot load there). Building from the sdist for 3.14t works and runs without the GIL, but it is not tested in CI.

Ctrl-C and other signals

Waits check for signals at least every 50 ms, with the reader's lock released, so Ctrl-C raises KeyboardInterrupt promptly and signal handlers may use the reader (even close it). For every read (next, try_next, read_many, read_batch, iteration), in any thread:

  • If it raises (a signal handler raised, the reader was closed, or anything else failed), it consumed nothing: the records it had already taken from the journal stay with the reader and the next read returns them first, in order.
  • If it returns a value, exactly the records in that value were consumed.

Python runs signal handlers only in the main thread, so what follows about handlers concerns reads in the main thread. A read there delivers its records only after its result is complete and pending signal handlers have run. That covers a signal that arrives while the read builds a large result, or while it waits for another thread that is using the reader: the read runs the handlers immediately before every attempt to take the reader's lock, and nothing can run or wait between its final signal check and the delivery. While other threads keep taking the reader's lock (a stream of seek calls, for example), the delivery waits and the read may start over; it stays interruptible throughout, because every attempt is preceded by a signal check.

The boundary is that final signal check, and no binding can remove it: a signal that arrives after it is handled when the call returns, after the read has delivered its records (and freed a staging buffer too large to keep). If its handler raises before Python stores the result, the returned value is lost. A program that must not lose a record on Ctrl-C should handle SIGINT itself (for example, set a flag in the handler and stop after the current record).

A read in another thread never runs handlers, and a signal does not interrupt it; the two rules above still hold for it. A handler that runs in the main thread meanwhile may use the reader: if it closes it, the other thread's read raises ValueError and consumes nothing, or returns its records if it delivered them before the close took effect.

Errors

All errors derive from tt.TickertapeError: JournalIOError (also an OSError) and StorageFullError, LockedError (another writer has the journal), CorruptJournalError (path, offset, reason code, details), UnsupportedVersionError, JournalNotFoundError, SeqUnavailableError (also a LookupError), RecordTooLargeError and InvalidConfigError (also ValueError), DurabilityLostError, SequenceExhaustedError, DiscardedError (call seek to continue), BatchAppendError and UsedAfterForkError. Using a closed object raises ValueError. Every exception keeps its message and the current values of its attributes across pickle (for example from a multiprocessing worker); JournalIOError.strerror is the OS message, as os.strerror(errno).

Writer.recovery_report (a RecoveryReport with a list of RecoveryAction) and Writer.retention_report (a RetentionReport) are named tuples, like the results of the inspection functions below.

Inspection

tt.verify(path), tt.list_segments(path) and tt.read_checkpoint(path) never take the writer lock and are safe while a writer runs. So is tt.JournalStatus.sample(path), the sample that tickertape status prints (head, checkpoint age, exposure, storage headroom, reader beacons); Writer.metrics() and Reader.metrics(status) add what only the writer knows and a reader's lag. Unknown values are None, never guesses.

More

Licensed under MIT OR Apache-2.0.

Metadata

Release files for tickertape 1.0.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 tickertape 1.0.0
File Size Uploaded Provenance Actions
tickertape-1.0.0.tar.gz 343.6 kB With provenance Details for tickertape-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tickertape 1.0.0
File Actions
tickertape-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for tickertape-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
tickertape-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for tickertape-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
tickertape-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for tickertape-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
tickertape-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for tickertape-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
tickertape-1.0.0-cp311-abi3-macosx_11_0_x86_64.whl CPython 3.11 abi3 macOS 11.0+ x86-64 Details for tickertape-1.0.0-cp311-abi3-macosx_11_0_x86_64.whl
tickertape-1.0.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for tickertape-1.0.0-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 4.3 MB

Release files / tickertape-1.0.0.tar.gz

Download URL tickertape-1.0.0.tar.gz
Size 343.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5f0e9496963d61e1666e2d7b7e6c33be1acb2bac31e7262ed771567c2223e2b2
BLAKE2b-256 checksum
How to use checksums
fabe3fa4a82505e454bf90a1a46da69960dcfa114e60ceea5dde55c47481d069
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 Nov 23, 2026.

Transparency log

Release files / tickertape-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL tickertape-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 824.5 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
aa77d9d78e4df9fc29cd6fc09106d0acf57324ffd8bae9010c5a83fda4acd39f
BLAKE2b-256 checksum
How to use checksums
9ff50a184a0896deb8213ba21eff8bdf4a9035b717be035bd7ad63fd7604f23f
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 Nov 23, 2026.

Transparency log

Release files / tickertape-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL tickertape-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
Size 767.3 kB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
65c035f6ca7eb8e747526627d438e10f37489c12f614adf59f2afe246f9132e9
BLAKE2b-256 checksum
How to use checksums
80db9c17ccc031deb6bd28de671e503d1fa393ea77a0a346eaed2de37f59534e
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 Nov 23, 2026.

Transparency log

Release files / tickertape-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL tickertape-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 613.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
91fe6a53e64a7cc219c110aac51b4c03b38bea05afb8c465dbd61b72a29332a2
BLAKE2b-256 checksum
How to use checksums
80cbd029cb993eb569d1d425f927dd310f985d750c78bf6d76825514f745430d
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 Nov 23, 2026.

Transparency log

Release files / tickertape-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL tickertape-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 588.7 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
ce83260f774bb0c2e506f4d9e4beb4aec86391b52e2c1771df64708d2fd97fa4
BLAKE2b-256 checksum
How to use checksums
0992e477ee7554b6248c0d2b24e6731a9205badb57b3cec5605dca8bde41ad36
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 Nov 23, 2026.

Transparency log

Release files / tickertape-1.0.0-cp311-abi3-macosx_11_0_x86_64.whl

Download URL tickertape-1.0.0-cp311-abi3-macosx_11_0_x86_64.whl
Size 582.0 kB
Tags CPython 3.11 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
d5e79bb84d408aacb7c5c0d36dfbaa8c2b727dc94e7b8fff1b608fa18fb083c9
BLAKE2b-256 checksum
How to use checksums
6f78f0445965ef7f2a8c68a5db6df23ff6977eb03171597203643e47f30e23bf
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 Nov 23, 2026.

Transparency log

Release files / tickertape-1.0.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL tickertape-1.0.0-cp311-abi3-macosx_11_0_arm64.whl
Size 550.5 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
892c17ef869864b9c3de76dad10e602b01f67c60cda6fc33c52559e8a45186e6
BLAKE2b-256 checksum
How to use checksums
daae296ae4558437c64f13ab9f3f5dffa4e4dd10b16e7abd04b0096218e3a5eb
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 Nov 23, 2026.

Transparency log

Security for tickertape 1.0.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 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for tickertape-1.0.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 Nov 23, 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

1.0.0 This release

7 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