slicerator
A lazy-loading, fancy-sliceable iterable.
What it is and what it does
Slicerator is a decorator-based wrapper that turns a class with `__getitem__` and `__len__` methods into a lazy-loading, reusable iterable. Unlike a generator, a Slicerator object can be indexed multiple times and has a known length; unlike a list, it defers data loading until you actually access an element. You decorate your data-loading class with `@Slicerator.from_class`, and the wrapper automatically handles slices (e.g., `obj[::2]`), integer lists, and boolean masks—all without loading data until the final indexing operation.
The package is designed for scenarios where you want the convenience of array-like indexing and slicing but need to avoid loading everything into memory upfront. It chains slicing operations lazily, so `obj[::2][1:]` computes the combined slice without materializing intermediate results. With no runtime dependencies and a pure-Python implementation, it integrates easily into existing projects.
Use it for:
- Wrapping a file reader or database query class to support array-like slicing without loading all records into memory.
- Building lazy-loading image or video frame sequences that only decode frames when indexed.
- Creating a filtered or transformed view of a dataset that defers computation until specific elements are accessed.
- Chaining multiple slice operations on large datasets to avoid intermediate materialization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Slicerator wraps a class's `__getitem__` method to create a lazy-loading iterable that supports fancy indexing—slices, integer lists, and boolean masks—while deferring data loading until access.
Yes, if you need lazy-loading with fancy indexing and have a class-based data source. The low install friction, permissive license, and zero runtime dependencies make it a lightweight addition. However, the package is aging—latest release 2022-04-07—so verify it meets your Python version and use case before committing.
Install
slicerator on PyPI
pip
pip install sliceratoruv
uv add sliceratorpoetry
poetry add sliceratorInstalling slicerator
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 2022-04-07 and the repository has not been updated since 2025-06-30, though it remains unarchived.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions.
Quickstart
from slicerator import Slicerator
@Slicerator.from_class
class MyLazyLoader:
def __getitem__(self, i):
return thing
def __len__(self):
return number_of_things
a = MyLazyLoader()
s1 = a[::2]
data = s1[0]
Verify before relying
- Whether the package is actively maintained or in maintenance-only mode given the gap between latest release and recent commits.
- Performance characteristics when chaining multiple slicerator operations or working with very large datasets.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 1,590 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 337,812/month — #7,444 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: slicerator-1.1.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
iterproxyWraps any iterable object to provide ORM-style…
permissive · top 5,000 on PyPI
LazifyLazify provides lazy evaluation utilities for…
permissive · top 15,000 on PyPI
lazy-importDefers module loading and ImportErrors until a…
copyleft · top 15,000 on PyPI
renewGenerates reproducible string representations…
permissive · top 15,000 on PyPI
ordered-setOrderedSet is a mutable collection that…
permissive · top 1,000 on PyPI
slicerProvides a uniform slicing interface for…
permissive · top 5,000 on PyPI
wrapsProvides type-safe wrapper types for…
permissive · top 15,000 on PyPI
lazy-loaderLazy-loader defers the import of subpackages…
permissive · top 1,000 on PyPI
vineVine provides a Python implementation of…
permissive · top 1,000 on PyPI