Registry / data / tailer

tailer

JSON →
library0.4.1pypypi✓ verified 83d ago

Tailer is a Python library that provides simple implementations of the GNU `tail` and `head` utilities, allowing you to read the last few lines of a file or follow a file for new content as it's written. The current version is 0.4.1, and the project has a low release cadence, indicating stability for its core functionality.

pip install tailer
INSTALL
IMPORT
SIG · TAILER
T
tailer
datapythonv0.4.1
Install
2.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.6s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tailer
from tailer import Tailer
import tailer
follow
from tailer import follow
import tailer
head
from tailer import head
import tailer

This quickstart demonstrates how to use `tailer.tail` to read the last few lines of a file and `tailer.head` to read the first few lines. It first creates a dummy file, then applies both functions, ensuring to pass an opened file object to them.

import tailer import os # Create a dummy log file for demonstration file_path = 'my_log_file.log' with open(file_path, 'w') as f: f.write('Line 1\n') f.write('Line 2\n') f.write('Line 3\n') f.write('Line 4\n') f.write('Line 5\n') f.write('Line 6\n') # Read the last 3 lines using tailer.tail print(f"Reading last 3 lines of '{file_path}':") with open(file_path, 'r') as f: for line in tailer.tail(f, 3): print(line.strip()) # Read the first 2 lines using tailer.head print(f"\nReading first 2 lines of '{file_path}':") with open(file_path, 'r') as f: for line in tailer.head(f, 2): print(line.strip()) # Cleanup the dummy file os.remove(file_path)
Debug
Known issues
gotchaTailer functions (tail, head, follow) expect an *open file object*, not a file path string. Passing a string will result in a TypeError or incorrect behavior.
fix
Always pass `open('your_file.log', 'r')` or a file-like object to tailer functions, e.g., `tailer.tail(open('my_file.log', 'r'), 10)`.
affects: All versions
gotcha`tailer.follow()` is a blocking generator. It will continuously yield new lines as they are written to the file and will not terminate until the process is stopped or the generator is explicitly broken out of.
fix
Use `tailer.follow()` in an infinite loop with appropriate `break` conditions or signal handling, or run it in a separate thread/process if your main application needs to continue execution.
affects: All versions
deprecatedThe `tailer` library has not been updated since 2017 (version 0.4.1). While stable for its intended purpose, it may not leverage newer Python features, handle modern asynchronous patterns, or receive security updates.
fix
For basic file tailing, it remains functional. For complex, high-performance, or modern asynchronous applications, consider alternative libraries or custom implementations.
affects: 0.4.1 and earlier
Upgrade
Version history
0.4.1latest on PyPI · released Dec 9, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
tailer — pip install tailer · libregistry