Skip to main content

countably

PyPI version Supported Python versions Documentation Status

Lazy, immutable, infinite numeric sequences for Python.

countably lets you describe sequences declaratively, the way you’d write them on paper, and evaluate them on demand:

from countably import count, constant

triangular = count() * (count() + 1) // 2     # 0, 1, 3, 6, 10, ...
powers_of_two = 2 ** count()                  # 1, 2, 4, 8, 16, ...
every_third = count()[2::3]                   # 2, 5, 8, 11, ...

The primitives are just constant and count. Arithmetic, comparisons, slicing, and element-wise maximum / minimum build everything else. Plain numbers are coerced automatically, so 3 + 5 * count() is equivalent to constant(3) + constant(5) * count().

Highlights

  • Lazy – elements are computed only on access, with a per-instance 100-item LRU cache for random access. Iteration walks the inputs directly, bypassing the cache.

  • Immutable – every operation produces a new sequence; nothing is mutated.

  • Iterable, not iterator – iter(seq) starts fresh every time.

  • Slices are lazy too – seq[2::3] stays infinite, seq[2:10] is finite with a real len(). Arithmetic between sequences uses the shorter length.

  • Round / floor / ceil / trunc are supported through the standard Python protocols (math.floor(seq), round(seq)).

  • Comparisons (<, <=, >, >=) return sequences of booleans, which are numbers in the same world.

See doc/quick-start.rst for usage including a Fibonacci one-liner.

Install

pip install countably

Metadata

Release files for countably 2026.5.31.3020

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for countably 2026.5.31.3020
File Size Uploaded Provenance Actions
countably-2026.5.31.3020.tar.gz 13.6 kB With provenance Details for countably-2026.5.31.3020.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for countably 2026.5.31.3020
File Interpreter ABI Platform Actions
countably-2026.5.31.3020-py3-none-any.whl Python 3 none any Details for countably-2026.5.31.3020-py3-none-any.whl

Total release size: 28.4 kB

Release files / countably-2026.5.31.3020.tar.gz

Download URL countably-2026.5.31.3020.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cdd8c35f85b46f859e7c43978a149d29175ac39490d9dd59214712a11f73d682
BLAKE2b-256 checksum
How to use checksums
939c7e53c6dcab65c8916433fb73db81fc499de9dcd545baea61907ae4a17d14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 May 31, 2026.

Transparency log

Release files / countably-2026.5.31.3020-py3-none-any.whl

Download URL countably-2026.5.31.3020-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a383827ec6c3555d31bbe27dd3a736d34e729a961a2d729fe87bd3177647262
BLAKE2b-256 checksum
How to use checksums
5593246633b72e8ab7b076933c16094f82b35a8ee2d0e3957f2ff81f4f2dfde3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 May 31, 2026.

Transparency log

Security for countably 2026.5.31.3020

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for countably-2026.5.31.3020.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 May 31, 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.

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