Registry / data / fnc
library0.5.3pypypiunverified

fnc is a Python library that provides functional programming utilities, primarily focusing on working with generators and iterable data. It offers curried versions of common functions like `map`, `filter`, and `pipe` for a more declarative style. The current version is 0.5.3, released in October 2021, and the project is in a maintenance mode with infrequent updates.

pip install fnc
INSTALL
IMPORT
SIG · FNC
F
fnc
datapythonv0.5.3
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.5.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pipe
✓ from fnc import pipe
✗ from fnc import pipe
compose
✓ from fnc import compose
filter
✓ from fnc import filter

Demonstrates the use of `pipe` for chaining functional operations and how curried functions like `map` and `filter` are applied.

from fnc import pipe, map, filter, take data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # Example 1: Use pipe for a functional chain result_pipe = pipe( data, map(lambda x: x * 2), # Double each number filter(lambda x: x > 10), # Keep only numbers greater than 10 take(3), # Take the first 3 results list # Materialize the generator into a list ) print(f"Result with pipe: {result_pipe}") # Expected: [12, 14, 16] # Example 2: Curried map and filter manually double = map(lambda x: x * 2) odd = filter(lambda x: x % 2 != 0) processed_data = double(odd(data)) # Apply odd filter, then double print(f"Manual curried chain: {list(processed_data)}") # Expected: [2, 6, 10, 14, 18]
Debug
Known issues
gotchafnc's `map` and `filter` conflict with Python's built-in `map` and `filter`. The `fnc` versions are curried, meaning they expect to be called with arguments in stages (e.g., `map(func)(iterable)` or used within `pipe`), unlike the built-in versions which expect `map(func, iterable)`.
fix
When importing `fnc.map` or `fnc.filter`, either alias them (e.g., `from fnc import map as fnc_map`) or ensure you understand their curried nature and use them accordingly, typically within a `pipe` call or by first applying the function argument.
affects: All versions
gotchaMost `fnc` utilities return generators or iterators. For immediate evaluation and to see concrete results, you must explicitly convert them to a list, tuple, or other materializable collection (e.g., `list(result)`).
fix
Append `.list()` or `list()` around the final operation in your functional chain to materialize the results. Example: `pipe(data, ..., list)` or `list(some_fnc_operation(data))`.
affects: All versions
gotchaThe `fnc` library is in maintenance mode; the last release (0.5.3) was in 2021. While stable, active development and new features are not frequent. Consider this for long-term project planning or if cutting-edge functional features are required.
fix
Be aware that new issues or Python version incompatibilities might not be addressed immediately. It's generally stable for Python 3.6+, but extensive testing with newer Python versions is recommended for critical applications.
affects: 0.5.3 and previous
Upgrade
Version history
0.5.3latest on PyPI · released Oct 15, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
fnc — pip install fnc · libregistry