skillfed

roundrobin

Collection of roundrobin utilities

roundrobin v0.1.0 808.9K downloads/30d#5,012 on PyPI18
Permissive license MIT AGING released

What it is and what it does

Roundrobin is a pure-Python library for selecting items in a cyclic, weighted, or smoothly-weighted distribution. It implements four selection strategies: basic round-robin cycles through items in order; weighted round-robin distributes picks proportionally to assigned weights (classic LVS algorithm); smooth weighted round-robin avoids clustering by spreading picks more evenly (Nginx-style); and smooth_stateful adds runtime controls to adjust weights, disable items, and enable slow-start ramping without restarting the schedule.

The library is designed for load-balancing scenarios where you need to distribute requests or work across multiple backends or workers. It has no external dependencies and works across Python 2.7 and Python 3.4 through 3.15. The stateful variant is useful for health checks and dynamic capacity changes, though it is not thread-safe and requires external synchronization if shared across threads.

Use it for:

  • Distribute HTTP requests across multiple backend servers with configurable weights and smooth distribution.
  • Implement health-check-aware load balancing by disabling unhealthy backends and re-enabling them with slow-start.
  • Balance work items across thread or process pools with weighted capacity allocation.
  • Rotate through a list of API endpoints or data sources in a predictable, weighted manner.
  • Implement slow-start ramp-up for newly added servers to avoid thundering-herd effects.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides four round-robin selection algorithms: basic (cyclic), weighted (LVS-style), smooth weighted (Nginx-style), and smooth weighted with runtime controls for health checks and slow-start.

Yes, if you need round-robin selection with weighted or smooth distribution. The package is lightweight, dependency-free, and well-documented with clear examples. Maintenance is aging but stable; no known vulnerabilities. Not suitable for high-concurrency scenarios without external locking. Best fit for single-threaded or lock-protected use cases in load balancing, task distribution, or endpoint rotation.

Install

roundrobin on PyPI

pip

pip install roundrobin

uv

uv add roundrobin

poetry

poetry add roundrobin

Installing roundrobin

Before you install

Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging (201 days since last release), but the repository remains active and the package has been stable since its first release in 2019.

License in practice

MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source contexts.

Quickstart

pip install roundrobin

import roundrobin
get_rr = roundrobin.basic(["A", "B", "C"])
print(get_rr())  # returns next item in cycle

# Weighted variant
get_weighted = roundrobin.weighted([("A", 5), ("B", 1)])
print(get_weighted())  # respects weight ratios

# Smooth weighted with runtime control
rr = roundrobin.smooth_stateful([("A", 5), ("B", 1)])
rr.disable("A")  # remove from rotation
rr.enable("A", effective_weight=0)  # slow-start
print(rr())  # returns next item

Verify before relying

  • Whether the package is actively maintained beyond bug fixes (last commit 2026-01-25, but no recent feature development signals).
  • Performance characteristics under high-frequency selection (throughput, latency per call).
  • Whether smooth_stateful's state management scales well with many items or frequent weight changes.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 201 days since the last release
Last repo commit
First released
Downloads 808,897/month — #5,012 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: roundrobin-0.1.0-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPy

Tags

round robin selectorweighted load balancingsmooth round robinnginx-style balancinglvs weighted distributionruntime weight adjustmenthealth check balancing
load-balancingschedulingstateful-selection

More Utilities packages