Skip to main content

Plinq is a library for python, implementing the Language Integrated Query (LINQ) from the C# language. Of course it is not a full port of the feature, it is only working with in memory iterable objects, including:

  • lists

  • sets

  • dictionaries

  • files

  • xml elements

  • generators

  • and every class which implements the iterable/iterator protocol ( __iter__ and __next__)

Plinq tries to mimic the Enumerable<T> interface from C# as much as possible.

  • It has the same method names, wherever possible, and the same parameters too

Plinq operators are lazy, meaning calling one, will not start the actual work. It will only happen, when the iteration over the returned object is started.

Plinq operators returning a new Linq object, so operator calls can be chained into a fluent API like call.

How do I get set up?

  • Summary of set up

    • There are several ways to set up plinq:

      • The simplest way is to invoke pip install plinq

      • You can also check out the repository, and add the path to it to your python path

      • Combining the two above steps, you can check out the repository, create a distribution package by executing the setup.py file, and then install that package with pip

    • After these steps you can simply import plinq and start using the library

  • Configuration

    • No additional configuration is needed

  • Dependencies

    • plinq has no external dependencies. The only requirement is to have at least Python 3.5.2

  • How to run tests

    • After you have checked out the repository, you can run the python unit tests by invoking the following command from the root directory of the repository:

      • python -m unittest discover test/

Who do I talk to?

Example usage

import plinq
linq = plinq.from_iterable([1, 2, 3, 4, 5]).where(lambda item, index: item % 2 == 0).select(lambda item, index: item ** 2)
for item in linq:
    print(item)

This will result in the following output:

4
16

Version History

  • 0.1: Never released externally

  • 0.2: Initial release on pypi. Includes almost all the linq operators, except then_by and then_by_descending

  • 0.3: Added then_by and then_by_descending linq operarors, and max_item and min_item operators.

Metadata

Release files for plinq 0.3

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

Source distribution (sdist)

Source distribution for plinq 0.3
File Size Uploaded
plinq-0.3.tar.gz 27.1 kB Details

Release files / plinq-0.3.tar.gz

Download URL plinq-0.3.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
affcf7a5ec1a2280a7a734f95fb5c1692522f1e973e33fd0253b423bc82b5f16
BLAKE2b-256 checksum
How to use checksums
dc51c621093fedd6c88f029d3b0d0745927a4b9332031e34e2af8544b3355641
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

0.2

1 release file

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