Skip to main content

Composable external iteration.

Project description

iters

License Version Downloads Discord

Documentation Check Test Coverage

Composable external iteration.

If you have found yourself with a collection of some kind, and needed to perform an operation on the elements of said collection, you will quickly run into iterators. Iterators are heavily used in idiomatic Python code, so becoming familiar with them is essential.

Installing

Python 3.8 or above is required.

pip

Installing the library with pip is quite simple:

$ pip install iters

Alternatively, the library can be installed from source:

$ git clone https://github.com/nekitdev/iters.git
$ cd iters
$ python -m pip install .

poetry

You can add iters as a dependency with the following command:

$ poetry add iters

Or by directly specifying it in the configuration like so:

[tool.poetry.dependencies]
iters = "^0.18.0"

Alternatively, you can add it directly from the source:

[tool.poetry.dependencies.iters]
git = "https://github.com/nekitdev/iters.git"

Examples

Simple

Squaring only even numbers in some sequence:

from iters import iter


def is_even(value: int) -> bool:
    return not value % 2


def square(value: int) -> int:
    return value * value


numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

result = iter(numbers).filter(is_even).map(square).list()

print(result)  # [0, 4, 16, 36, 64]

Asynchronous

Asynchronous iteration is fully supported by iters, and its API is similar to its synchronous counterpart.

Documentation

You can find the documentation here.

Support

If you need support with the library, you can send an email or refer to the official Discord server.

Changelog

You can find the changelog here.

Security Policy

You can find the Security Policy of iters here.

Contributing

If you are interested in contributing to iters, make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

License

iters is licensed under the MIT License terms. See License for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iters-0.18.0.tar.gz (54.8 kB view details)

Uploaded Source

Built Distribution

iters-0.18.0-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

Details for the file iters-0.18.0.tar.gz.

File metadata

  • Download URL: iters-0.18.0.tar.gz
  • Upload date:
  • Size: 54.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1018-azure

File hashes

Hashes for iters-0.18.0.tar.gz
Algorithm Hash digest
SHA256 a4675193c8c0d60d7cca7e97c0eea588d37b586df268346070e0550d978fdb55
MD5 cfb8274b187fe000f6019f639955aa24
BLAKE2b-256 6b0645ff764cfcd3ab7e9f60127cca16f931204d54d4925bf6592bd5dd2dde89

See more details on using hashes here.

File details

Details for the file iters-0.18.0-py3-none-any.whl.

File metadata

  • Download URL: iters-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 57.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1018-azure

File hashes

Hashes for iters-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 932eec3100eed3768699401983c3ca254bde1b0cf09aa9e452d5f063719d8654
MD5 85046c29df7bd878364b1cb5b2e96238
BLAKE2b-256 215fd11beae693356c6c4bbe11eb45ff5c5b380e906f338116ddd46a1708560a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page