flpit
Fluent LINQ für Python – drehen Sie Ihre Iterables um
Downloads & Community-Verbreitung
Gesundheits- & Engineering-Analyse (5 Säulen)
1. Governance & Community50 / 200 ▾
2. PEP-Metadaten & Paketierung200 / 200 ▾
3. Sicherheit & Lieferkette150 / 200 ▾
4. Dokumentation, SEO & Ökosystem155 / 200 ▾
5. Engineering, CI & Qualität200 / 200 ▾
Offizielle Dokumentation & Nutzungsleitfaden — flpit
Vollständige Originaldokumentation anzeigen (Englisches 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 |
================================================================================