flpit
Fluent LINQ for Python โ flip your iterables
Downloads & Community Adoption
Health & Engineering Analysis (5 Pillars)
1. Governance & Community50 / 200 โพ
2. PEP Metadata & Packaging200 / 200 โพ
3. Security & Supply Chain150 / 200 โพ
4. Documentation, SEO & Ecosystem155 / 200 โพ
5. Engineering, CI & Quality200 / 200 โพ
Official Documentation & Usage Guide โ flpit
Show full original documentation (English README) โพ
FlpIt
๐ Documentation | ๐ GitHub | ๐ฆ PyPI
Fluent LINQ for Python โ LINQ semantics, Python-native execution
FlpIt brings a strongly typed, LINQ-style API to standard Python iterables. It combines the fluent query model and semantics of .NET LINQ with Python's native iterable and generator model.
If you know C# LINQ, you already know most of FlpIt. Existing LINQ examples, query patterns and documentation can generally be translated directly, which makes the .NET LINQ ecosystem a valuable reference for developers and AI coding assistants alike.
Queries are the doorway. Around them FlpIt carries over other parts of the .NET programming model: async streams
(AsyncFlpIt), typed JSON and CSV serialization, an asyncio-free task runtime, channels and concurrent collections. It is
tested on free-threaded Python (>=3.14t) in CI.
Semantic goal:
flpstrives to faithfully reproduce .NET LINQ semantics. Where Python's language or type system requires a different API contract, the contract is adapted accordingly, and each deviation is documented. The implementation is actively developed, and further deviations may still exist.
๐ก Quick Start
uv add flpit # or: pip install flpit
from flpit import flp, FlpIt, FlpList
# A lazy, streaming pipeline: nothing has run yet.
query: FlpIt[int] = (
flp.it(range(1, 11))
.where(lambda x: x % 2 == 0)
.select(lambda x: x * 10)
)
# Explicit materialization.
result: FlpList[int] = query.to_list()
# [20, 40, 60, 80, 100]
๐คธ Flipping the Pipeline
Native Python functional operations read inside-out. A FlpIt pipeline reads in the order things happen:
# ๐ Native built-ins
result = list(map(lambda x: x * 10, filter(lambda x: x % 2 == 0, range(1, 11))))
# ๐คธ FlpIt pipeline
result = (
flp.it(range(1, 11))
.where(lambda x: x % 2 == 0)
.select(lambda x: x * 10)
.to_list()
)
โก What's in the Box
- Lazy queries (
FlpIt) and materialized lists (FlpList): deferred, streaming execution over anyIterable[T], withwhere,select,select_many,order_by,group_by, joins and the rest ofSystem.Linq.Enumerable. Guide - Async queries (
AsyncFlpIt): theIAsyncEnumerable<T>counterpart, with async callbacks, cancellation and cleanup. Docs - Faithful semantics: when work happens, how much is read, what comes out and how it fails match .NET, also when operators are chained. Derived queries never affect each other. Semantics
- Typed JSON and CSV: dataclasses to and from JSON and CSV, with
msgspecor a pure-Python backend. JSON, CSV - Task runtime: an
asyncio-free runtime modelled on the .NET thread pool, built for free-threaded Python, withTask.when_all,when_each, continuations and cooperative cancellation. Blocking andasync deffunctions mix freely. Docs, sync and async - Channels, concurrent collections and threading primitives:
Channel[T],ConcurrentDictionary,SemaphoreSlimand friends. Docs - Static-first typing: designed for precise
pyreflyinference without plugins (mypy and pyright may give varying results).
FlpIt models in-memory LINQ (IEnumerable). It does not model IQueryable or expression trees.
โ๏ธ Installation
uv add flpit
msgspec is installed automatically on CPython. On other interpreters (PyPy, Pyodide) flpit
installs without it and uses the native JSON backend. Free-threaded CPython 3.13t is not
supported by msgspec: install there with --no-deps, or use 3.14t.
๐ฌ Feedback
FlpIt is in beta. Bug reports and questions are welcome as GitHub issues.
๐งญ Like FlpIt? Give .NET a try.
Enjoying FlpIt's .NET-inspired programming model? Here's where it comes from: try C# in your browser, explore LINQ, or keep your Python and call it from .NET.
๐ License
Distributed under the MIT License. See LICENSE for more information.
Migrated .NET Unit Tests
Migrated from the official .NET Runtime LINQ Tests. Note: The test cases exercise both core types,
FlpItandFlpList, with transitions between lazy and eager execution occurring as part of the individual test cases.async_linq/is migrated from the .NET 10System.Linq.AsyncEnumerabletests and exercisesAsyncFlpIton the flpit task runtime.channels/is migrated from theSystem.Threading.Channelstests;concurrent/from theSystem.Collections.Concurrenttests, including the sharedIEnumerable/ICollection/IDictionarysuites ofCommon/tests(ported tocommon/).
================================================================================
| Test Module File | Test Cases |
--------------------------------------------------------------------------------
| tests/nettests/ | |
| โโโ async_linq/ | |
| โ โโโ test_aggregate.py | 11 |
| โ โโโ test_all.py | 7 |
| โ โโโ test_any.py | 8 |
| โ โโโ test_append.py | 20 |
| โ โโโ test_average.py | 10 |
| โ โโโ test_cast.py | 6 |
| โ โโโ test_chunk.py | 5 |
| โ โโโ test_concat.py | 24 |
| โ โโโ test_contains.py | 11 |
| โ โโโ test_count.py | 8 |
| โ โโโ test_default_if_empty.py | 7 |
| โ โโโ test_distinct.py | 10 |
| โ โโโ test_distinct_by.py | 11 |
| โ โโโ test_element_at.py | 8 |
| โ โโโ test_empty.py | 2 |
| โ โโโ test_except.py | 12 |
| โ โโโ test_except_by.py | 13 |
| โ โโโ test_first.py | 8 |
| โ โโโ test_first_or_default.py | 8 |
| โ โโโ test_full_join.py | 11 |
| โ โโโ test_group_by.py | 5 |
| โ โโโ test_group_join.py | 9 |
| โ โโโ test_index.py | 8 |
| โ โโโ test_intersect.py | 12 |
| โ โโโ test_join.py | 9 |
| โ โโโ test_last.py | 8 |
| โ โโโ test_last_or_default.py | 8 |
| โ โโโ test_left_join.py | 10 |
| โ โโโ test_max.py | 11 |
| โ โโโ test_max_by.py | 13 |
| โ โโโ test_min.py | 11 |
| โ โโโ test_min_by.py | 13 |
| โ โโโ test_of_type.py | 5 |
| โ โโโ test_order_by.py | 18 |
| โ โโโ test_prepend.py | 19 |
| โ โโโ test_range.py | 3 |
| โ โโโ test_repeat.py | 3 |
| โ โโโ test_reverse.py | 8 |
| โ โโโ test_select.py | 9 |
| โ โโโ test_select_await.py | 10 |
| โ โโโ test_select_many.py | 5 |
| โ โโโ test_single.py | 9 |
| โ โโโ test_single_or_default.py | 9 |
| โ โโโ test_skip.py | 9 |
| โ โโโ test_skip_last.py | 9 |
| โ โโโ test_sum.py | 10 |
| โ โโโ test_take.py | 9 |
| โ โโโ test_take_last.py | 9 |
| โ โโโ test_to_async_enumerable.py | 10 |
| โ โโโ test_to_dictionary.py | 5 |
| โ โโโ test_to_list.py | 9 |
| โ โโโ test_to_lookup.py | 4 |
| โ โโโ test_union.py | 12 |
| โ โโโ test_where.py | 9 |
| โ โโโ test_where_await.py | 6 |
| โ โโโ test_zip.py | 12 |
| โโโ channels/ | |
| โ โโโ test_bounded_channel.py | 139 |
| โ โโโ test_channel.py | 16 |
| โ โโโ test_channel_closed_exception.py | 2 |
| โ โโโ test_debug_attribute.py | 0 |
| โ โโโ test_priority_unbounded_channel.py | 85 |
| โ โโโ test_rendezvous_channel.py | 104 |
| โ โโโ test_unbounded_channel.py | 338 |
| โโโ concurrent/ | |
| โ โโโ test_concurrent_bag.py | 130 |
| โ โโโ test_concurrent_dictionary.py | 56 |
| โ โโโ test_concurrent_dictionary_generic.py | 1236 |
| โ โโโ test_concurrent_queue.py | 130 |
| โ โโโ test_concurrent_stack.py | 124 |
| โ โโโ test_etw.py | 0 |
| โโโ linq/ | |
| โ โโโ test_aggregate.py | 42 |
| โ โโโ test_all.py | 80 |
| โ โโโ test_any.py | 90 |
| โ โโโ test_append_prepend.py | 36 |
| โ โโโ test_average.py | 572 |
| โ โโโ test_cast.py | 45 |
| โ โโโ test_chunk.py | 22 |
| โ โโโ test_concat.py | 64 |
| โ โโโ test_contains.py | 108 |
| โ โโโ test_count.py | 37 |
| โ โโโ test_default_if_empty.py | 37 |
| โ โโโ test_distinct.py | 87 |
| โ โโโ test_element_at.py | 43 |
| โ โโโ test_except.py | 68 |
| โ โโโ test_first.py | 29 |
| โ โโโ test_first_or_default.py | 50 |
| โ โโโ test_full_join.py | 37 |
| โ โโโ test_generic_list.py | 95 |
| โ โโโ test_group_by.py | 23 |
| โ โโโ test_group_join.py | 53 |
| โ โโโ test_index.py | 6 |
| โ โโโ test_intersect.py | 42 |
| โ โโโ test_join.py | 47 |
| โ โโโ test_last.py | 29 |
| โ โโโ test_last_or_default.py | 45 |
| โ โโโ test_left_join.py | 47 |
| โ โโโ test_max.py | 1100 |
| โ โโโ test_min.py | 968 |
| โ โโโ test_of_type.py | 38 |
| โ โโโ test_order_by.py | 100 |
| โ โโโ test_order_descending_by.py | 45 |
| โ โโโ test_reverse.py | 35 |
| โ โโโ test_select.py | 140 |
| โ โโโ test_select_many.py | 85 |
| โ โโโ test_single.py | 34 |
| โ โโโ test_single_or_default.py | 48 |
| โ โโโ test_skip.py | 75 |
| โ โโโ test_skip_last.py | 1221 |
| โ โโโ test_sum.py | 134 |
| โ โโโ test_take.py | 39 |
| โ โโโ test_take_last.py | 1221 |
| โ โโโ test_then_by.py | 40 |
| โ โโโ test_then_descending_by.py | 34 |
| โ โโโ test_to_dictionary.py | 32 |
| โ โโโ test_to_list.py | 40 |
| โ โโโ test_to_lookup.py | 26 |
| โ โโโ test_union.py | 62 |
| โ โโโ test_where.py | 76 |
| โ โโโ test_zip.py | 101 |
| โโโ task/ | |
| โ โโโ test_cancellation.py | 69 |
| โ โโโ test_task_completion_source.py | 26 |
| โ โโโ test_task_continue_with.py | 15 |
| โ โโโ test_task_continue_with_func_and_action.py | 16 |
| โ โโโ test_task_continue_with_func_and_action_args.py | 20 |
| โ โโโ test_task_factory.py | 3 |
| โ โโโ test_task_rt.py | 13 |
| โ โโโ test_task_rt_core.py | 27 |
| โ โโโ test_task_wait_all_any.py | 62 |
| โโโ threading/ | |
| โโโ test_semaphore_slim.py | 39 |
| โโโ test_semaphore_slim_cancellation.py | 4 |
| โโโ test_thread_local.py | 15 |
--------------------------------------------------------------------------------
| GRAND TOTALS | 10725 |
================================================================================