Skip to main content

Fluent-based Lazily-evaluated Integrated Query for Python

Project description

drawing Fliq

Fluent-syntaxed Lazily-evaluated Integrated Query.

build lint coverage

Python Versions PyPI - Version Downloads Ruff

Fliq is a lightweight Python library for high-performance lazy processing of iterables. Inspired by Django's ORM and LINQ, it provides a fluent syntax for lazily-evaluated operations on iterables, and it is tested to have on-par performance with the standard library. Also, for all you type-a-holics, Fliq is fully equipped with generic type hints, so it supports mypy in strict mode.

Installation

pip install fliq
  • Fliq does not have any dependencies.
  • Fliq supports Python 3.9 and above.

Fliq is

  • 💡 Intuitive to use. Built for readability and usability. Fully typed.
  • 🪶 Lightweight wrapper for the standard library. No dependencies or bloat.
  • ⚡️ Efficient as the standard library. Abstraction overhead is kept to a minimum.
  • Lazy evaluated, executed only when needed and only as needed.
  • 🔗 Versatile by supporting any iterable type, including infinite iterables.
  • 🧩 Compatible with APIs consuming iterables. No integration or setup required.

Motivation

What is the output of the following code?

next(map(lambda x: x * 2, filter(lambda x: x % 2 == 0, [1, 2, 3, 4, 5])), -1)

And what about this?

from fliq import q

(q([1, 2, 3, 4, 5])
    .where(lambda x: x % 2 == 0)
    .select(lambda x: x * 2)
    .first_or_default(default=-1))

And this is just a simple example.

Python's standard library provides a rich set of functions for processing iterables. However, it is not always easy to read and use.

This is especially true when chaining multiple operations together. This is where Fliq comes in. Fliq provides a fluent, easy to read syntax for processing iterables, while keeping performance on-par with the standard library.

Performance

Fliq is geared for performance:

  • 🛌 It is lazily evaluated without requiring any intentional effort from the user.
  • ⚡️ It is also tested to have on-par performance with the standard library.

There are two mechanisms for checking Fliq's performance:

  • 🧪 Performance tests are ran on every commit, and they compare Fliq's performance to the standard library.
  • 📊 Benchmarking is done against the standard library.

Here is a glimpse of the benchmarking results: Benchmarking

You can read more about Fliq's performance here.

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

fliq-1.11.0.tar.gz (351.3 kB view details)

Uploaded Source

Built Distribution

fliq-1.11.0-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

Details for the file fliq-1.11.0.tar.gz.

File metadata

  • Download URL: fliq-1.11.0.tar.gz
  • Upload date:
  • Size: 351.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for fliq-1.11.0.tar.gz
Algorithm Hash digest
SHA256 81a9077f2622fc69d638455c7d1547b8bab25f73ce968e8f0b6fd77171fa44b3
MD5 3e1b48e282bcc9e14e47e0e7362a0d9c
BLAKE2b-256 4ff49ad300221b480992986e2ddda16416f96f63b4220fa4d4a1b5d63a011a76

See more details on using hashes here.

File details

Details for the file fliq-1.11.0-py3-none-any.whl.

File metadata

  • Download URL: fliq-1.11.0-py3-none-any.whl
  • Upload date:
  • Size: 45.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for fliq-1.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a10f672f9c708de98083cf3f8bd4ae086d78c46ca57c18b330b9e48b70c936a2
MD5 9771088b979f1ad648fc38e54c609b0d
BLAKE2b-256 a62459b4b83e67384287548489ec1b9214f13eddf3a5f3fa50841e812ddf210e

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